No domínio DNS
domain.local.
existem duas máquinas
host.domain.local. = 192.168.1.1
srv1.domain.local. = 192.168.1.2
host.domain.local. is KDC for Kerberos realm DOMAIN.LOCAL,
srv1.domain.local. is a KDC for Kerberos realm RC.DOMAIN.LOCAL.
Há uma confiança unidirecional entre RC.DOMAIN.LOCAL e DOMAIN.LOCAL:
RC.DOMAIN.LOCAL ===trusts===> tickets from DOMAIN.LOCAL,
mas não vice-versa.
O KDC para RC.DOMAIN.LOCAL em srv1 foi configurado com um backend OpenLDAP de acordo com
link
com seu back-end OpenLDAP em host.domain.local, acessível por
ldaps://host.domain.local:636.
Há também um OpenLDAP local instalado (mas com falhas) no srv1, portanto, existem ldap.conf locais etc. em srv1 a serem levados em consideração.
Quando eu inicio o KDC em srv1 manualmente em uma sessão raiz (srv1)
root@srv1:~# krb5kdc
tudo funciona bem.
Quando eu tento iniciar o KDC em srv1 pelos scripts init do sistema
root@srv1:~# /etc/init.d/krb5-kdc start
ou
root@srv1:~# service krb5-kdc start
um diálogo TLS entre o krb5kdc no srv1 e o slapd no host falha; o syslog combinado é
14:46:44 host.domain.local slapd[1778]: daemon: activity on 1 descriptor
14:46:44 host.domain.local slapd[1778]: slap_listener_activate(6):
14:46:44 srv1 krb5kdc[3206]: krb5kdc: cannot initialize realm RC.DOMAIN.LOCAL - see log file for details
14:46:44 host.domain.local slapd[1778]: >>> slap_listener(ldaps://192.168.1.1:636/)
14:46:44 host.domain.local slapd[1778]: daemon: listen=6, new connection on 10
14:46:44 host.domain.local slapd[1778]: daemon: added 10r (active) listener=(nil)
14:46:44 host.domain.local slapd[1778]: conn=1037 fd=10 ACCEPT from IP=192.168.1.2:38664 (IP=192.168.1.1:636)
14:46:44 host.domain.local slapd[1778]: daemon: select: listen=6 active_threads=0 tvp=NULL
14:46:44 host.domain.local slapd[1778]: daemon: select: listen=7 active_threads=0 tvp=NULL
14:46:44 host.domain.local slapd[1778]: daemon: activity on 1 descriptor
14:46:44 host.domain.local slapd[1778]: daemon: waked
14:46:44 host.domain.local slapd[1778]: daemon: select: listen=6 active_threads=0 tvp=NULL
14:46:44 host.domain.local slapd[1778]: daemon: activity on 1 descriptor
14:46:44 host.domain.local slapd[1778]: daemon: activity on:
14:46:44 host.domain.local slapd[1778]: 10r
14:46:44 host.domain.local slapd[1778]:
14:46:44 host.domain.local slapd[1778]: daemon: read activity on 10
14:46:44 host.domain.local slapd[1778]: connection_get(10): got connid=1037
14:46:44 host.domain.local slapd[1778]: connection_read(10): checking for input on id=1037
14:46:44 host.domain.local slapd[1778]: connection_read(10): TLS accept failure error=-1 id=1037, closing
14:46:44 host.domain.local slapd[1778]: connection_closing: readying conn=1037 sd=10 for close
14:46:44 host.domain.local slapd[1778]: connection_close: conn=1037 sd=10
14:46:44 host.domain.local slapd[1778]: daemon: removing 10
14:46:44 host.domain.local slapd[1778]: daemon: activity on 1 descriptor
14:46:44 host.domain.local slapd[1778]: slap_listener_activate(6):
14:46:44 host.domain.local slapd[1778]: >>> slap_listener(ldaps://192.168.1.1:636/)
14:46:44 host.domain.local slapd[1778]: daemon: listen=6, new connection on 10
14:46:44 host.domain.local slapd[1778]: daemon: added 10r (active) listener=(nil)
14:46:44 host.domain.local slapd[1778]: conn=1038 fd=10 ACCEPT from IP=192.168.1.2:38666 (IP=192.168.1.1:636)
14:46:44 host.domain.local slapd[1778]: daemon: select: listen=6 active_threads=0 tvp=NULL
14:46:44 host.domain.local slapd[1778]: daemon: select: listen=7 active_threads=0 tvp=NULL
14:46:44 host.domain.local slapd[1778]: daemon: activity on 1 descriptor
14:46:44 host.domain.local slapd[1778]: daemon: waked
14:46:44 host.domain.local slapd[1778]: daemon: select: listen=6 active_threads=0 tvp=NULL
14:46:44 srv1 systemd[1]: krb5-kdc.service: control process exited, code=exited status=1
14:46:44 srv1 systemd[1]: Failed to start Kerberos 5 Key Distribution Center.
14:46:44 srv1 systemd[1]: Unit krb5-kdc.service entered failed state.
14:46:44 host.domain.local slapd[1778]: daemon: activity on 1 descriptor
14:46:44 host.domain.local slapd[1778]: daemon: activity on:
14:46:44 host.domain.local slapd[1778]: 10r
14:46:44 host.domain.local slapd[1778]:
14:46:44 host.domain.local slapd[1778]: daemon: read activity on 10
14:46:44 host.domain.local slapd[1778]: connection_get(10): got connid=1038
14:46:44 host.domain.local slapd[1778]: connection_read(10): checking for input on id=1038
14:46:44 host.domain.local slapd[1778]: connection_read(10): TLS accept failure error=-1 id=1038, closing
14:46:44 host.domain.local slapd[1778]: connection_closing: readying conn=1038 sd=10 for close
14:46:44 host.domain.local slapd[1778]: connection_close: conn=1038 sd=10
14:46:44 host.domain.local slapd[1778]: daemon: removing 10
O /etc/ldap/ldap.conf no srv1 é
rootdn "cn=admin,cn=config"
rootpw {SASL}[email protected]
BASE dc=domain,dc=local
URI ldaps://127.0.0.1:636/ ldapi:///
TLS_CACERT /etc/ldap/ssl/cacert.pem
TLS_REQCERT allow
SASL_MECH EXTERNAL
portanto, isso se refere principalmente ao slapd srv1-local, mas é, na medida do aplicável, no manual bem-sucedido krb5kdc start on srv1 substituído pelo efetivo
.ldaprc for root@srv1:
URI ldaps://host.domain.local:636
TLS_REQCERT demand
SASL_MECH EXTERNAL
TLS_CACERT /root/secret/cacert.pem
TLS_CERT /root/secret/root.srv1.domain.local-cert.pem
TLS_KEY /root/secret/private/root.srv1.domain.local-key.pem
e pela seção dbmodules do /etc/krb5kdc/kdc.conf no srv1
[dbmodules]
LDAP = {
db_library = kldap
ldap_kdc_sasl_mech = EXTERNAL
ldap_kdc_dn = cn=krb5kdc,dc=rc,dc=domain,dc=local
ldap_kadmind_dn = cn=kadmind,dc=rc,dc=domain,dc=local
ldap_service_password_file = /etc/krb5kdc/ldap_stash
ldap_kerberos_container_dn = cn=realm,dc=rc,dc=domain,dc=local
#ldap_servers = ldap://host.domain.local:389
ldap_servers = ldaps://host.domain.local:636
}
root@srv1:~# ldapwhoami
rendimentos
SASL/EXTERNAL authentication started
SASL username: cn=root.srv1.domain.local,ou=...
SASL SSF: 0
dn:cn=admin,cn=config
e
root@srv1:~# ldapsearch -b "" -s base -LLL supportedSASLMechanisms
rendimentos
SASL/EXTERNAL authentication started
SASL username: cn=root.srv1.domain.local,ou=...
SASL SSF: 0
dn:
supportedSASLMechanisms: EXTERNAL
srv1 roda com amd64 Debian 8 "jessie":
krb5-kdc-ldap 1.12.1+dfsg-19
ldap-utils 2.4.40+dfsg-1+deb8u1
libaprutil1-ldap 1.5.4-1
libkldap4 4:4.14.2-2+b1
libldap-2.4-2 2.4.40+dfsg-1+deb8u1
O ponto em conformidade com o Debian para configuração adicional do KDC é / etc / default / krb5-kdc:
# [...]
DAEMON_ARGS="-r RC.DOMAIN.LOCAL"
# LDAPNOINIT=1
# LDAPRC=.ldaprc
# LDAPTLS_REQCERT=demand
# #LDAPSASL_SECPROPS none
#LDAPSASL_MECH=EXTERNAL
#LDAPTLS_CACERT=/root/secret/cacert.pem
#LDAPTLS_CERT=/root/secret/root.srv1.domain.local-cert.pem
#LDAPTLS_KEY=/root/secret/private/root.srv1.domain.local-key.pem
Como você pode ver, tentei recriar manualmente um ambiente propoer TLS para o script de inicialização do KDC, mas não adiantou ainda.
Então - por que o KDC funciona perfeitamente a partir de um shell raiz interativo, mas falha no script de inicialização e o que fazer com o último?