我正在尝试将Shadowd(Shadow Daemon)WAF(Web应用程序防火墙)与此Documentation
中的Flask连接器连接起来即使是正常的“Hello world”程序也会抛出内部服务器错误。我正在使用Flask连接器。
我的代码
from flask import *
from shadowd.flask_connector import InputFlask, OutputFlask, Connector
app = Flask(__name__)
@app.before_request
def before_req():
input = InputFlask(request)
output = OutputFlask()
Connector().start(input, output)
@app.route('/', methods=['GET','POST'])
def index():
return "<h1>Working</h1>"
if __name__ == '__main__':
app.run()
以上代码抛出内部服务器错误
追溯
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2018-03-15 12:33:36,668] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1610, in full_dispatch_request
rv = self.preprocess_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1831, in preprocess_request
rv = func()
File "index.py", line 11, in before_req
Connector().start(input, output)
File "/usr/local/lib/python2.7/dist-packages/shadowd/connector.py", line 285, in start
if config.get('debug'):
File "/usr/local/lib/python2.7/dist-packages/shadowd/connector.py", line 55, in get
return self.config.get(self.section, key)
File "/usr/lib/python2.7/ConfigParser.py", line 607, in get
raise NoSectionError(section)
NoSectionError: No section: 'shadowd_python'
127.0.0.1 - - [15/Mar/2018 12:33:36] "GET / HTTP/1.1" 500 -
但是,如果我删除Flask Connector部件,应用程序运行良好。我在 shadowd 中找不到太多文档。有没有人对上述问题有想法?请帮助我。