mirror of
https://github.com/NLnetLabs/krill.git
synced 2026-08-23 08:02:29 +02:00
This PR removes the static-openssl feature. If necessary, this features can be invoked by selecting openssl/vendored directly. The PR also removes building and testing with default features from the CI workflow. The only difference between default and all features currently is rta which is deprecated and will be removed, anyway. This PR now also fixes a few issues in krillc config simple and the post install scripts for Debian and RPM packages.
55 lines
1.6 KiB
Bash
Executable File
55 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
KRILL_CONF="/etc/krill.conf"
|
|
KRILL_CONF_PERMS=640
|
|
KRILL_HOME="/var/lib/krill/"
|
|
KRILL_DATA="${KRILL_HOME}data/"
|
|
KRILL_USER="krill"
|
|
|
|
create_user() {
|
|
if id ${KRILL_USER} > /dev/null 2>&1; then return; fi
|
|
adduser --system --home "${KRILL_HOME}" --group ${KRILL_USER}
|
|
}
|
|
|
|
generate_password() {
|
|
# Tries not to depend on too many other commmands
|
|
# being installed.
|
|
date | md5sum | awk '{print $1}'
|
|
}
|
|
|
|
create_first_time_configuration() {
|
|
if [ ! -f "${KRILL_CONF}" ]; then
|
|
# generate a token for authenticating with Krill
|
|
ADMIN_TOKEN="$(generate_password)"
|
|
|
|
# generate a config file using our preferred filesystem locations
|
|
# and generated admin token
|
|
# note: we don't configure Krill to store its PID file under /var/run/
|
|
# because that requires root privileges potentially at least once per
|
|
# boot, and Krill doesn't drop privileges yet so when run as a non-root
|
|
# user has no right to create the file or missing /var/run/subdir.
|
|
# See: https://stackoverflow.com/a/28312577
|
|
krillc \
|
|
--token "${ADMIN_TOKEN}" \
|
|
config simple --data "${KRILL_DATA}" |
|
|
sed -e "s|^\(### log_type.\+\)|\1\nlog_type = \"syslog\"|" \
|
|
> "${KRILL_CONF}"
|
|
|
|
# Ensure that the config file has the correct ownership
|
|
chown ${KRILL_USER}:${KRILL_USER} ${KRILL_CONF}
|
|
|
|
# Ensure that the config file has the correct permissions
|
|
chmod ${KRILL_CONF_PERMS} ${KRILL_CONF}
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
configure)
|
|
create_user
|
|
create_first_time_configuration
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|