[ldap-client] use nounous ldap

certbot_on_virtu
_benjamin 2020-07-19 15:30:38 +02:00 committed by shirenn
parent 76421036b2
commit 391d855fa7
5 changed files with 31 additions and 44 deletions

View File

@ -4,17 +4,14 @@
apt:
update_cache: true
name:
- nslcd
- libnss-ldapd
- libpam-ldapd
- nscd # local cache
state: present
register: apt_result
retries: 3
until: apt_result is succeeded
# Configure /etc/nslcd.conf
- name: Configure nslcd LDAP credentials
- name: Configure nslcd
template:
src: nslcd.conf.j2
dest: /etc/nslcd.conf
@ -26,20 +23,27 @@
lineinfile:
dest: /etc/nsswitch.conf
regexp: "^{{ item }}:"
line: "{{ item }}: files ldap"
line: "{{ item }}: files systemd ldap"
loop:
- passwd
- group
- shadow
notify: Restart nslcd service
# Disable passwd and chsh
- name: Copy passwd and chsh scripts
template:
src: "bin/{{ item }}.j2"
dest: "/usr/local/bin/{{ item }}"
mode: 0755
- name: Configure NSS to use LDAP
lineinfile:
dest: /etc/nsswitch.conf
regexp: "^{{ item }}:"
line: "{{ item }}: files ldap"
loop:
- chsh
- chsh.ldap
- passwd
- shadow
- networks
notify: Restart nslcd service
- name: Configure NSS to use LDAP
lineinfile:
dest: /etc/nsswitch.conf
regexp: "^{{ item }}:"
line: "{{ item }}: files dns ldap"
loop:
- hosts
notify: Restart nslcd service

View File

@ -1,4 +0,0 @@
#!/bin/sh
{{ ansible_header | comment }}
echo "Pour changer votre shell,\nAllez sur l'intranet : {{intranet_url}}"

View File

@ -1,4 +0,0 @@
#!/bin/sh
{{ ansible_header | comment }}
echo "Pour changer votre shell,\nAllez sur l'intranet : {{intranet_url}}"
echo "De toutes façons la vraie commande aurait pas marché, on installe pas nslcd-utils sur les serveurs normalement."

View File

@ -1,3 +0,0 @@
#!/bin/sh
{{ ansible_header | comment }}
echo "Pour changer votre mot de passe,\nAllez sur l'intranet : {{intranet_url}}"

View File

@ -1,35 +1,30 @@
{{ ansible_header | comment }}
# /etc/nslcd.conf
# nslcd configuration file. See nslcd.conf(5)
# for details.
# The user and group nslcd should run as.
uid nslcd
gid nslcd
# The location at which the LDAP server(s) should be reachable.
{% if ldap_local_replica_uri is defined %}
{% for uri in ldap_local_replica_uri %}
uri {{ uri }}
{% if ldap.local %}
uri ldapi:///
{% else %}
{% for server in ldap.servers %}
uri ldaps://{{ server }}/
{% endfor %}
{% endif %}
uri {{ ldap_master_uri }}
# The search base that will be used for all queries.
base {{ ldap_base }}
base passwd {{ ldap_user_tree }}
base shadow {{ ldap_user_tree }}
base group ou=posix,ou=groups,{{ ldap_base }}
base dc=crans,dc=org
# The LDAP protocol version to use.
ldap_version 3
# Time limit to wait for an answer
timelimit 5
# Time limit to wait for a bind
bind_timelimit 5
#ldap_version 3
# The DN to bind with for normal lookups.
binddn {{ ldap_nslcd_bind_dn }}
bindpw {{ ldap_nslcd_passwd }}
#binddn cn=annonymous,dc=example,dc=net
#bindpw secret
# The DN used for password modifications by root.
#rootpwmoddn cn=admin,dc=example,dc=com
@ -41,4 +36,3 @@ tls_cacertfile /etc/ssl/certs/ca-certificates.crt
# The search scope.
#scope sub