Package: intelmq-fody-backend
DocumentationA backend to serveintelmq-cb-mailgendata or just events from an IntelMQ PostgreSQL database
for the webappFody.Each contained module has an additionalREADME.mdto follow.Requirementshugpsycopg2 >=2.4.5intelmq-mailgenpython-dateutiltypingpostgresql v>=9.5LicenseThis software is Free Software available under the terms of
the AGPL v3 or later versions of this license.
See the fileagpl-3.0.txtorhttps://www.gnu.org/licenses/agpl-3.0.en.htmlfor details.Operating manualSeeevents_api/README.mdfor usage hints for statistics.Because ofhttps://github.com/Intevation/intelmq-fody-backend/issues/12make sure to restart the serving process(es) each time you have
restarted postgresql.Run with hughug -f intelmq_fody_backend/serve.py -p 8002Run with Apache and WSGI#as root
apt-get install libapache2-mod-wsgi-py3You might want to use an Apache-Config similar to the example included asconfig/apache-example/001-fody.confAuthenticationAuthentication for the endpoints exposed by the fody-backend is configured in a json formated file. The fody-backend tires to load the configuration file/etc/intelmq/fody-session.confand${PREFIX}/etc/intelmq/fody-session.conf. To override these paths set the environmet variableFODY_SESSION_CONFIGto the path pointing to the config file.If the config file is not found in the given locations the authenticion is disabled.Example configuration{
	"session_store": "/etc/intelmq/fody-session.sqlite",
	"session_duration": 86400
}session_store: the location of the sqlite database that contains users and sessions.session_duration: the maximal duration of a session.If you enable the session_store you will have to create user accounts to be able to access the API functionality. You can do this using fody-adduser:fody-adduser --user <username> --password <password>Track db changes by userOnly the modulecontactdb_apiexposes the ability to write changes to the db.If you want to be able to find out which user did which particular change:Use basic authentication and maintain one userid and password per user.
(For apache2 this can be done with thehtpasswdtool.)Keep logs of the wsgi application at least at the INFO level.Log entries will show the requested change
together with the authenticated userid, search forremote_user =. Example for apache2:pushd/var/log/apache2/
grep'remote_user ='*
error.log:[FriMay0514:19:26.8822992017][:error][pid2075]2017-05-0514:19:26,882contactdb_api.contactdb_api.serveINFO-Gotcommit_object={'orgs':[{'comment':'Testing','first_handle':'','name':'Intevation','sector_id':None,'contacts':[],'ti_handle':'','ripe_org_hdl':'','asns':[]}],'commands':['create']};remote_user='bernhard.reiter'error.log:[FriMay0514:19:26.8822992017][:error][pid2075]2017-05-0514:19274,179contactdb_api.contactdb_api.serveINFO-Commitsuccessful,results=[('create',126)];remote_user='bernhard.reiter'Linkspython-imqfodya python3 module
to ease accessing the Fody backend.DevelopmentHow to releaseUpdate theNEWS.mdfile and (usually) allsetup.pyfiles.
Note the versioning scheme remark in the toplevelsetup.pyfile.Version numberOriginally fody-backend had been designed with sub-modules
that could potentially also be used separately.
Example how to change all version numbers:grep-r"^    version=".
grep-rl"^    version=".|xargssed-i's/0.4.4.dev0/0.5.0.dev0/'debian/packageUpdatedebian/changelog, e.g.dch--newversion0.7.0--check-dirname-level0--distributionstableTag versionexamplegittag-sv0.7.0-m"Release v0.7.0"gitpushoriginv0.7.0Prepare for following developmentIn the mentioned files above, set the version number to the following
number as pre-version number for development, e.g.0.7.1.dev0.HistoryMost of the files within this repository originated from:https://github.com/Intevation/intelmq-mailgen/tree/master/extras