first commit

This commit is contained in:
Alex Rennie-Lis
2025-01-23 15:31:27 +00:00
commit ebc1aea8c7
5 changed files with 187 additions and 0 deletions

10
DEBIAN/control Normal file
View File

@@ -0,0 +1,10 @@
Package: webhookd
Version: 1.0
Section: utils
Priority: optional
Architecture: all
Depends: python3, python3-pip
Maintainer: Alex Rennie-Lis <a.lis@cornwall-insight.com>
Description: A webhook service that executes shell scripts on incoming requests
A simple webhook service configured via systemd and /etc/webhookd.conf.

28
DEBIAN/postinst Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
# Ensure the configuration directory exists
if [ ! -f /etc/webhookd.conf ]; then
cat <<EOL > /etc/webhookd.conf
# Webhook Daemon Configuration
SCRIPT_FOLDER=/webhooks/
HOST=0.0.0.0
PORT=8443
CERT_FILE=/etc/ssl/certs/webhookd.crt
KEY_FILE=/etc/ssl/private/webhookd.key
EOL
fi
# Create the system user if not exists
if ! id -u webhookd >/dev/null 2>&1; then
useradd -r -s /bin/false webhookd
fi
# Set ownership for the script folder
mkdir -p /webhooks/
chown -R webhookd:webhookd /webhooks/
# Reload systemd and enable the service
systemctl daemon-reload
systemctl enable webhookd.service
systemctl start webhookd.service