mirror of
https://github.com/asmogo/nws.git
synced 2024-12-14 11:16:22 +00:00
Merge pull request #25 from davidcaseria/cert-dns-name
Add domain to certificate DNS name
This commit is contained in:
commit
ce641ae704
@ -130,6 +130,7 @@ func (e *Exit) createAndStoreCertificateData(ctx context.Context) (*tls.Certific
|
|||||||
notAfter := notBefore.Add(10 * 365 * 24 * time.Hour)
|
notAfter := notBefore.Add(10 * 365 * 24 * time.Hour)
|
||||||
serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
|
serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
|
||||||
serialNumber, _ := rand.Int(rand.Reader, serialNumberLimit)
|
serialNumber, _ := rand.Int(rand.Reader, serialNumberLimit)
|
||||||
|
domain, _ := e.getDomain()
|
||||||
|
|
||||||
template := x509.Certificate{
|
template := x509.Certificate{
|
||||||
SerialNumber: serialNumber,
|
SerialNumber: serialNumber,
|
||||||
@ -141,6 +142,7 @@ func (e *Exit) createAndStoreCertificateData(ctx context.Context) (*tls.Certific
|
|||||||
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
|
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
|
||||||
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
|
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
|
||||||
BasicConstraintsValid: true,
|
BasicConstraintsValid: true,
|
||||||
|
DNSNames: []string{domain},
|
||||||
}
|
}
|
||||||
|
|
||||||
certBytes, _ := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv)
|
certBytes, _ := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv)
|
||||||
|
Loading…
Reference in New Issue
Block a user