instalación en OpenBSD

This commit is contained in:
sergio 2024-04-17 13:15:58 +02:00
parent 8977678fb2
commit 6d50b0123d
3 changed files with 82 additions and 0 deletions

38
installation/openbsd/install.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/sh
set -e
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Add user:
useradd -c "Tarpit User" -s /sbin/nologin -d /nonexistent _tarpit
# Install binary:
install -m 750 -o _tarpit ../../target/release/sip-tarpit /usr/local/bin/
# Install rc.d:
install -m 555 -o root rc.d/sip_tarpit /etc/rc.d/
rcctl enable sip_tarpit
# Install config file
install -d -m 755 /etc/sip-tarpit/
install -m 644 ../../config.toml /etc/sip-tarpit/
echo '
Remember to adjust your /etc/sip-tarpit/config.toml file!!!
p.ex.: log_file = "/var/log/sip_tarpit/sip_tarpit.log"
'
# Log directory
install -d -m 755 -o _tarpit /var/log/sip_tarpit/
# PF
echo '
Remember to allow incoming traffic on sip-tarpit listening UDP port (default 5060/udp).
'

View File

@ -0,0 +1,22 @@
#!/bin/ksh
#
# $OpenBSD: sip-tarpit.rc,v 0.0.1 2024/04/17
daemon="/usr/local/bin/sip-tarpit"
daemon_user="_tarpit"
. /etc/rc.d/rc.subr
rc_reload=NO
rc_usercheck=NO
rc_bg=YES
rc_start() {
rc_exec "${daemon}"
}
rc_stop() {
pkill -q -U _tarpit -f "sip-tarpit"
}
rc_cmd $1

View File

@ -0,0 +1,22 @@
#!/bin/sh
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Delete user:
userdel _tarpit
# Delete binary:
rm /usr/local/bin/sip-tarpit
# Delete rc.d:
rcctl disable sip_tarpit
rm /etc/rc.d/sip_tarpit
# Delete config file
rm -rf /etc/sip-tarpit/
# Log directory
rm -rf /var/log/sip_tarpit/