-
Notifications
You must be signed in to change notification settings - Fork 417
Adding SSL support to server and command line clients. #899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fd67988
to
eeb4d81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to codacy: ssl.wrap_socket call with no SSL/TLS protocol version specified, the default SSLv23 could be insecure, possible security issue.
Maybe we should fix this problem.
self.__host = host | ||
self.__port = port | ||
self.transport = THttpClient.THttpClient(self.__host, self.__port, uri) | ||
url = protocol+"://"+host+":"+str(port)+uri | ||
self.transport = THttpClient.THttpClient(url) | ||
self.protocol = TJSONProtocol.TJSONProtocol(self.transport) | ||
self.client = codeCheckerAuthentication.Client(self.protocol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The protocol
and self.protocol
are two distinct things. Maybe we should name them separately.
self.__host = host | ||
self.__port = port | ||
self.transport = THttpClient.THttpClient(self.__host, self.__port, uri) | ||
url = protocol+"://"+host+":"+str(port)+uri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This url creating code is there multiple times, maybe worth to create a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about the name of protocol
as above.
certfile=ssl_cert_file) | ||
|
||
else: | ||
LOG.info("SSL key or cert files not found. cert:" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to display this message even if the user never configured this? It is just an ergonomic change in the future.
libcodechecker/util.py
Outdated
@@ -266,7 +266,7 @@ def split_server_url(url): | |||
LOG.debug("Parsing server url '{0}'".format(url)) | |||
|
|||
protocol = 'http' | |||
if url.startswith('http'): | |||
if url.startswith('http') or url.startswith('https'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If url starts with https
it also starts with http
right? This check might be redundant.
tests/libtest/thrift_client_to_db.py
Outdated
host, port, '/' + product + '/v' + VERSION + endpoint) | ||
url = protocol+"://"+host+":"+str(port) +\ | ||
'/' + product + '/v' + VERSION + endpoint | ||
print ("setup viewer client:"+url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this print intended? If so, maybe having a space after colon and starting with capital letter would be great.
38b8933
to
3db75c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few nits otherwise LGTM!
tests/libtest/codechecker.py
Outdated
|
||
url = protocol + "://"+server_data['viewer_host'] +\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could use the just introduced util here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format the code better so +
is wrapped in spaces around the operand.
tests/libtest/thrift_client_to_db.py
Outdated
auto_handle_connection=True, session_token=None): | ||
# Import only if necessary; some tests may not add this to PYTHONPATH. | ||
from libcodechecker import session_manager | ||
from codeCheckerDBAccess_v6 import codeCheckerDBAccess | ||
from codeCheckerDBAccess_v6.constants import MAX_QUERY_SIZE | ||
|
||
self.max_query_size = MAX_QUERY_SIZE | ||
transport = THttpClient.THttpClient( | ||
host, port, '/' + product + '/v' + VERSION + endpoint) | ||
url = protocol+"://"+host+":"+str(port) +\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the introduced util applicable here?
tests/libtest/thrift_client_to_db.py
Outdated
full_uri = '/v' + VERSION + uri | ||
if product: | ||
full_uri = '/' + product + full_uri | ||
|
||
transport = THttpClient.THttpClient(host, port, full_uri) | ||
url = proto+"://"+host+":"+str(port)+full_uri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the introduced util applicable here?
tests/libtest/thrift_client_to_db.py
Outdated
session_token=None): | ||
# Import only if necessary; some tests may not add this to PYTHONPATH. | ||
from libcodechecker import session_manager | ||
from Authentication_v6 import codeCheckerAuthentication | ||
|
||
transport = THttpClient.THttpClient(host, port, '/v' + VERSION + uri) | ||
url = proto+"://"+host+":"+str(port)+'/v' + VERSION + uri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the introduced util applicable here?
3db75c1
to
bf23cc0
Compare
bf23cc0
to
870221a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor stuff. Mostly docs and stuff. Thank you, @dkrupp, for implementing this.
docs/products.md
Outdated
PRODUCT_URL` parameter, which specifies the access protocol, | ||
server host, port, and the product's unique endpoint | ||
in the following format: `http[s]://localhost:8001/Default`, | ||
where `Default` is the product's endpoint. See the [User Guide](/docs/user_guide.md#product_url-format ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a space before the )
docs/usage.md
Outdated
``` | ||
CodeChecker store ./reports --host localhost --port 8555 --name tmux | ||
CodeChecker store ./reports --name tmux --url http://loclahost:8555/Default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localhost
has a typo in it
docs/products.md
Outdated
details. | ||
PRODUCT_URL` parameter, which specifies the access protocol, | ||
server host, port, and the product's unique endpoint | ||
in the following format: `http[s]://localhost:8001/Default`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is http
mandatory even if we are using only HTTP?
docs/user_guide.md
Outdated
|
||
To enable SSL simply place ssl certificate to `<CONFIG_DIRECTORY>/cert.pem` | ||
and the corresponding private key to `<CONFIG_DIRECTORY>/key.pem`. | ||
When the server finds these files upon start-up. SSL will be automatically enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sentences are broken wrongly, perhaps you meant a ,
instead of .
?
docs/user_guide.md
Outdated
You can enforce SSL security on your listening socket. In this case all clients must | ||
access your server using the `https://host:port` URL format. | ||
|
||
To enable SSL simply place ssl certificate to `<CONFIG_DIRECTORY>/cert.pem` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SSL is uppercase, and then lowercase.
tests/libtest/codechecker.py
Outdated
@@ -87,7 +88,7 @@ def logout(codechecker_cfg, test_project_path): | |||
logout_cmd = ['CodeChecker', 'cmd', 'login', | |||
'--logout', | |||
'--verbose', 'debug', | |||
'--url', 'localhost:' + port] | |||
'--url', protocol+'://'+'localhost:' + port] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator format
tests/libtest/codechecker.py
Outdated
|
||
url = protocol + "://"+server_data['viewer_host'] +\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator format
@@ -0,0 +1,32 @@ | |||
-----BEGIN CERTIFICATE----- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a self-signed certificate? Are we sure we are not leaking anything here?
@@ -940,6 +967,15 @@ root account arguments: | |||
not require authentication otherwise. | |||
~~~~~~~~~~~~~~~~~~~~~ | |||
|
|||
### Enfore secure socket (SSL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should link to some generally available guide which explains how to make an SSL certificate?
@@ -0,0 +1,32 @@ | |||
-----BEGIN CERTIFICATE----- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shell actions that were used to make these test files, I think, should be saved to this folder in an .sh
file too.
3a661b2
to
e05e2af
Compare
10ec4b4
to
4bae654
Compare
4bae654
to
e143d12
Compare
No description provided.