Skip to content
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

Security Enhancements #510

Merged
merged 1 commit into from
Apr 19, 2017
Merged

Security Enhancements #510

merged 1 commit into from
Apr 19, 2017

Conversation

akutz
Copy link
Collaborator

@akutz akutz commented Apr 14, 2017

This patch enhances libStorage security:

  • If discovered in $LIBSTORAGE_HOME_ETC_TLS the following files are automatically loaded:

    • libstorage.crt
    • libstorage.key
    • cacerts

  • If $LIBSTORAGE_HOME_ETC_TLS/known_hosts exists it is automatically loaded unless the property libstorage.tls.knownHosts is explicitly defined. This is the system's known_hosts file.

  • If $HOME/.libstorage/known_hosts exists it is automatically used when TLS security is set to verify peer certificates. This is the user's known_hosts file.

  • The above known_hosts files are line-delimited with each line following the format: HOST ALGORITHM FINGERPRINT

  • When matching a remote host's known host information the peer's host (derived from the certificate's Subject.CommonName) is also taken into account. Thus if a host is marked as trusted but later provides a different certificate during TLS negotiation the connection will fail. This is identical to SSH's known host logic.

  • The property libstorage.tls.verifyPeers is introduced. It's a boolean flag that indicates TLS connections should be verified against a known list of peer certificate fingerprints in the system's and user's known_hosts files.

    Enabling this property also sets libstorage.tls.insecure to true. The connection will be encrypted, but the certificate verification is disabled and deferred to the peer verification.

  • The property libstorage.tls can now be set to a simple string value of verifyPeers to indicate TLS connections should be verified against the system's and user's known_hosts files.

@akutz akutz self-assigned this Apr 14, 2017
@akutz akutz requested a review from codenrhoden April 14, 2017 19:27
@akutz
Copy link
Collaborator Author

akutz commented Apr 14, 2017

Hi @codenrhoden,

I accidentally pushed this branch to the upstream repo hence the forever-failed build (linked to that repo). The PR build is passing however.

@akutz akutz force-pushed the feature/auth-files branch 2 times, most recently from 206776f to 2edd739 Compare April 14, 2017 19:33
@codecov-io
Copy link

codecov-io commented Apr 14, 2017

Codecov Report

Merging #510 into master will decrease coverage by 0.7%.
The diff coverage is 10.43%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #510      +/-   ##
==========================================
- Coverage   30.77%   30.07%   -0.71%     
==========================================
  Files          33       33              
  Lines        2008     2125     +117     
==========================================
+ Hits          618      639      +21     
- Misses       1318     1414      +96     
  Partials       72       72
Impacted Files Coverage Δ
api/types/types_config.go 0% <ø> (ø) ⬆️
api/utils/utils_config.go 0% <0%> (ø) ⬆️
api/types/types_errors.go 0% <0%> (ø) ⬆️
api/utils/utils_tls.go 0% <0%> (ø) ⬆️
api/types/types_paths.go 64.22% <76%> (+3.43%) ⬆️
api/types/types_localdevices.go 79.24% <0%> (+1.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8f2b1b...fffd5e5. Read the comment docs.

@akutz akutz force-pushed the feature/auth-files branch 8 times, most recently from 8485e73 to 9d266da Compare April 19, 2017 05:12
This patch enhances libStorage security:

* If discovered in '$LIBSTORAGE_HOME_TLS' the following files
  are automatically loaded:

  * `libstorage.crt`
  * `libstorage.key`
  * `cacerts`

* If `$LIBSTORAGE_HOME_ETC_TLS/known_hosts` exists it is automatically
  loaded unless the property `libstorage.tls.knownHosts` is explicitly
  defined. This is the system's `known_hosts` file.

* If `$HOME/.libstorage/known_hosts` exists it is automatically used
  when TLS security is set to verify peer certificates. This is the
  user's `known_hosts` file.

* The above `known_hosts` files are line-delimited with each line
  following the format: 'HOST ALGORITHM FINGERPRINT'

* When matching a remote host's known host information the peer's host
  (derived from the certificate's Subject.CommonName) is also taken into
  account. Thus if a host is marked as trusted but later provides a
  different certificate during TLS negotiation the connection will fail.
  This is identical to SSH's known host logic.

* The property `libstorage.tls.verifyPeers` is introduced. It's a
  boolean flag that indicates TLS connections should be verified
  against a known list of peer certificate fingerprints in the
  system's and user's `known_hosts` files.

  Enabling this property also sets `libstorage.tls.insecure` to `true`.
  The connection will be encrypted, but the certificate verification is
  disabled and deferred to the peer verification.

* The property `libstorage.tls` can now be set to a simple string value
  of `verifyPeers` to indicate TLS connections should be verified
  against the system's and user's `known_hosts` files.
@akutz akutz force-pushed the feature/auth-files branch from 9d266da to fffd5e5 Compare April 19, 2017 05:15
@akutz akutz merged commit 111ef6f into thecodeteam:master Apr 19, 2017
@akutz akutz deleted the feature/auth-files branch April 19, 2017 12:59
@codenrhoden codenrhoden modified the milestone: 2017.04 May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants