ircbot: use a dedicated configuration file

This commit is contained in:
sceox 2021-11-15 00:23:44 -08:00
parent f79da5cd1f
commit be2a7f4048
4 changed files with 23 additions and 13 deletions

View File

@ -29,6 +29,7 @@ install:
@chmod 755 ${NAGIOS_EXEC}/check_onion @chmod 755 ${NAGIOS_EXEC}/check_onion
@echo installing ircbot.sh to ${PREFIX}/bin @echo installing ircbot.sh to ${PREFIX}/bin
@cp -f ircbot.sh ${PREFIX}/bin @cp -f ircbot.sh ${PREFIX}/bin
test -f /etc/ircbot.conf || install -m 640 ircbot.conf.default /etc/ircbot.conf
@chmod 755 ${PREFIX}/bin/ircbot.sh @chmod 755 ${PREFIX}/bin/ircbot.sh
uninstall: uninstall:

View File

@ -59,3 +59,7 @@ systemd or rc. Start it with `systemctl start ircbot` or `rcctl start ircbot`.
The nagios IRC bot (ircbot.sh) does not automatically rejoin the The nagios IRC bot (ircbot.sh) does not automatically rejoin the
IRC server and channel after it loses the connection. IRC server and channel after it loses the connection.
The Makefile does not install the /etc/ircbot.conf configuration
file with the correct ownership and permissions. It should be
readable by nagios user on Linux and _nagios user on OpenBSD.

10
ircbot.conf.default Normal file
View File

@ -0,0 +1,10 @@
nick='nagios'
chan='#ops'
server='irc.example.org'
email='nagios@example.org'
password='mysecretpass'
port='6667'
inputf=/tmp/ircinput
msgf=/tmp/ircmsg
logf=/tmp/notify_irc.log
joinmsg="nagios bot reporting"

View File

@ -2,19 +2,14 @@
# TODO: make sure only nagios can write to $inputf and $msgf, else do not run # TODO: make sure only nagios can write to $inputf and $msgf, else do not run
# configuration area conf=/etc/ircbot.conf
# TODO: separate configuration into a file owned by nagios user.
# this improves security and allows reinstall (from git) to not clobber config. if ! test -r $conf; then
nick='nagios' echo "cannot read configuration file, exiting"
chan='#ops' exit 1
server='irc.anarchyplanet.org' else
email='nagios@anarchyplanet.org' . $conf
password='mysecretpass' fi
port='6667'
inputf=/tmp/ircinput
msgf=/tmp/ircmsg
logf=/tmp/notify_irc.log
joinmsg="nagios bot reporting"
touch $msgf touch $msgf