Compare commits
2 Commits
f79da5cd1f
...
5f96921697
Author | SHA1 | Date | |
---|---|---|---|
|
5f96921697 | ||
|
be2a7f4048 |
5
Makefile
5
Makefile
@ -3,6 +3,8 @@
|
|||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
NAGIOS_DIR = ${PREFIX}/nagios
|
NAGIOS_DIR = ${PREFIX}/nagios
|
||||||
NAGIOS_EXEC = ${NAGIOS_DIR}/libexec
|
NAGIOS_EXEC = ${NAGIOS_DIR}/libexec
|
||||||
|
NAGIOS_USER = _nagios
|
||||||
|
NAGIOS_GROUP = ${NAGIOS_USER}
|
||||||
SYSTEMD_UNIT_DIR = /lib/systemd/system
|
SYSTEMD_UNIT_DIR = /lib/systemd/system
|
||||||
|
|
||||||
rc: install
|
rc: install
|
||||||
@ -29,6 +31,9 @@ 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
|
||||||
|
@echo installing ircbot.conf to /etc
|
||||||
|
test -f /etc/ircbot.conf || install -m 640 -o root -g ${NAGIOS_GROUP} ircbot.conf.default /etc/ircbot.conf
|
||||||
|
test -f /var/log/ircbot.log || install -m 640 -o ${NAGIOS_USER} -g wheel /dev/null /var/log/ircbot.log
|
||||||
@chmod 755 ${PREFIX}/bin/ircbot.sh
|
@chmod 755 ${PREFIX}/bin/ircbot.sh
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
|
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=/var/log/ircbot.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
|
# 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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user