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
commit bb1f6cd0e8
3 changed files with 55 additions and 30 deletions

View file

@ -30,6 +30,10 @@ func NewHttpProxy(s *session.Session) *HttpProxy {
"8080",
"Port to bind the HTTP proxy to."))
mod.AddParam(session.NewBoolParameter("http.proxy.redirect",
"true",
"Enable or disable port redirection with iptables."))
mod.AddParam(session.NewStringParameter("http.proxy.script",
"",
"",
@ -82,6 +86,7 @@ func (mod *HttpProxy) Configure() error {
var address string
var proxyPort int
var httpPort int
var doRedirect bool
var scriptPath string
var stripSSL bool
var jsToInject string
@ -96,6 +101,8 @@ func (mod *HttpProxy) Configure() error {
return err
} else if err, httpPort = mod.IntParam("http.port"); err != nil {
return err
} else if err, doRedirect = mod.BoolParam("http.proxy.redirect"); err != nil {
return err
} else if err, scriptPath = mod.StringParam("http.proxy.script"); err != nil {
return err
} else if err, stripSSL = mod.BoolParam("http.proxy.sslstrip"); err != nil {
@ -111,7 +118,7 @@ func (mod *HttpProxy) Configure() error {
mod.proxy.Blacklist = str.Comma(blacklist)
mod.proxy.Whitelist = str.Comma(whitelist)
return mod.proxy.Configure(address, proxyPort, httpPort, scriptPath, jsToInject, stripSSL)
return mod.proxy.Configure(address, proxyPort, httpPort, doRedirect, scriptPath, jsToInject, stripSSL)
}
func (mod *HttpProxy) Start() error {