Skip to content

Commit

Permalink
cluster/tls: add 127.0.0.1,localhost to cert list (#1446)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsvisa authored Jun 24, 2021
1 parent 48cd6ae commit b057af7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/cluster/task/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ func (c *TLSCert) Execute(ctx context.Context) error {
return err
}

hosts := []string{c.host}
ips := []string{}
if net.ParseIP(c.host) != nil {
hosts, ips = ips, hosts
// Add localhost and 127.0.0.1 to the trust list,
// then it is easy for some scripts to request a local interface directly
hosts := []string{"localhost"}
ips := []string{"127.0.0.1"}
if host := c.host; net.ParseIP(host) != nil && host != "127.0.0.1" {
ips = append(ips, host)
} else if host != "localhost" {
hosts = append(hosts, host)
}
csr, err := privKey.CSR(c.role, c.comp, hosts, ips)
if err != nil {
Expand Down

0 comments on commit b057af7

Please sign in to comment.