doc:appunti:linux:sa:nis
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:appunti:linux:sa:nis [2020/12/16 15:43] – [NIS users unable to poweroff/reboot or manage printers] niccolo | doc:appunti:linux:sa:nis [2020/12/16 16:27] (current) – niccolo | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | Installato il pacchetto | + | Pages relate to **[[wp> |
- | Fare attenzione al contenuto dei seguenti file: | + | * **[[nis_server]]** |
- | + | * **[[nis_user_shutdown_problem]]** | |
- | * **/ | + | |
- | * **/ | + | |
- | * **/ | + | |
- | * **/ | + | |
- | + | ||
- | Conviene che in **''/ | + | |
- | + | ||
- | < | + | |
- | 127.0.0.1 | + | |
- | 10.0.1.47 | + | |
- | </ | + | |
- | + | ||
- | Poiché vogliamo essere **NIS master server**, in '' | + | |
- | < | + | |
- | NISSERVER=master | + | |
- | </ | + | |
- | + | ||
- | Per decidere chi ha accesso al server NIS si mette in '' | + | |
- | + | ||
- | < | + | |
- | 255.255.255.0 10.0.1.0 | + | |
- | </ | + | |
- | + | ||
- | **NOTA:** se il server NIS ha più di una interfaccia di rete e si vuole rispondere a richieste broadcast da parte dei client, è opportuno aggiungere in '' | + | |
- | + | ||
- | < | + | |
- | # Always allow access for localhost | + | |
- | 255.0.0.0 | + | |
- | + | ||
- | # Allow access from localhost (when proxying broadcast requests? | + | |
- | # See Debian bugs: | + | |
- | # http:// | + | |
- | # http:// | + | |
- | # http:// | + | |
- | 255.255.255.255 192.168.144.2 | + | |
- | </ | + | |
- | + | ||
- | infatti pare che '' | + | |
- | + | ||
- | < | + | |
- | ypserv[9960]: | + | |
- | </ | + | |
- | + | ||
- | Bisogna **inizializzare il database** del dominio NIS, che verrà tenuto nella directory **''/ | + | |
- | + | ||
- | < | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | Per testare il corretto funzionamento del server si può usare il comando '' | + | |
- | + | ||
- | Per modificare il nome del dominio NIS da // | + | |
- | + | ||
- | < | + | |
- | / | + | |
- | vi / | + | |
- | rm -r / | + | |
- | domainname newdomain.org | + | |
- | / | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | ====== Utenti NIS separati da quelli di sistema ====== | + | |
- | + | ||
- | Invece di usare i file in **''/ | + | |
- | + | ||
- | < | + | |
- | YPSRCDIR = / | + | |
- | YPPWDDIR = / | + | |
- | </ | + | |
- | + | ||
- | Si deve editare anche **''/ | + | |
- | + | ||
- | < | + | |
- | YPPWDDIR=/ | + | |
- | </ | + | |
- | + | ||
- | Per fare in modo che **ypinit** riesca a generare i database necessari bisogna creare i seguenti file nella directory **/ | + | |
- | + | ||
- | ^ group | Inizialmente vuoto. | + | |
- | ^ hosts | Contiene almeno una riga per 127.0.0.1 localhost. | + | |
- | ^ netgroup | + | |
- | ^ passwd | + | |
- | ^ protocols | + | |
- | ^ rpc | Copiato da ''/ | + | |
- | ^ services | + | |
- | ^ shadow | + | |
- | + | ||
- | Dopo aver modificato il contenuto di tali file bisogno aggiornare lo stato del server NIS: | + | |
- | + | ||
- | < | + | |
- | make -C /var/yp | + | |
- | </ | + | |
- | + | ||
- | Per far partecipare gli utenti NIS a gruppi di sistema (ad esempio plugdev, lpadmin, ecc. di Ubuntu) bisogna aggiungere le voci opportune in **''/ | + | |
- | ====== NIS client ====== | + | |
- | + | ||
- | Si installa il pacchetto **nis**. Chiunque voglia essere NIS client (eventualmente anche il NIS server stesso) deve impostare **'' | + | |
- | + | ||
- | ===== Name Service Switch ===== | + | |
- | + | ||
- | La **GNU C Library** fornisce i servizi ad esempio per avere l' | + | |
- | + | ||
- | === Integrazione in modalità " | + | |
- | + | ||
- | Per integrare gli utenti e i gruppi NIS in quelli standard unix si devono modificare i file **''/ | + | |
- | + | ||
- | < | + | |
- | < | + | |
- | < | + | |
- | + | ||
- | Verificare nel file **/ | + | |
- | + | ||
- | === Integrazione in modalità " | + | |
- | + | ||
- | In alternativa si può indicare in **/ | + | |
- | + | ||
- | < | + | |
- | passwd: | + | |
- | group: | + | |
- | shadow: | + | |
- | </ | + | |
- | + | ||
- | :!: **ATTENZIONE**: | + | |
- | + | ||
- | ===== Ricerca del server NIS ===== | + | |
- | + | ||
- | La ricerca del NIS server avviene tramite richieste broadcast sulla rete locale. Per evitarle (potrebbero fallire per regole di firewall) si dichiarano esplicitamente i server in **''/ | + | |
- | + | ||
- | < | + | |
- | # We states NIS servers explicitly to avoid broadcast requests. | + | |
- | ypserver bianca.rigacci.org | + | |
- | ypserver neve.rigacci.org | + | |
- | </ | + | |
- | + | ||
- | Un altro motivo per cui la **richiesta broadcast potrebbe fallire** è se il server NIS è **multihomed** (ha più di una interfaccia di rete), vedi la nota sopra riguardo '' | + | |
- | + | ||
- | L' | + | |
- | ====== NIS slave server ====== | + | |
- | + | ||
- | Configurare l'host che dovrà essere **slave server** come se fosse un NIS client, quindi mettere in **''/ | + | |
- | + | ||
- | Sul **master** modificare **''/ | + | |
- | + | ||
- | Riavviare NIS sullo slave ed eseguire **''/ | + | |
- | + | ||
- | Le repliche dovrebbero avvenire automaticamente dal master allo slave. Nel caso qualcosa vada storto è opportuno configurare un **cron job** sullo **slave** come suggerito dal file nis.debian.howto: | + | |
- | + | ||
- | < | + | |
- | 20 * * * * root / | + | |
- | 40 6 * * * root / | + | |
- | 55 6,18 * * * root / | + | |
- | </ | + | |
- | + | ||
- | ====== Firewall ====== | + | |
- | + | ||
- | Se il server NIS è protetto da firewall che filtra in base al numero di porta si deve avere l' | + | |
- | + | ||
- | In particolare si devono indicare le porte per **ypserv**, **yppasswdd**, FIXME ypbind, fypxfrd. | + | |
- | + | ||
- | In un sistema Debian vedere **''/ | + | |
- | + | ||
- | < | + | |
- | YPSERVARGS=" | + | |
- | YPPASSWDDARGS=" | + | |
- | </ | + | |
- | + | ||
- | ====== Directory home su NFS ====== | + | |
- | + | ||
- | Attenzione al percorso delle home directory, se si sceglie qualcosa di diverso da **''/ | + | |
- | + | ||
- | Il rischio è di incappare in errori " | + | |
- | + | ||
- | Ad esempio se le home directory sono state montate su **''/ | + | |
- | + | ||
- | < | + | |
- | (evince: | + | |
- | `/ | + | |
- | but the parser failed: Failed to open file '/ | + | |
- | </ | + | |
- | + | ||
- | contestualmente il kernel logga: | + | |
- | + | ||
- | < | + | |
- | Jan 9 11:35:02 nisclient kernel: [ 5422.898561] type=1400 audit(1357727702.213: | + | |
- | apparmor=" | + | |
- | name="/ | + | |
- | requested_mask=" | + | |
- | </ | + | |
- | + | ||
- | In questo caso è sufficiente modificare il file **''/ | + | |
- | + | ||
- | < | + | |
- | @{HOMEDIRS}=/ | + | |
- | </ | + | |
- | + | ||
- | ====== Login Time Too Long in Ubuntu 18.04 ====== | + | |
- | + | ||
- | After installing an **Ubuntu 18.04 as a NIS client** with home directories mounted over NFS, we noticed very long times required to complete the login. Even on the tty1 console, there was a **wait time of about 25 seconds** after typing the passowrd, before to get the command line prompt. | + | |
- | + | ||
- | The only apparent error message found in the **syslog** was: | + | |
- | + | ||
- | < | + | |
- | systemd-logind[2133]: | + | |
- | </ | + | |
- | + | ||
- | A nice solution was to **install the nscd package**. The complete story was a bit more complicated, | + | |
- | + | ||
- | * **[[https:// | + | |
- | * **[[https:// | + | |
- | + | ||
- | One user pointed out that the bug affects also what is reported in **/ | + | |
- | + | ||
- | < | + | |
- | IPAddressDeny=any | + | |
- | </ | + | |
- | + | ||
- | ====== NIS users unable to poweroff/ | + | |
- | + | ||
- | We experienced a problem with an **Ubuntu 20.04** Focal Fossa used as **NIS client**: some tasks were inhibited because the user - despite it was **logged-in locally** on the physical machine - it was considered **non interactive** one. | + | |
- | + | ||
- | One symptom can be the following error message when you issue the **reboot** command into a terminal session: | + | |
- | + | ||
- | < | + | |
- | Failed to set wall message, ignoring: Interactive authentication required. | + | |
- | Failed to power off system via logind: Interactive authentication required. | + | |
- | Failed to open initctl fifo: Permission denied | + | |
- | Failed to talk to init daemon. | + | |
- | </ | + | |
- | + | ||
- | Using the command **systemctl reboot -i** does not work either, producing the following error: | + | |
- | </ | + | |
- | + | ||
- | < | + | |
- | ==== AUTHENTICATING FOR org.freedesktop.login1.reboot-multiple-sessions === | + | |
- | Authentication is required for rebooting the system while other users are logged in. | + | |
- | </ | + | |
- | + | ||
- | Choosing to reboot or poweroff from the various **desktop applets** produces instead just a **session close**. | + | |
- | + | ||
- | + | ||
- | It turned out that the **[[https:// | + | |
- | + | ||
- | One solution is to create a file on the NIS client, name **/ | + | |
- | + | ||
- | < | + | |
- | [Allow Printer administration for NIS users] | + | |
- | Identity=unix-group: | + | |
- | Action=org.opensuse.cupspkhelper.mechanism.* | + | |
- | ResultAny=yes | + | |
- | + | ||
- | [Allow halt power-off and reboot for NIS users] | + | |
- | Identity=unix-group: | + | |
- | Action=org.freedesktop.login1.halt*; | + | |
- | ResultAny=yes | + | |
- | </ | + | |
- | + | ||
- | To make the new policy effective, issue the command: | + | |
- | + | ||
- | < | + | |
- | systemctl restart polkit.service | + | |
- | </ | + | |
- | + | ||
- | The syntax of the file is explained into the **[[https:// | + | |
- | + | ||
- | First of all usint the **Identity** option we select the users interested into that policy. For managing printers we required the user to belong to the **lpadmin** and **adm** groups. The first group is the standard Debian group to manage printers, whereas the **adm** group is an arbitrary group assigned to some users by the NIS server (see the page **[[https:// | + | |
- | + | ||
- | For the **Action** part we had to discover the name of the printer management and the poweroff/ | + | |
- | + | ||
- | < | + | |
- | pkaction | grep cupspkhelper | + | |
- | org.opensuse.cupspkhelper.mechanism.all-edit | + | |
- | org.opensuse.cupspkhelper.mechanism.class-edit | + | |
- | org.opensuse.cupspkhelper.mechanism.devices-get | + | |
- | org.opensuse.cupspkhelper.mechanism.job-edit | + | |
- | org.opensuse.cupspkhelper.mechanism.job-not-owned-edit | + | |
- | org.opensuse.cupspkhelper.mechanism.printer-enable | + | |
- | org.opensuse.cupspkhelper.mechanism.printer-local-edit | + | |
- | org.opensuse.cupspkhelper.mechanism.printer-remote-edit | + | |
- | org.opensuse.cupspkhelper.mechanism.printer-set-default | + | |
- | org.opensuse.cupspkhelper.mechanism.printeraddremove | + | |
- | org.opensuse.cupspkhelper.mechanism.server-settings | + | |
- | </ | + | |
- | + | ||
- | For the reboot/ | + | |
- | + | ||
- | < | + | |
- | org.freedesktop.login1.halt | + | |
- | org.freedesktop.login1.hibernate | + | |
- | org.freedesktop.login1.power-off | + | |
- | org.freedesktop.login1.reboot | + | |
- | org.freedesktop.login1.suspend | + | |
- | </ | + | |
- | + | ||
- | each of them have some sub-actions: | + | |
- | + | ||
- | < | + | |
- | pkaction | grep org.freedesktop.login1.power-off | + | |
- | org.freedesktop.login1.power-off | + | |
- | org.freedesktop.login1.power-off-ignore-inhibit | + | |
- | org.freedesktop.login1.power-off-multiple-sessions | + | |
- | </ | + | |
- | + | ||
- | Finally the problem-solving option is **ResultAny**, | + | |
- | + | ||
- | < | + | |
- | ResultAny=no | + | |
- | ResultInactive=no | + | |
- | ResultActive=yes | + | |
- | </ | + |
doc/appunti/linux/sa/nis.1608129780.txt.gz · Last modified: 2020/12/16 15:43 by niccolo