3

I'm trying to connect Shadowd (Shadow Daemon) WAF (Web Application Firewall) with Flask connector from this Documentation

Even the normal "Hello world" program is throwing Internal server error. while I'm using the Flask Connector.

MY CODE

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()

The above code throws Internal Server Error

Traceback

 * 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 -

However the If I remove the Flask Connector part the application works good. I don't find much documentation in shadowd. Does anyone have Idea on the above issue? Kindly help me out.

neuro
  • 14,948
  • 3
  • 36
  • 59
Sundararajan
  • 544
  • 2
  • 9
  • 25
  • If you've edited [the configuration file](https://shadowd.zecure.org/overview/python_connector/#configuration:8d49570e04a07744c9f07ae0c9514cdb), it'll be helpful to include that file in your question. – shad0w_wa1k3r Mar 19 '18 at 06:15
  • Actually I don't find any configuration file in the mentioned path. `/etc/shadowd/connectors.ini`. Do I need to create one? – Sundararajan Mar 19 '18 at 06:28
  • The documentation suggests you should? That might be the problem you have, since the error also suggests the same (`ConfigParser` is failing) – shad0w_wa1k3r Mar 19 '18 at 06:29

0 Answers0