The NC XML Receiver is a Flask web application that processes N-able N-Central SOAP notifications, normalizes the data, and sends it to Discord and Microsoft Teams webhooks.
- Receives N-Central SOAP XML notifications via a HTTP POST request
- Normalizes XML notification data based on N-Central notification schema
- Sends normalized data to Discord or Microsoft Teams webhooks
- Docker installed
- Docker Compose installed
-
Clone the repository:
git clone https://git.syschimp.com/osintnugget/nc-xml-receiver.git
-
Navigate to the project directory:
cd nc-xml-receiver
-
Install pip requirements:
pip install -r requirements.txt
-
Run the flask app to test and modify:
flask run -h localhost -p 5000
-
To run via a production WSGI, I use guincorn but you can serve the app with your preferred tool:
gunicorn -w 8 -b 0.0.0.0:5000 app:app
-
Modify your Dockerfile environment variables (Not needed if you plan on using a docker-compose.yml)
# set base image FROM alpine:3.18.5 # extra data LABEL version="1.0.0" LABEL description="First image with Dockerfile" # setting working dir WORKDIR /app # update sources list and install packages RUN apk update && \ apk add --no-cache git bash nano tmux wget curl python3 py3-pip musl-locales musl-locales-lang && \ rm -rf /var/cache/apk/* # set environment variables ENV LANG=en_US.UTF-8 ENV LANGUAGE=en_US.UTF-8 ENV LC_ALL=en_US.UTF-8 # copying over requirements file COPY requirements.txt requirements.txt # installing pip requirements RUN pip3 install -r requirements.txt # OPTIONAL: set environment variables ENV DISCORD_WEBHOOK_URL=<your_discord_webhook_url> ENV TEAMS_WEBHOOK_URL=<your_teams_webhook_url> # exposing port 5000 EXPOSE 5000 # copy over project directories COPY . . # setting entry point RUN chmod u+x ./entrypoint.sh ENTRYPOINT ["./entrypoint.sh"]
-
Build docker image:
docker build -t <image_repo_url>:<image_tag> .
-
Modify the entrypoint.sh file with your preferred serving tool:
gunicorn -w 8 -b 0.0.0.0:5000 app:app
-
Modify your docker-compose.yml:
version: "3.9" services: <container_name>: container_name: <image_name> image: <image_repo_url:image_tag> ports: - 5000:5000 environment: - DISCORD_WEBHOOK_URL=<your_discord_webhook_url> - TEAMS_WEBHOOK_URL=<your_teams_webhook_url> restart: unless-stopped networks: <network_name>: driver: bridge networks: <network_name>: name: <network_name>: driver: bridge
-
Run your docker compose file:
docker compose up -d
There are two endpoints configured in the flask app below:
For Discord use <receiver-url/receiver_discord>:
@home.route('/receiver_discord', methods=['POST'])
For Microsoft Teams use <receiver-url/receiver_teams>:
@home.route('/receiver_teams', methods=['POST'])
-
Create a dedicated user and under Notification Method add a Third Party Integration - HTTP type and add your Target URL:
-
In your Notification Profiles, you will add this new user as a Recipient:
-
For Warning and Failure notifications, you will get the following:
-
For Return to Normal notifications, you will get the following:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
. - Make your changes and commit them:
git commit -m 'Add feature'
. - Push to the branch:
git push origin feature-name
. - Submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
osintnugget (GitHub @osintnugget)