#!/bin/sh

# https://www.debian.org/doc/manuals/securing-debian-manual/bpp-lower-privs.en.html

SERVICE_USER=cntlm
SERVICE_GROUP=nogroup

if ! getent passwd "$SERVICE_USER" >/dev/null 2>&1 ; then
    echo -n "Adding system user $SERVICE_USER.."
    adduser --quiet \
            --system \
            --ingroup $SERVICE_GROUP \
            --no-create-home \
            --disabled-password \
            $SERVICE_USER 2>/dev/null || true
    echo "..done"
fi

chmod 0600 /etc/cntlm.conf
chown "$SERVICE_USER:$SERVICE_GROUP" /etc/cntlm.conf

#DEBHELPER#
