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

Disable session resumption by default #569

Merged
merged 1 commit into from
Jan 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions infra/conf/transport_internet.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,12 @@ func (c *TLSCertConfig) Build() (*tls.Certificate, error) {
}

type TLSConfig struct {
Insecure bool `json:"allowInsecure"`
InsecureCiphers bool `json:"allowInsecureCiphers"`
Certs []*TLSCertConfig `json:"certificates"`
ServerName string `json:"serverName"`
ALPN *StringList `json:"alpn"`
DisableSessionResumption bool `json:"disableSessionResumption"`
DisableSystemRoot bool `json:"disableSystemRoot"`
Insecure bool `json:"allowInsecure"`
Certs []*TLSCertConfig `json:"certificates"`
ServerName string `json:"serverName"`
ALPN *StringList `json:"alpn"`
EnableSessionResumption bool `json:"enableSessionResumption"`
DisableSystemRoot bool `json:"disableSystemRoot"`
}

// Build implements Buildable.
Expand All @@ -308,14 +307,13 @@ func (c *TLSConfig) Build() (proto.Message, error) {
}
serverName := c.ServerName
config.AllowInsecure = c.Insecure
config.AllowInsecureCiphers = c.InsecureCiphers
if len(c.ServerName) > 0 {
config.ServerName = serverName
}
if c.ALPN != nil && len(*c.ALPN) > 0 {
config.NextProtocol = []string(*c.ALPN)
}
config.DisableSessionResumption = c.DisableSessionResumption
config.EnableSessionResumption = c.EnableSessionResumption
config.DisableSystemRoot = c.DisableSystemRoot
return config, nil
}
Expand Down
2 changes: 1 addition & 1 deletion transport/internet/tls/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (c *Config) GetTLSConfig(opts ...Option) *tls.Config {
RootCAs: root,
InsecureSkipVerify: c.AllowInsecure,
NextProtos: c.NextProtocol,
SessionTicketsDisabled: c.DisableSessionResumption,
SessionTicketsDisabled: !c.EnableSessionResumption,
}

for _, opt := range opts {
Expand Down
76 changes: 32 additions & 44 deletions transport/internet/tls/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions transport/internet/tls/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ message Config {
// Whether or not to allow self-signed certificates.
bool allow_insecure = 1;

// Whether or not to allow insecure cipher suites.
bool allow_insecure_ciphers = 5;

// List of certificates to be served on server.
repeated Certificate certificate = 2;

Expand All @@ -38,10 +35,10 @@ message Config {
// Lists of string as ALPN values.
repeated string next_protocol = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

看起来这个可以改成 3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

3 在上面,被折叠了


// Whether or not to disable session (ticket) resumption.
bool disable_session_resumption = 6;
// Whether or not to enable session (ticket) resumption.
bool enable_session_resumption = 5;

// If true, root certificates on the system will not be loaded for
// verification.
bool disable_system_root = 7;
bool disable_system_root = 6;
}
4 changes: 1 addition & 3 deletions transport/internet/tls/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ func TestExpiredCertificate(t *testing.T) {
}

func TestInsecureCertificates(t *testing.T) {
c := &Config{
AllowInsecureCiphers: true,
}
c := &Config{}

tlsConfig := c.GetTLSConfig()
if len(tlsConfig.CipherSuites) > 0 {
Expand Down