2005-11-30 04:39:17 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2005-12-13 03:27:33 +01:00
|
|
|
# read the default setting file, if it exists
|
|
|
|
[ -e /etc/default/cryptobox ] && . /etc/default/cryptobox
|
|
|
|
|
|
|
|
# set CONF_FILE to default value, if not configured in /etc/default/cryptobox
|
|
|
|
CONF_FILE=${CONF_FILE:-/etc/cryptobox/cryptobox.conf}
|
|
|
|
|
|
|
|
# parse config file
|
2006-05-15 11:41:00 +02:00
|
|
|
if test -e "$CONF_FILE"
|
2005-12-13 03:27:33 +01:00
|
|
|
then . "$CONF_FILE"
|
|
|
|
# create mount and config directories with appropriate permissions
|
2006-05-15 11:41:00 +02:00
|
|
|
test ! -e "$LOG_FILE" && touch "$LOG_FILE" && chown "$CRYPTOBOX_USER" "$LOG_FILE"
|
2005-12-13 03:27:33 +01:00
|
|
|
fi
|
|
|
|
|
2006-05-30 11:08:35 +02:00
|
|
|
if getent passwd "$CRYPTOBOX_USER" 2>/dev/null >/dev/null
|
2006-05-15 11:41:00 +02:00
|
|
|
then # do nothing - the user already exists
|
|
|
|
true
|
|
|
|
else # create cryptobox user
|
|
|
|
echo "Creating new user '$CRYPTOBOX_USER' ..."
|
|
|
|
USER_HOME=/var/lib/cryptobox
|
|
|
|
adduser --system --group --home "$USER_HOME" cryptobox
|
|
|
|
# add the user to the group "plugdev" (necessary for pmount)
|
|
|
|
adduser cryptobox plugdev
|
|
|
|
cp -r "$CONFIG_DEFAULTS_DIR" "$USER_HOME/config"
|
|
|
|
mkdir "$USER_HOME/mnt"
|
|
|
|
chown -R ${CRYPTOBOX_USER}: "$USER_HOME"
|
|
|
|
# only members of the cryptobox group may access the user directory
|
|
|
|
chmod 750 "$USER_HOME"
|
|
|
|
# no one may look into the config directory (protect init passwords)
|
|
|
|
chmod 700 "$USER_HOME/config"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# set permissions for suid wrappers
|
|
|
|
chown root:$CRYPTOBOX_USER "/usr/lib/cryptobox/cryptobox_root_wrapper"
|
|
|
|
chmod 4750 "/usr/lib/cryptobox/cryptobox_root_wrapper"
|
|
|
|
chown $CRYPTOBOX_USER: "/usr/lib/cgi-bin/cryptobox"
|
|
|
|
chmod 6755 "/usr/lib/cgi-bin/cryptobox"
|
2005-12-13 03:27:33 +01:00
|
|
|
|
2006-05-30 11:08:35 +02:00
|
|
|
if [ -x "/etc/init.d/cryptobox" ]; then
|
|
|
|
update-rc.d cryptobox defaults >/dev/null
|
|
|
|
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
|
|
|
|
invoke-rc.d cryptobox start || exit $?
|
|
|
|
else
|
|
|
|
/etc/init.d/cryptobox start || exit $?
|
|
|
|
fi
|
|
|
|
fi
|
2005-12-01 20:20:36 +01:00
|
|
|
|
|
|
|
true
|
2006-05-15 11:41:00 +02:00
|
|
|
|