new: added new http.proxy.redirect and https.proxy.redirect parameters to optionally disable iptables port redirection

This commit is contained in:
Simone Margaritelli 2020-01-23 15:48:57 +01:00
parent 9bf0139181
commit bb1f6cd0e8
3 changed files with 55 additions and 30 deletions

View file

@ -33,6 +33,10 @@ func NewHttpsProxy(s *session.Session) *HttpsProxy {
"8083",
"Port to bind the HTTPS proxy to."))
mod.AddParam(session.NewBoolParameter("https.proxy.redirect",
"true",
"Enable or disable port redirection with iptables."))
mod.AddParam(session.NewBoolParameter("https.proxy.sslstrip",
"false",
"Enable or disable SSL stripping."))
@ -97,6 +101,7 @@ func (mod *HttpsProxy) Configure() error {
var address string
var proxyPort int
var httpPort int
var doRedirect bool
var scriptPath string
var certFile string
var keyFile string
@ -113,6 +118,8 @@ func (mod *HttpsProxy) Configure() error {
return err
} else if err, httpPort = mod.IntParam("https.port"); err != nil {
return err
} else if err, doRedirect = mod.BoolParam("https.proxy.redirect"); err != nil {
return err
} else if err, stripSSL = mod.BoolParam("https.proxy.sslstrip"); err != nil {
return err
} else if err, certFile = mod.StringParam("https.proxy.certificate"); err != nil {
@ -153,7 +160,8 @@ func (mod *HttpsProxy) Configure() error {
mod.Info("loading proxy certification authority TLS certificate from %s", certFile)
}
return mod.proxy.ConfigureTLS(address, proxyPort, httpPort, scriptPath, certFile, keyFile, jsToInject, stripSSL)
return mod.proxy.ConfigureTLS(address, proxyPort, httpPort, doRedirect, scriptPath, certFile, keyFile, jsToInject,
stripSSL)
}
func (mod *HttpsProxy) Start() error {