Parallel backend failure kills gunicorn
Hi,
I've setup that 0.7.0-dev server yesterday, and I'm now fooling around with the parallel backend instead of multi.
When [EDIT]bui-manage bui-monitor [/EDIT] service isn't enabled, bui-gunicorn fails as follows:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.6/site-packages/gunicorn/util.py", line 362, in import_app
app = eval(obj, vars(mod))
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/burpui/app.py", line 118, in create_app
app.setup(app.config['CFG'], unittest, cli)
File "/usr/local/lib/python3.6/site-packages/burpui/engines/server.py", line 398, in setup
self.load_modules()
File "/usr/local/lib/python3.6/site-packages/burpui/engines/server.py", line 488, in load_modules
raise exc
File "/usr/local/lib/python3.6/site-packages/burpui/engines/server.py", line 477, in load_modules
self.client = mod.Burp(self, conf=self.conf)
File "/usr/local/lib/python3.6/site-packages/burpui/misc/backend/parallel.py", line 242, in __init__
raise exc
File "/usr/local/lib/python3.6/site-packages/burpui/misc/backend/parallel.py", line 233, in __init__
trio.run(connector.conn)
File "/usr/local/lib/python3.6/site-packages/trio/_core/_run.py", line 1444, in run
raise runner.main_task_outcome.error
File "/usr/local/lib/python3.6/site-packages/burpui/misc/backend/parallel.py", line 76, in conn
raise BUIserverException(str(exc))
burpui.exceptions.BUIserverException: all attempts to connect to 127.0.0.1:11111 failed
Maybe gunicorn shoudn't be killed when bui-monitor does not work.
Also, bui-manage diag
will fail with Unable to initialize the application 'diag': Failed loading backend burpui.misc.backend.parallel:
if bui-monitor isn't working (in my case, I had to specifiy an alternative burpbin path).
I think the diag should work regardless of bui-monitor working.
Also, I think I found a small problem: When timeout is commented out in bui-monitor.cfg, there's no default value of 15:
[2019-08-19 12:24:28,722] INFO in config.safe_get: the value "None" is of the wrong type.
[Burp]:timeout - found: None, default: 0 -> 0
Anyway, didn't get parallel workingb today, I have alot of those timeout I'm still trying to find the reason of.
[root@burp burp]# /usr/local/bin/bui-monitor -c /etc/burp/bui-monitor.cfg -vvv
[2019-08-19 12:33:48,968] INFO in monitor.__init__: conf: /etc/burp/bui-monitor.cfg
[2019-08-19 12:33:48,968] INFO in monitor.__init__: level: INFO
[2019-08-19 12:33:48,969] INFO in config.safe_get: the value "None" is of the wrong type.
[Burp]:timeout - found: None, default: 0 -> 0
[2019-08-19 12:33:48,970] INFO in monitor._run: Ready to serve requests on 127.0.0.1:11111
[2019-08-19 12:33:48,970] INFO in monitor.fill_pool: Starting clients...
[2019-08-19 12:33:48,971] INFO in monitor.launch_monitor: Starting client n°1
[2019-08-19 12:33:48,975] INFO in monitor.launch_monitor: Starting client n°2
[2019-08-19 12:33:48,979] INFO in burp2.status: 2 - query: 'c:' (cache: True, raw: False)
[2019-08-19 12:33:48,979] INFO in burp2.status: 1 - query: 'c:' (cache: True, raw: False)
[2019-08-19 12:33:48,986] WARNING in burp2._read_proc_stdout: Read operation timed out
[2019-08-19 12:33:48,986] WARNING in burp2._read_proc_stdout: Read operation timed out
[2019-08-19 12:33:48,987] WARNING in burp2._read_proc_stdout: Read operation timed out
[2019-08-19 12:33:48,987] WARNING in burp2._read_proc_stdout: Read operation timed out
Manually running the burp client specified in bui-monitor.cfg works (eg burp -c /etc/burp/bui1.conf -a m
)
bui-monitor.cfg file
# Burp-UI monitor configuration file
[Global]
# On which port is the application listening
port = 11111
# On which address is the application listening
# '::1' is the default for local IPv6
# set it to '127.0.0.1' if you want to listen on local IPv4 address
bind = 127.0.0.1
# Pool size: number of 'burp -a m' process to load
pool = 2
# enable SSL
ssl = true
# ssl cert
sslcert = /etc/burp/ssl_cert-server.pem
# ssl key
sslkey = /etc/burp/ssl_cert-server.key
# monitor password
password = myshinypassword
## burp backend specific options
[Burp]
## burp binary
burpbin = /usr/local/sbin/burp
## burp client configuration file used for the restoration
bconfcli = /etc/burp/bui1.conf
## how many time to wait for the monitor to answer (in seconds)
#timeout = 15