Explorar o código

Don't allow a configuration requiring auth with a non-TLS listener

This fixes #26
Jonathon Reinhart %!s(int64=4) %!d(string=hai) anos
pai
achega
247d187576
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      config.go

+ 8 - 0
config.go

@@ -157,6 +157,14 @@ func splitProto(s string) protoAddr {
 func setupListeners() {
 	for _, listenAddr := range strings.Split(*listenStr, " ") {
 		pa := splitProto(listenAddr)
+
+		if localAuthRequired() && pa.protocol == "" {
+			log.WithField("address", pa.address).
+				Fatal("Local authentication (via allowed_users file) " +
+				      "not allowed with non-TLS listener")
+		}
+
+
 		listenAddrs = append(listenAddrs, pa)
 	}
 }