# HG changeset patch # User Markus Bröker # Date 1230231307 -3600 # Node ID bbcb8a3366b452f05d8cd5ab6c261a72fef93875 # Parent eed9f710ba3baea76ca6c5db7c09ee730991cd9e mcbot needs a proper system account mcbot used the nobody system account and changed some properties. This collides with the default selinux policiy and the new account mcbot solves this issue. committer: Markus Bröker diff --git a/debian/changelog b/debian/changelog --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -mcbot (0.96-3) unstable; urgency=low +mcbot (0.97-1) unstable; urgency=low * Initial Release * the location of mcbot.cgi is stored in the db @@ -28,5 +28,6 @@ * Build Dependency Check improved. * Lintian Build Checks * command must be freed on error - makes valgrind happy + * mcbot needs a proper system account - nobody collides with selinux-policy - -- Markus Broeker Sun, 24 Aug 2008 20:30:00 +0200 + -- Markus Broeker Thu, 25 Dec 2008 20:00:00 +0200 diff --git a/debian/dirs b/debian/dirs --- a/debian/dirs +++ b/debian/dirs @@ -1,2 +1,2 @@ -var/lib/nobody/data -var/lib/nobody +var/lib/mcbot/data +var/lib/mcbot diff --git a/debian/postinst b/debian/postinst --- a/debian/postinst +++ b/debian/postinst @@ -20,23 +20,23 @@ case "$1" in configure) - if [ ! -f /var/lib/nobody/data/mcbot.dat ]; + if [ ! -f /var/lib/mcbot/data/mcbot.dat ]; then - echo "Creating initial database in /var/lib/nobody/data"; + echo "Creating initial database in /var/lib/mcbot/data"; dbtool -a -k 1 -v 1; dbtool -d 1; fi - if [ -f /var/lib/nobody/.mcbotrc.dpkg-old ]; + if [ -f /var/lib/mcbot/.mcbotrc.dpkg-old ]; then - mv -f /var/lib/nobody/.mcbotrc.dpkg-old /var/lib/nobody/.mcbotrc; + mv -f /var/lib/mcbot/.mcbotrc.dpkg-old /var/lib/mcbot/.mcbotrc; fi - echo "Changing ownership in /var/lib/nobody" - usermod -s /bin/bash -d /var/lib/nobody nobody - chown -R nobody:nogroup /var/lib/nobody - echo "Setting permissions for /var/lib/nobody/.mcbotrc to 600" - chmod 600 /var/lib/nobody/.mcbotrc + echo "Changing ownership in /var/lib/mcbot" + useradd -c "MCBOT" -s /bin/bash -d /var/lib/mcbot mcbot + chown -R mcbot:mcbot /var/lib/mcbot + echo "Setting permissions for /var/lib/mcbot/.mcbotrc to 600" + chmod 600 /var/lib/mcbot/.mcbotrc echo "ENTER /etc/init.d/mcbot restart after editing .mcbotrc" update-rc.d mcbot defaults &>/dev/null invoke-rc.d mcbot restart diff --git a/debian/postrm b/debian/postrm --- a/debian/postrm +++ b/debian/postrm @@ -21,14 +21,14 @@ case "$1" in purge) - rm -rf /var/lib/nobody/data; - rm -f /var/lib/nobody/.mcbotrc; - rm -f /var/lib/nobody/mcbot-*.log; + rm -rf /var/lib/mcbot/data; + rm -f /var/lib/mcbot/.mcbotrc; + rm -f /var/lib/mcbot/mcbot-*.log; ;; remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) update-rc.d -f mcbot remove &>/dev/null - usermod -d /nonexistent -s /bin/bash nobody + userdel mcbot ;; *) diff --git a/debian/preinst b/debian/preinst --- a/debian/preinst +++ b/debian/preinst @@ -21,9 +21,9 @@ invoke-rc.d mcbot stop; fi - if [ -f /var/lib/nobody/.mcbotrc ]; + if [ -f /var/lib/mcbot/.mcbotrc ]; then - cp -f /var/lib/nobody/.mcbotrc /var/lib/nobody/.mcbotrc.dpkg-old + cp -f /var/lib/mcbot/.mcbotrc /var/lib/mcbot/.mcbotrc.dpkg-old fi ;; diff --git a/debian/rules b/debian/rules --- a/debian/rules +++ b/debian/rules @@ -48,7 +48,7 @@ # Add here commands to install the package into debian/mcbot. $(MAKE) DESTDIR=$(CURDIR)/debian/mcbot install - cp config/.mcbotrc debian/mcbot/var/lib/nobody/ + cp config/.mcbotrc debian/mcbot/var/lib/mcbot/ # Build architecture-independent files here. binary-indep: build install diff --git a/scripts/runbot b/scripts/runbot --- a/scripts/runbot +++ b/scripts/runbot @@ -10,12 +10,12 @@ # Description: IRC BOT mcbot ### END INIT INFO -RUNAS="nobody" +RUNAS="mcbot" BINARY="mcbot" DIRECTORY="/usr/sbin/" LANGUAGE="de_DE.UTF-8" PARAMETER="" -LOGFILE="/var/lib/nobody/mcbot-`date \"+%d-%m-%y\"`.log" +LOGFILE="/var/lib/mcbot/mcbot-`date \"+%d-%m-%y\"`.log" [[ ! -x "${DIRECTORY}/${BINARY}" ]] && exit 0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,7 +10,7 @@ # C-Definitions ADD_DEFINITIONS(-Wall -O2 -ansi -pedantic) ADD_DEFINITIONS(-D_XOPEN_SOURCE=500) -ADD_DEFINITIONS(-DBOT_VERSION=0.96) +ADD_DEFINITIONS(-DBOT_VERSION=0.97) # Includes INCLUDE_DIRECTORIES(../include) @@ -22,7 +22,7 @@ # Install Rules INSTALL(TARGETS mcbot RUNTIME DESTINATION /usr/sbin) INSTALL(TARGETS dbtool RUNTIME DESTINATION /usr/bin) -INSTALL(DIRECTORY ../locale/ DESTINATION /var/lib/nobody/data/locale) +INSTALL(DIRECTORY ../locale/ DESTINATION /var/lib/mcbot/data/locale) INSTALL(PROGRAMS ../scripts/runbot DESTINATION /etc/init.d/ RENAME mcbot) INSTALL(PROGRAMS ../scripts/mcbot.cgi DESTINATION /usr/lib/cgi-bin/) diff --git a/src/dbtool.c b/src/dbtool.c --- a/src/dbtool.c +++ b/src/dbtool.c @@ -11,7 +11,7 @@ #include #ifndef FILE_NAME -#define FILE_NAME "/var/lib/nobody/data/mcbot.dat" +#define FILE_NAME "/var/lib/mcbot/data/mcbot.dat" #endif void help (char *prgname) diff --git a/src/main.c b/src/main.c --- a/src/main.c +++ b/src/main.c @@ -16,11 +16,11 @@ #include #ifndef CONFIG_FILE -#define CONFIG_FILE "/var/lib/nobody/.mcbotrc" +#define CONFIG_FILE "/var/lib/mcbot/.mcbotrc" #endif #ifndef LOCALE_PATH -#define LOCALE_PATH "/var/lib/nobody/data/locale" +#define LOCALE_PATH "/var/lib/mcbot/data/locale" #endif short active = 1; /* needed for a safe shutdown */ @@ -105,6 +105,7 @@ } else { if ((msg = parse (&message)) != NULL) { fprintf (message.stream, "%s\r\n", msg); + fflush (message.stream); printf ("%10s %s", "WRITE", msg); } } diff --git a/src/parse.c b/src/parse.c --- a/src/parse.c +++ b/src/parse.c @@ -16,7 +16,7 @@ #include #ifndef DATABASE_FILE -#define DATABASE_FILE "/var/lib/nobody/data/mcbot.dat" +#define DATABASE_FILE "/var/lib/mcbot/data/mcbot.dat" #endif #ifndef SOURCE_URL