diff --git a/README.md b/README.md index 37f5b96..d3ef6ca 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ XMPP * __xmpp_jid__ : Account JID * __xmpp_secret__ : Account password * xmpp_debug : Enable debug log at true (default: false) + * xmpp_verify_cert_validity : Enable certificate verification (default: true) HTTP * http_port : HTTP port to bind (default: 9090, desactive: -1) diff --git a/httpAuth.cfg b/httpAuth.cfg index c5d81b4..27d0c03 100644 --- a/httpAuth.cfg +++ b/httpAuth.cfg @@ -4,6 +4,7 @@ xmpp_server_port=5347 xmpp_jid=xmppsteam.kingpenguin.tk xmpp_secret=xmpp4steam_password xmpp_debug=true +xmpp_verify_cert_validity=true # HTTP informations http_port=9090 diff --git a/main.go b/main.go index 8938697..b443a4e 100644 --- a/main.go +++ b/main.go @@ -63,6 +63,7 @@ func init() { xmpp.JidStr = mapConfig["xmpp_jid"] xmpp.Secret = mapConfig["xmpp_secret"] xmpp.Debug = mapConfig["xmpp_debug"] == "true" + xmpp.VerifyCertValidity = mapConfig["xmpp_verify_cert_validity"] != "false" // Default TRUE } func main() { diff --git a/xmpp/xmpp.go b/xmpp/xmpp.go index c9bda83..344efaf 100644 --- a/xmpp/xmpp.go +++ b/xmpp/xmpp.go @@ -35,7 +35,8 @@ var ( WaitMessageAnswers = make(map[string]*Confirmation) WaitIqMessages = make(map[string]*Confirmation) - Debug = true + Debug = true + VerifyCertValidity = true ) func Run() { @@ -75,7 +76,7 @@ func Run() { if isComponent { comp = must(xmpp.NewComponentXMPP(stream, jid, Secret)).(*xmpp.XMPP) } else { - comp = must(xmpp.NewClientXMPP(stream, jid, Secret, &xmpp.ClientConfig{InsecureSkipVerify: false})).(*xmpp.XMPP) + comp = must(xmpp.NewClientXMPP(stream, jid, Secret, &xmpp.ClientConfig{InsecureSkipVerify: !VerifyCertValidity})).(*xmpp.XMPP) comp.Out <- xmpp.Presence{} }