krb5: support environment setting on systemd

Let krb5 support environment setting on systemd startup.
Here is one requirement of environment setting from upstream krb5
...
https://web.mit.edu/kerberos/krb5-1.16/doc/admin/conf_files/kdc_conf.html
|Normally, the kdc.conf file is found in the KDC state directory,
LOCALSTATEDIR/krb5kdc. You can override the default location by
setting the environment variable KRB5_KDC_PROFILE.
...

The fix of (krb5-admin-server.service/krb5-kdc.service) refers ubuntu 1604

Variable RUN_KADMIND is sysvinit, move it out from default/krb5-admin-server

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
Hongxu Jia
2018-05-02 17:31:54 +08:00
committed by Armin Kuster
parent 1ec2d489c3
commit 7eb04ba677
4 changed files with 8 additions and 3 deletions
@@ -1,6 +1,4 @@
# Automatically generated. If you change anything in this file other than the
# values of RUN_KADMIND or DAEMON_ARGS, first run dpkg-reconfigure
# values of DAEMON_ARGS, first run dpkg-reconfigure
# krb5-admin-server and disable managing the kadmin configuration with
# debconf. Otherwise, changes will be overwritten.
RUN_KADMIND=true
@@ -7,6 +7,7 @@ ConditionPathExists=/etc/krb5.conf
Type=forking
ExecStartPre=/bin/sh -c "test ! -f /var/log/kadmind.log || test ! -x /sbin/restorecon || /sbin/restorecon -F /var/log/kadmind.log"
ExecStart=/usr/sbin/kadmind
EnvironmentFile=-/etc/default/krb5-admin-server
SuccessExitStatus=1 2 SIGKILL
TimeoutStopSec=30
@@ -6,6 +6,7 @@ ConditionPathExists=/etc/krb5.conf
[Service]
Type=forking
ExecStart=/usr/sbin/krb5kdc
EnvironmentFile=-/etc/default/krb5-kdc
SuccessExitStatus=1 2 SIGKILL
TimeoutStopSec=30
@@ -78,12 +78,17 @@ do_install_append() {
mkdir -p ${D}/${sysconfdir}/default/volatiles
echo "d root root 0755 ${localstatedir}/run/krb5kdc none" \
> ${D}${sysconfdir}/default/volatiles/87_krb5
echo "RUN_KADMIND=true" >> ${D}/${sysconfdir}/default/krb5-admin-server
fi
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
install -d ${D}${sysconfdir}/tmpfiles.d
echo "d /run/krb5kdc - - - -" \
> ${D}${sysconfdir}/tmpfiles.d/krb5.conf
mkdir -p ${D}/${sysconfdir}/default
install -m 0644 ${WORKDIR}/etc/default/* ${D}/${sysconfdir}/default
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/krb5-admin-server.service ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/krb5-kdc.service ${D}${systemd_system_unitdir}