<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="it">
	<id>https://wiki.gazzi.net/index.php?action=history&amp;feed=atom&amp;title=Tips_Linux%2FOpenLDAP_e_SSH</id>
	<title>Tips Linux/OpenLDAP e SSH - Cronologia</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.gazzi.net/index.php?action=history&amp;feed=atom&amp;title=Tips_Linux%2FOpenLDAP_e_SSH"/>
	<link rel="alternate" type="text/html" href="https://wiki.gazzi.net/index.php?title=Tips_Linux/OpenLDAP_e_SSH&amp;action=history"/>
	<updated>2026-05-17T03:24:51Z</updated>
	<subtitle>Cronologia della pagina su questo sito</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://wiki.gazzi.net/index.php?title=Tips_Linux/OpenLDAP_e_SSH&amp;diff=621&amp;oldid=prev</id>
		<title>Admin: Creazione sottosezione Tips Linux: OpenLDAP e SSH con configurazione LDAP/SSSD/SSH e sudo</title>
		<link rel="alternate" type="text/html" href="https://wiki.gazzi.net/index.php?title=Tips_Linux/OpenLDAP_e_SSH&amp;diff=621&amp;oldid=prev"/>
		<updated>2026-03-25T11:26:53Z</updated>

		<summary type="html">&lt;p&gt;Creazione sottosezione Tips Linux: OpenLDAP e SSH con configurazione LDAP/SSSD/SSH e sudo&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nuova pagina&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= OpenLDAP e SSH =&lt;br /&gt;
&lt;br /&gt;
Questa pagina documenta una configurazione pratica di integrazione tra OpenLDAP e SSH su Ubuntu, con autenticazione utenti centralizzata e privilegi sudo per utente tecnico.&lt;br /&gt;
&lt;br /&gt;
== Obiettivo ==&lt;br /&gt;
* Login SSH con utenza LDAP (es. `gazzinet`)&lt;br /&gt;
* Risoluzione utenti via SSSD/NSS&lt;br /&gt;
* Elevazione privilegi con `sudo`&lt;br /&gt;
&lt;br /&gt;
== Parametri LDAP usati ==&lt;br /&gt;
* URI: `ldap://172.16.1.7:389`&lt;br /&gt;
* Base DN: `dc=gazzi,dc=local`&lt;br /&gt;
* User search base: `ou=People,dc=gazzi,dc=local`&lt;br /&gt;
* Group search base: `ou=Groups,dc=gazzi,dc=local`&lt;br /&gt;
* Bind DN tecnico: `uid=ldapbind,ou=People,dc=gazzi,dc=local`&lt;br /&gt;
&lt;br /&gt;
== Pacchetti installati ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apt-get update&lt;br /&gt;
apt-get install -y sssd-ldap libnss-sss libpam-sss ldap-utils sudo qemu-guest-agent&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configurazione SSSD ==&lt;br /&gt;
File: `/etc/sssd/sssd.conf`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ini&amp;quot;&amp;gt;&lt;br /&gt;
[sssd]&lt;br /&gt;
services = nss, pam&lt;br /&gt;
config_file_version = 2&lt;br /&gt;
domains = GAZZI&lt;br /&gt;
&lt;br /&gt;
[domain/GAZZI]&lt;br /&gt;
id_provider = ldap&lt;br /&gt;
auth_provider = ldap&lt;br /&gt;
chpass_provider = ldap&lt;br /&gt;
access_provider = permit&lt;br /&gt;
cache_credentials = True&lt;br /&gt;
enumerate = False&lt;br /&gt;
use_fully_qualified_names = False&lt;br /&gt;
fallback_homedir = /home/%u&lt;br /&gt;
default_shell = /bin/bash&lt;br /&gt;
ldap_uri = ldap://172.16.1.7:389&lt;br /&gt;
ldap_search_base = dc=gazzi,dc=local&lt;br /&gt;
ldap_user_search_base = ou=People,dc=gazzi,dc=local&lt;br /&gt;
ldap_group_search_base = ou=Groups,dc=gazzi,dc=local&lt;br /&gt;
ldap_default_bind_dn = uid=ldapbind,ou=People,dc=gazzi,dc=local&lt;br /&gt;
ldap_default_authtok = ********&lt;br /&gt;
ldap_user_object_class = inetOrgPerson&lt;br /&gt;
ldap_user_name = uid&lt;br /&gt;
ldap_group_object_class = groupOfNames&lt;br /&gt;
ldap_group_name = cn&lt;br /&gt;
ldap_tls_reqcert = never&lt;br /&gt;
ldap_id_use_start_tls = False&lt;br /&gt;
ldap_auth_disable_tls_never_use_in_production = true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
* Il parametro `ldap_auth_disable_tls_never_use_in_production = true` è stato necessario in questo ambiente LDAP non-TLS.&lt;br /&gt;
* In produzione consigliata: LDAP su TLS/LDAPS con certificati validi.&lt;br /&gt;
&lt;br /&gt;
== Integrazione NSS/PAM ==&lt;br /&gt;
* In `/etc/nsswitch.conf` aggiunto `sss` per `passwd`, `group`, `shadow`&lt;br /&gt;
* Home automatica al primo login via `pam_mkhomedir`&lt;br /&gt;
&lt;br /&gt;
== Configurazione SSH ==&lt;br /&gt;
File override: `/etc/ssh/sshd_config.d/99-ldap-auth.conf`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
UsePAM yes&lt;br /&gt;
PasswordAuthentication yes&lt;br /&gt;
KbdInteractiveAuthentication yes&lt;br /&gt;
PubkeyAuthentication yes&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sudo per utente LDAP ==&lt;br /&gt;
File: `/etc/sudoers.d/90-gazzinet-ldap`&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
gazzinet ALL=(ALL:ALL) ALL&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Verifiche effettuate ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
getent passwd gazzinet&lt;br /&gt;
systemctl is-active sssd&lt;br /&gt;
sshd -T | grep -E &amp;#039;usepam|passwordauthentication|kbdinteractiveauthentication&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Test operativo finale:&lt;br /&gt;
* Login SSH come `gazzinet` riuscito&lt;br /&gt;
* `sudo` funzionante con password utente LDAP&lt;br /&gt;
&lt;br /&gt;
[[Category:Tips Linux]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>