Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't run as root, create a kiwiirc user and group #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/deb/after-install
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

adduser --system --group --home /var/lib/kiwiirc kiwiirc

cp -u /etc/kiwiirc/config.conf.example /etc/kiwiirc/config.conf
update-rc.d kiwiirc defaults
/etc/init.d/kiwiirc start
14 changes: 9 additions & 5 deletions scripts/init/kiwiirc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
# Description: Init script for KiwiIRC server
### END INIT INFO

dir="/usr/bin"
cmd="kiwiirc --config=/etc/kiwiirc/config.conf"
user="root"
dir="/var/lib/kiwiirc"
cmd="/usr/bin/kiwiirc"
args="--config=/etc/kiwiirc/config.conf"
user="kiwiirc"
group="kiwiirc"

name=kiwiirc #`basename $0`
pid_file="/var/run/$name.pid"
Expand Down Expand Up @@ -42,8 +44,10 @@ case "$1" in
else
echo "Starting $name"
cd "$dir"
$cmd 1>> "$std_log" 2>&1 &
echo $! > "$pid_file"
touch $std_log
chown $user:$group $std_log
start-stop-daemon --start --quiet --chuid $user:$group --pidfile $pid_file --make-pidfile --exec $cmd -- $args 1>> "$std_log" 2>&1 &
sleep 1;
if ! is_running; then
echo "Unable to start, see $std_log"
exit 1
Expand Down
2 changes: 2 additions & 0 deletions scripts/rpm/after-install
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

adduser --system --group --home /var/lib/kiwiirc kiwiirc

cp -u /etc/kiwiirc/config.conf.example /etc/kiwiirc/config.conf
chkconfig --add kiwiirc
chkconfig kiwiirc on
Expand Down