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

go: Remove TLS certificate rotation #5318

Merged
merged 2 commits into from
Aug 17, 2023
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
4 changes: 4 additions & 0 deletions .changelog/5318.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
go: Remove TLS certificate rotation

We use libp2p for all communication now, so TLS certificate rotation is
no longer needed.
3 changes: 0 additions & 3 deletions docs/oasis-node/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ node):
"consensus": "QaMdKVwX1da0Uf82cp0DDukQQwrSjr8BwlIxc//ANE8=",
"tls": [
"Kj8ANHwfMzcWoA1vx0OMhn4oGv8Y0vc46xMOdQUIh5c=",
"1C8rWqyuARkSxNXuPbDPh9XID/SiYAU3GxGk6nMwR0Q="
]
},
"consensus": {
Expand Down Expand Up @@ -173,10 +172,8 @@ node):
"expiration": 10491,
"tls": {
"pub_key": "Kj8ANHwfMzcWoA1vx0OMhn4oGv8Y0vc46xMOdQUIh5c=",
"next_pub_key": "1C8rWqyuARkSxNXuPbDPh9XID/SiYAU3GxGk6nMwR0Q=",
"addresses": [
"[email protected]:30001",
"1C8rWqyuARkSxNXuPbDPh9XID/[email protected]:30001"
]
},
"p2p": {
Expand Down
6 changes: 3 additions & 3 deletions go/common/accessctl/accessctl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ func TestSubjectFromCertificate(t *testing.T) {
require.NoError(err, "Failed to create a temporary directory")
defer os.RemoveAll(dataDir)

ident, err := identity.LoadOrGenerate(dataDir, memorySigner.NewFactory(), false)
ident, err := identity.LoadOrGenerate(dataDir, memorySigner.NewFactory())
require.NoError(err, "Failed to generate a new identity")
require.Len(ident.GetTLSCertificate().Certificate, 1, "The generated identity contains more than 1 certificate in the chain")
require.Len(ident.TLSCertificate.Certificate, 1, "The generated identity contains more than 1 certificate in the chain")

x509Cert, err := x509.ParseCertificate(ident.GetTLSCertificate().Certificate[0])
x509Cert, err := x509.ParseCertificate(ident.TLSCertificate.Certificate[0])
require.NoError(err, "Failed to parse X.509 certificate from TLS certificate")

sub := SubjectFromX509Certificate(x509Cert)
Expand Down
4 changes: 2 additions & 2 deletions go/common/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ func NewServer(config *ServerConfig) (*Server, error) {
grpc.KeepaliveParams(serverKeepAliveParams),
grpc.ForceServerCodec(&CBORCodec{}),
}
if config.Identity != nil && config.Identity.GetTLSCertificate() != nil {
if config.Identity != nil && config.Identity.TLSCertificate != nil {
tlsConfig := &tls.Config{
ClientAuth: clientAuthType,
VerifyPeerCertificate: func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
Expand All @@ -651,7 +651,7 @@ func NewServer(config *ServerConfig) (*Server, error) {
})
},
GetCertificate: func(ch *tls.ClientHelloInfo) (*tls.Certificate, error) {
return config.Identity.GetTLSCertificate(), nil
return config.Identity.TLSCertificate, nil
},
}

Expand Down
8 changes: 4 additions & 4 deletions go/common/grpc/testing/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ func CreateCertificate(t *testing.T) (*tls.Certificate, *x509.Certificate) {
require.NoError(err, "Failed to create a temporary directory")
defer os.RemoveAll(dataDir)

ident, err := identity.LoadOrGenerate(dataDir, memorySigner.NewFactory(), false)
ident, err := identity.LoadOrGenerate(dataDir, memorySigner.NewFactory())
require.NoError(err, "Failed to generate a new identity")
require.Len(ident.GetTLSCertificate().Certificate, 1, "The generated identity contains more than 1 TLS certificate in the chain")
require.Len(ident.TLSCertificate.Certificate, 1, "The generated identity contains more than 1 TLS certificate in the chain")

x509Cert, err := x509.ParseCertificate(ident.GetTLSCertificate().Certificate[0])
x509Cert, err := x509.ParseCertificate(ident.TLSCertificate.Certificate[0])
require.NoError(err, "Failed to parse X.509 certificate from TLS certificate")

return ident.GetTLSCertificate(), x509Cert
return ident.TLSCertificate, x509Cert
}

// PingQuery is the PingServer query.
Expand Down
Loading
Loading