check-mk/debian/patches/02_wato-sudoers.patch

38 lines
1.3 KiB
Diff

diff -uNr check-mk.orig/setup.sh check-mk/setup.sh
--- check-mk.orig/setup.sh 2017-05-24 11:38:06.852000000 +0200
+++ check-mk/setup.sh 2017-05-24 11:38:31.000000000 +0200
@@ -745,28 +745,11 @@
return
fi
- sudolines="Defaults:$wwwuser !requiretty\n$wwwuser ALL = (root) NOPASSWD: $bindir/check_mk --automation *"
-
- if [ ! -e /etc/sudoers ] ; then
- echo "You do not have sudo installed. Please install sudo "
- echo "and add the following line to /etc/sudoers if you want"
- echo "to use WATO - the Check_MK Web Administration Tool"
- echo
- echo -e "$sudolines"
- echo
- echo
- return
- fi
-
- if fgrep -q 'check_mk --automation' /etc/sudoers 2>/dev/null
- then
- # already present. Do not touch.
- return
- fi
-
- echo >> /etc/sudoers
- echo "# Needed for WATO - the Check_MK Web Administration Tool" >> /etc/sudoers
- echo -e "$sudolines" >> /etc/sudoers
+ sudolines="Defaults:$wwwuser !requiretty\n$wwwuser ALL = (nagios) NOPASSWD: $bindir/check_mk --automation *"
+ mkdir -p $DESTDIR/etc/sudoers.d
+ echo >> $DESTDIR/etc/sudoers.d/check_mk_wato
+ echo "# Needed for WATO - the Check_MK Web Administration Tool" >> $DESTDIR/etc/sudoers.d/check_mk_wato
+ echo -e "$sudolines" >> $DESTDIR/etc/sudoers.d/check_mk_wato
}
while true