ircbot: use a dedicated configuration file
This commit is contained in:
parent
f79da5cd1f
commit
be2a7f4048
1
Makefile
1
Makefile
@ -29,6 +29,7 @@ install:
|
||||
@chmod 755 ${NAGIOS_EXEC}/check_onion
|
||||
@echo installing ircbot.sh to ${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
|
||||
|
||||
uninstall:
|
||||
|
@ -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
|
||||
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
10
ircbot.conf.default
Normal 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"
|
21
ircbot.sh
21
ircbot.sh
@ -2,19 +2,14 @@
|
||||
|
||||
# TODO: make sure only nagios can write to $inputf and $msgf, else do not run
|
||||
|
||||
# configuration area
|
||||
# TODO: separate configuration into a file owned by nagios user.
|
||||
# this improves security and allows reinstall (from git) to not clobber config.
|
||||
nick='nagios'
|
||||
chan='#ops'
|
||||
server='irc.anarchyplanet.org'
|
||||
email='nagios@anarchyplanet.org'
|
||||
password='mysecretpass'
|
||||
port='6667'
|
||||
inputf=/tmp/ircinput
|
||||
msgf=/tmp/ircmsg
|
||||
logf=/tmp/notify_irc.log
|
||||
joinmsg="nagios bot reporting"
|
||||
conf=/etc/ircbot.conf
|
||||
|
||||
if ! test -r $conf; then
|
||||
echo "cannot read configuration file, exiting"
|
||||
exit 1
|
||||
else
|
||||
. $conf
|
||||
fi
|
||||
|
||||
touch $msgf
|
||||
|
||||
|
Reference in New Issue
Block a user