Getting this error while validating tls certificates x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs

775 views Asked by At

i am looking to implement TLS in rsyslog using golang . I also found library https://github.com/RackSec/ .

func main() {
    
    
    
    w, err := syslog.DialWithTLSCertPath("tcp+tls", "127.0.0.1:51430", syslog.LOG_ERR, "superbpatch123", "/path/to/client-key.pem")
    if err != nil {
        fmt.Println("unable to dial Rsyslog ,connection refused :> " + err.Error())
        return
    }
    
    int1, err := w.Write([]byte("these are some bytesssssss"))
    
    if err != nil {
        log.Println("Unable to write the bytes to rsyslog ", err.Error())
        return
    }
    
    fmt.Println("forwarded logs to rsyslog ", int1)
    
    }

Getting this error x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs

My Server Configuration looks like

    $AllowedSender TCP, 127.0.0.1
    
    module(load="imtcp"
            StreamDriver.Name="gtls"
            StreamDriver.Mode="1"
            StreamDriver.Authmode="anon"
    )
    input(type="imtcp" port="51430")
    
    
    
    # make gtls driver the default and set certificate files
    global(
    DefaultNetstreamDriver="gtls"
    DefaultNetstreamDriverCAFile="/path/to/ca.pem"
    DefaultNetstreamDriverCertFile="/path/to/server-cert.pem"
    DefaultNetstreamDriverKeyFile="/path/to/server-key.pem"
    )
0

There are 0 answers