A backend to serve intelmq-cb-mailgen data for the webapp fody.
Project description
Documentation
A backend to serve intelmq-mailgen data or just events from an IntelMQ PostgreSQL database for the webapp Fody.
Each contained module has an additional README.md to follow.
Requirements
- Python < 3.13
- hug
- psycopg2 >=2.4.5
- intelmq-mailgen
- python-dateutil
- typing
- postgresql v>=9.5
Locale
The encoding of the locale must be UTF-8.
To do this, run dpkg-reconfigure locales and select, for example, en_US.UTF-8.
License
This software is Free Software available under the terms of
the AGPL v3 or later versions of this license.
See the file agpl-3.0.txt or https://www.gnu.org/licenses/agpl-3.0.en.html
for details.
Operating manual
See events_api/README.md for usage hints for statistics.
Because of https://github.com/Intevation/intelmq-fody-backend/issues/12 make sure to restart the serving process(es) each time you have restarted postgresql.
Run with hug interactively
For development purposes it is possible to run the backend interactively. The intelmq-fody frontend expects the backend at port 8002.
hug -f intelmq_fody_backend/serve.py -p 8002
It is also possible to only run a single backend, for example the events API:
hug -f events_api/events_api/serve.py -p 8002
Run with Apache and WSGI
#as root
apt-get install libapache2-mod-wsgi-py3
You might want to use an Apache-Config similar to the example included as config/apache-example/001-fody.conf
Authentication
Authentication for the endpoints exposed by the fody-backend is configured in a json formatted file. The fody-backend tires to load the configuration file /etc/intelmq/fody-session.conf and ${PREFIX}/etc/intelmq/fody-session.conf. To override these paths set the environment variable FODY_SESSION_CONFIG to the path pointing to the config file.
If the config file is not found in the given locations the authentication 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>
Same authentication as IntelMQ Manager
You can use the same authentication for IntelMQ Fody as for the IntelMQ Manager.
- From
/etc/intelmq/api-config.jsoncopy the value of the fieldsession_store(on Debian/Ubuntu it is likely/var/lib/dbconfig-common/sqlite3/intelmq-api/intelmqapi). Short command:jq -r .session_store /etc/intelmq/api-config.json - In
/etc/intelmq/fody-session.confset this value for the fieldsession_store. - Run
sudo systemctl restart apache2to make the change effective, restarting IntelMQ Fody's Backend.
Track db changes by user
Only the module contactdb_api exposes the ability to write changes to the db.
If you want to be able to find out which user (see section above) did which particular change:
- Set the logging level to at least INFO.
- Keep the error logs of the wsgi application. In the default Apache configuration for fody, the file is
/var/log/apache2/fody-backend-error.log
Log entries will show the requested change
together with the username, search for
user =. Example for Apache2:
pushd /var/log/apache2/
zgrep 'user =' fody-backend-error.log*
fody-backend-error.log:[Fri May 05 14:19:26.882299 2017] [:error] [pid 2075] 2017-05-05 14:19:26,882 contactdb_api.contactdb_api.serve INFO - Got commit_object = {'orgs': [{'comment': 'Testing', 'first_handle': '', 'name': 'Intevation', 'sector_id': None, 'contacts': [], 'ti_handle': '', 'ripe_org_hdl': '', 'asns': []}], 'commands': ['create']}; user = 'bernhard.reiter'
fody-backend-error.log:[Fri May 05 14:19:26.882299 2017] [:error] [pid 2075] 2017-05-05 14:19274,179 contactdb_api.contactdb_api.serve INFO - Commit successful, results = [('create', 126)]; user = 'bernhard.reiter'
Links
- python-imqfody a python3 module to ease accessing the Fody backend.
History
Most of the files within this repository originated from: https://github.com/Intevation/intelmq-mailgen/tree/master/extras
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file intelmq_fody_backend-0.11.1.tar.gz.
File metadata
- Download URL: intelmq_fody_backend-0.11.1.tar.gz
- Upload date:
- Size: 54.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f916fe3265cc607ad6b3e08745ec7023a917cf0ce498def0287ca34f901ffb5a
|
|
| MD5 |
8fc37d97e767ea95f7f707a271193581
|
|
| BLAKE2b-256 |
a40837a093b5a744f845380928918298d533954669cfe01a8a297e05f62b469b
|
File details
Details for the file intelmq_fody_backend-0.11.1-py2.py3-none-any.whl.
File metadata
- Download URL: intelmq_fody_backend-0.11.1-py2.py3-none-any.whl
- Upload date:
- Size: 59.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74dac8a33a7e5b81faf22e579e9376422449c166e0445fc120d2dc9a9f7d678c
|
|
| MD5 |
e4f19b14573ae300f1427bc7a48387c8
|
|
| BLAKE2b-256 |
67e0fdc1c3d2d9cbb36cfc9da4ee2579518a69dafe6c82d84b4854129716b8df
|