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

[BESU-77] - Enable TLS for JSON-RPC HTTP Service #271

Merged
merged 81 commits into from Jan 13, 2020
Merged

[BESU-77] - Enable TLS for JSON-RPC HTTP Service #271

merged 81 commits into from Jan 13, 2020

Conversation

usmansaleem
Copy link
Member

@usmansaleem usmansaleem commented Dec 20, 2019

PR Description

Expose following new command line parameters to enable TLS on Ethereum JSON-RPC HTTP interface to allow clients like Ethsigner to connect via TLS

--rpc-http-tls-enabled=true
(Optional - Only required if --rpc-http-enabled is set to true) Set to ‘true’ to enable TLS. false by default.

--rpc-http-tls-keystore-file="/path/to/cert.pfx"
(Must be specified if TLS is enabled) Path to PKCS12 format key store which contains server's certificate and it's private key

--rpc-http-tls-keystore-password-file="/path/to/cert.passwd"
(Must be specified if TLS is enabled) Path to the text file containing password for unlocking key store.

--rpc-http-tls-known-clients-file="/path/to/rpc_tls_clients.txt"
(Optional) Path to a plain text file containing space separated client’s certificate’s common name and its sha-256 fingerprints when they are not signed by a known CA. The presence of this file (even empty) will enable TLS client authentication i.e. the client will present its certificate to server on TLS handshake and server will establish that the client’s certificate is either signed by a proper/known CA otherwise server trusts client's certificate by reading it's sha-256 fingerprint from known clients file specified above. The format of the file is (as an example):

localhost DF:65:B8:02:08:5E:91:82:0F:91:F5:1C:96:56:92:C4:1A:F6:C6:27:FD:6C:FC:31:F2:BB:90:17:22:59:5B:50

Signed-off-by: Usman Saleem usman@usmans.info

Signed-off-by: Usman Saleem <usman@usmans.info>
Copy link
Contributor

@rain-on rain-on left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty clean, should be easy to reuse lots of it 👍

 -- Use known clients common name and fingerprint to set up client authentication
 -- Updated cli option as password for trust store is not requried anymore

Signed-off-by: Usman Saleem <usman@usmans.info>
…pdate

Signed-off-by: Usman Saleem <usman@usmans.info>
Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

 -- Simpligying optional condition to avoid warnings

Signed-off-by: Usman Saleem <usman@usmans.info>
 -- cli conditions

Signed-off-by: Usman Saleem <usman@usmans.info>
 -- Adding tls validation test

Signed-off-by: Usman Saleem <usman@usmans.info>
…pdate

Signed-off-by: Usman Saleem <usman@usmans.info>
 -- code formatting fixes

Signed-off-by: Usman Saleem <usman@usmans.info>
 -- Use Java new HttpClient instead of OkHttp in tls unit test

Signed-off-by: Usman Saleem <usman@usmans.info>
 -- Enabling junit and ssl debug logging

Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
 -- Enabling junit and ssl debug logging

Signed-off-by: Usman Saleem <usman@usmans.info>
 -- Adding loopback ip address in unit test known clients file

Signed-off-by: Usman Saleem <usman@usmans.info>
 -- ssl debug messages

Signed-off-by: Usman Saleem <usman@usmans.info>
 -- ssl debug in ethereum build.gradle

Signed-off-by: Usman Saleem <usman@usmans.info>
 -- spotless fixes

Signed-off-by: Usman Saleem <usman@usmans.info>
 -- further ssl debugging

Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
…pdate

Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
…pdate

Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
@usmansaleem usmansaleem marked this pull request as ready for review January 8, 2020 00:16
…pdate

Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Copy link
Contributor

@rain-on rain-on left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any tests for ensuring that invalid clients can't connect via TLS?

…pdate

Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
…pdate

Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
…pdate

Signed-off-by: Usman Saleem <usman@usmans.info>
…factoring tlsconfiguration

Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
Copy link
Contributor

@rain-on rain-on left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkout the nit, but otherwise looks good.

Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Usman Saleem <usman@usmans.info>
…pdate

Signed-off-by: Usman Saleem <usman@usmans.info>
@usmansaleem usmansaleem merged commit cb56b3c into hyperledger:master Jan 13, 2020
@usmansaleem usmansaleem deleted the feature/rpc_tls_update branch January 13, 2020 11:11
edwardmack pushed a commit to ChainSafe/besu that referenced this pull request Feb 4, 2020
Expose following new command line parameters to enable TLS on Ethereum JSON-RPC HTTP interface to allow clients like Ethsigner to connect via TLS

--rpc-http-tls-enabled=true
(Optional - Only required if --rpc-http-enabled is set to true) Set to ‘true’ to enable TLS. false by default.

--rpc-http-tls-keystore-file="/path/to/cert.pfx"
(Must be specified if TLS is enabled) Path to PKCS12 format key store which contains server's certificate and it's private key

--rpc-http-tls-keystore-password-file="/path/to/cert.passwd"
(Must be specified if TLS is enabled) Path to the text file containing password for unlocking key store.

--rpc-http-tls-known-clients-file="/path/to/rpc_tls_clients.txt"
(Optional) Path to a plain text file containing space separated client’s certificate’s common name and its sha-256 fingerprints when they are not signed by a known CA. The presence of this file (even empty) will enable TLS client authentication i.e. the client will present its certificate to server on TLS handshake and server will establish that the client’s certificate is either signed by a proper/known CA otherwise server trusts client's certificate by reading it's sha-256 fingerprint from known clients file specified above. The format of the file is (as an example):

localhost DF:65:B8:02:08:5E:91:82:0F:91:F5:1C:96:56:92:C4:1A:F6:C6:27:FD:6C:FC:31:F2:BB:90:17:22:59:5B:50

Signed-off-by: Usman Saleem <usman@usmans.info>
edwardmack pushed a commit to ChainSafe/besu that referenced this pull request Feb 4, 2020
Expose following new command line parameters to enable TLS on Ethereum JSON-RPC HTTP interface to allow clients like Ethsigner to connect via TLS

--rpc-http-tls-enabled=true
(Optional - Only required if --rpc-http-enabled is set to true) Set to ‘true’ to enable TLS. false by default.

--rpc-http-tls-keystore-file="/path/to/cert.pfx"
(Must be specified if TLS is enabled) Path to PKCS12 format key store which contains server's certificate and it's private key

--rpc-http-tls-keystore-password-file="/path/to/cert.passwd"
(Must be specified if TLS is enabled) Path to the text file containing password for unlocking key store.

--rpc-http-tls-known-clients-file="/path/to/rpc_tls_clients.txt"
(Optional) Path to a plain text file containing space separated client’s certificate’s common name and its sha-256 fingerprints when they are not signed by a known CA. The presence of this file (even empty) will enable TLS client authentication i.e. the client will present its certificate to server on TLS handshake and server will establish that the client’s certificate is either signed by a proper/known CA otherwise server trusts client's certificate by reading it's sha-256 fingerprint from known clients file specified above. The format of the file is (as an example):

localhost DF:65:B8:02:08:5E:91:82:0F:91:F5:1C:96:56:92:C4:1A:F6:C6:27:FD:6C:FC:31:F2:BB:90:17:22:59:5B:50

Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: edwardmack <ed@edwardmack.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants