-
Notifications
You must be signed in to change notification settings - Fork 395
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
[#41] feat(server): Add https support for Jetty server #860
Conversation
Code Coverage Report
Files
|
docs/security.md
Outdated
### Gravitino server's configuration | ||
| Configuration item | Description | Default value | Since version | | ||
|-----------------------------------------------|-----------------------------------------------|---------------|---------------| | ||
| `gravitino.server.webserver.httpsEnable` | Enables https | `false` | 0.3.0 | |
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.
Shouldn't we use https
as 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.
HTTPS will make deployment more complex. So we don't choose to enable the feature by default. Many other systems made a similar choice.
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.
I would suggest changing to "gravitino.server.webserver.enableHttps"
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.
Fixed.
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.
Usually, once HTTPS is set up, most services will configure redirection to redirect all HTTP traffic to HTTPS to ensure the security of communication. Should we support this ability?
server-common/src/main/java/com/datastrato/gravitino/server/web/JettyServer.java
Outdated
Show resolved
Hide resolved
serverConfig.getHost(), | ||
serverConfig.getHttpPort(), | ||
serverConfig.getHttpsPort()); | ||
} else { |
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.
user can not start services on both https and http at the same time?
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.
Livy chooses http or https. I follow the suggestion. Thanks.
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.
OK, but should we tell the user in the document that if gravitino.server.webserver.httpsPort=true
then all configurations about HTTP(such as HTTP port) will be invalidated?
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.
I also have a concern about the convenience and compatibility of migration:
If the user wants to enable HTTPS after running the service on HTTP for a period of time, for your current implementation, they must complete all HTTP client refactoring before switching. It's a big matter for online service
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.
What's your suggestion?
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.
I suggest supporting both HTTP and HTTPS.
serverConfig.getHost(), | ||
serverConfig.getHttpPort(), | ||
serverConfig.getHttpsPort()); | ||
} else { |
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.
ditto
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.
Fixed.
Could you give me some examples? |
I'm referring to the web service, such as http://github.com, http://google.com, http://apple.com |
connector.setReuseAddress(true); | ||
return connector; | ||
} | ||
|
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.
How to handle exceptions on https initialize. Would it be easy for the user to understand if the original exception is thrown?
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.
What exception should we handle?
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.
Missing integration tests.
Integration tests may be difficult. Some steps need human interaction. |
I find I can add the option -no-prompt to skip human interaction. I will have a try to add a integration test. |
Because HTTPS will protect the header of request from smuggling and HTTPS will be safer. | ||
Both Gravitino server and Iceberg rest service can configure HTTPS. | ||
|
||
### Gravitino server's configuration |
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.
Gravitino server and Iceberg REST server have it's configuration doc, I wonder whether it's proper to put security configuration 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.
It's ok for us not to add these configuration options in those documents. Spark also follows this document style.
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.
I think you should add more doc example about how to configure https.
Add a warning log if we enable OAuth and HTTP. |
Fixed. |
For documents, we just add some simple configuration options. I will polish the document in the next pr. |
I have addressed the comments. @jerryshao Could you review this pr if you have time? |
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.
Have you tested with Gravitino Client and curl. As I remembered there will be some settings in the client side if client side auth is enable.
Also some other configurations like keystore type, trustStore, trustStorePassword, trustStoreType, algorithm probably are also required, can you please check the Spark's code SSLOptions
.
docs/security.md
Outdated
### Gravitino server's configuration | ||
| Configuration item | Description | Default value | Since version | | ||
|-----------------------------------------------|-----------------------------------------------|---------------|---------------| | ||
| `gravitino.server.webserver.httpsEnable` | Enables https | `false` | 0.3.0 | |
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.
I would suggest changing to "gravitino.server.webserver.enableHttps"
docs/security.md
Outdated
### Iceberg REST service's configuration | ||
| Configuration item | Description | Default value | Since version | | ||
|------------------------------------------------------|-----------------------------------------------|---------------|---------------| | ||
| `gravitino.auxService.iceberg-rest.httpsEnable` | Enables https | `false` | 0.3.0 | |
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.
Also 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.
I will fix.
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.
Fixed.
|
||
private AuthenticatorUtil() {} | ||
|
||
public static boolean isEnableOAuth2() { |
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.
Basically not just oauth2, all the token based auth should be with https, otherwise it has a risk of token leakage.
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.
OK, I got it.
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.
Fixed.
I have tested by GravitinoClient. |
My point is the second sentence. |
server-common/src/main/java/com/datastrato/gravitino/server/web/JettyServerConfig.java
Show resolved
Hide resolved
| `gravitino.server.webserver.keyStorePassword` | Password to the key store | `` | 0.3.0 | | ||
| `gravitino.server.webserver.keyStoreType` | The type to the key store | `JKS` | 0.3.0 | | ||
| `gravitino.server.webserver.managerPassword` | Manager password to the key store | `` | 0.3.0 | | ||
| `gravitino.server.webserver.tlsProtocol` | TLS protocol to use. The protocol must be supported by JVM | none | 0.3.0 | |
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.
How do you configure this? and algorithm, it would be better to add more docs about it.
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.
OK, I will add more description referring the doc of Spark.
server-common/src/main/java/com/datastrato/gravitino/server/web/JettyServer.java
Show resolved
Hide resolved
I remembered that you have a sever side check for auth and HTTP, why do you remove that check? |
Because we choose simpleAuth by default, the server always use the authentication mechanism, simple or OAuth. The server always faces the risk of token data leak. |
docs/security.md
Outdated
|
||
About `tlsProtocol`, the reference list of protocols can be found in the "Additional JSSE Standard Names" section of the Java security guide. The list for Java 8 can be found at <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#jssenames">this</a>. | ||
About `enableCipherAlgorithms`, the reference list of protocols can be found in the "JSSE Cipher Suite Names" section of the Java security guide. The list for Java 8 can be found at | ||
<a href="https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#ciphersuites">this</a> |
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.
Why do you use html links rather than markdown style?
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.
Spark chooses this style. I will change it to markdown style. Fixed.
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.
Also are you going to add more security doc here in this PR, or you will split into a doc PR?
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.
I will split into a doc PR.
.doc("Password to the key store") | ||
.version("0.3.0") | ||
.stringConf() | ||
.createWithDefault(""); |
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.
I think all these must-setting configurations should have no default empty string as value, right? Using default value here is a bit misleading.
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.
Yes, but they are must-setting configurations, it's weird if we use createWithOptional. It will report a error if we choose to use createWithDefault(null)
. So I choose to use empty value 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.
I see, maybe we need to add a method in ConfigEntry
called create
to support configurations with no default value. @qqqttt123 can you please create an issue to track this?
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.
Created #950
What changes were proposed in this pull request?
I add a https connector referring to the implement of Apache Livy(incubating).
Why are the changes needed?
Fix: #41
Does this PR introduce any user-facing change?
Yes, I add the documents.
How was this patch tested?
Manual test.
I run the command