Don't store wildcards in the known hosts file

This commit is contained in:
adnano
2020-09-27 15:03:46 -04:00
parent 0343248952
commit e01d59f8f6
4 changed files with 14 additions and 10 deletions
+1 -2
View File
@@ -77,9 +77,8 @@ func (k *KnownHosts) Add(cert *x509.Certificate) {
// Lookup returns ErrCertificateNotTrusted.
// If the hostname is not in the list, Lookup returns ErrCertificateUnknown.
// If the certificate is found and the fingerprint matches, error will be nil.
func (k *KnownHosts) Lookup(cert *x509.Certificate) error {
func (k *KnownHosts) Lookup(hostname string, cert *x509.Certificate) error {
now := time.Now().Unix()
hostname := cert.Subject.CommonName
fingerprint := Fingerprint(cert)
for i := range k.hosts {
if k.hosts[i].Hostname != hostname {