Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Commit

Permalink
Use standard hostname for certs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ichbinjoe committed Dec 12, 2018
1 parent a1e7e95 commit a2b5884
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import (
"github.com/gogo/protobuf/proto"
ic "github.com/libp2p/go-libp2p-crypto"
pb "github.com/libp2p/go-libp2p-crypto/pb"
peer "github.com/libp2p/go-libp2p-peer"
"github.com/libp2p/go-libp2p-peer"
)

const PEER_HOSTNAME = "tls.libp2p"

// Identity is used to secure connections
type Identity struct {
*tls.Config
Expand Down Expand Up @@ -55,6 +57,9 @@ func (i *Identity) ConfigForPeer(remote peer.ID) *tls.Config {
}
return nil
}

conf.ServerName = PEER_HOSTNAME

return conf
}

Expand Down Expand Up @@ -102,6 +107,7 @@ func keyToCertificate(sk ic.PrivKey) (interface{}, *x509.Certificate, error) {
return nil, nil, err
}
tmpl := &x509.Certificate{
DNSNames: []string{PEER_HOSTNAME},
SerialNumber: sn,
NotBefore: time.Now().Add(-24 * time.Hour),
NotAfter: time.Now().Add(certValidityPeriod),
Expand Down

0 comments on commit a2b5884

Please sign in to comment.