Accesso alla Home directory

English version below

 

A partire dal 21 marzo 2008 sono cambiate le modalità di accesso sulle stazioni di lavoro Linux alle “home” ed eventualmente ad altri share condivisi. Tali modifiche non incideranno sugli altri servizi informatici (posta, web, accesso Windows, ecc.).
Per aumentare il livello di sicurezza nell'accesso ai file sono stati integrati i protocolli già esistenti: quello di condivisione dei file (NFS) e quello di autenticazione (Kerberos V). In tal modo solo l'utente dotato di credenziali può accedere ai file, specificando ovviamente la password.

Come funziona il protocollo Kerberos?
Ogni utente del DEI possiede delle credenziali presso il database Kerberos (la password).
Ci sono alcuni servizi che necessitano di credenziali valide per poter essere utilizzati: login ad una stazione Linux, accesso ai file via NFS, ecc.

Nel momento della login ad esempio, specificando la password si ottiene quello che viene chiamato “ticket”, ossia delle credenziali che hanno una durata generalmente di 24 ore.
Attraverso questo ticket, per tutto il tempo di validità, l'utente può accedere ad altri servizi che hanno bisogno di queste credenziali senza dover reinserire la password per riottenerle.
Un beneficio del protocollo Kerberos è che la password non passa mai “in chiaro” in rete. Nel momento in cui scade la validità, i servizi non sono più disponibili. Il ticket può essere rinnovato, senza dover ridigitare la password, fino ad un massimo di 14 giorni, per permettere per esempio di lanciare simulazioni di lunga durata.

Si ricorda che comunque i file e le directory devono essere comunque protetti correttamente dall'accesso altrui tramite il comando chmod.
Di seguito vengono presentate alcune situazioni tipo e i comandi relativi:

Login grafico in una stazione Linux del dominio DEI
Una volta collegati viene automaticamente creato un ticket valido.
Problema: se la sessione resta aperta più di un giorno il ticket scade e non si accede piu' alla home directory.
Soluzione: in un terminale dare il comando “kinit” e digitare la password, oppure attivare un programma grafico quale krb5-auth-dialog che appare automaticamente nella sessione alla scadenza del ticket.


Login remoto ssh via terminale ad una stazione Linux del dominio DEI
Una volta collegati viene automaticamente creato un ticket valido.
Problema: se la sessione resta aperta più di un giorno il ticket scade e non si accede piu' alla home directory.
Soluzione: nel terminale remoto dare il comando kinit e digitare la password.


Lancio di una simulazione che deve durare più giorni
A partire da una sessione autenticata si esegue il comando:

 

kinit -r 14d

che richiede un ticket rinnovabile di 14 giorni.

Successivamente si lancia un programma che rinnova in automatico il ticket:

krenew -K NumeroMinuti -b

dove NumeroMinuti e' il tempo ogni quanto viene rinnovato in automatico il ticket (basta specificare, ad esempio, 240 minuti per rinnovare dopo 4 ore)


Lancio di una simulazione che deve durare più giorni su un server batch (tipo svrfirb.dei.unipd.it)
Le istruzioni sono le stesse di prima solo che in questo tipo di server la simulazione può girare su una macchina diversa dalla quale è stata lanciata (master). A partire dalla sessione autenticata si eseguono i comandi:

 

kinit -r 14d -c ~/.ticket
export KRB5CCNAME=~/.ticket
krenew -k ~/.ticket -K NumeroMinuti -b

Per propria comodità si può costruire uno script del tipo:

#!/bin/bash
krenew -k ~/.ticket -K NumeroMinuti -b 
export KRB5CCNAME=~/.ticket
“comando della simulazione"

e lo si lancia con bsub.

 

___________________________________________________________

ENGLISH VERSION

 

Starting from March 21, 2008, the access methods to “home” directories and possibly other shared resources on Linux workstations have changed.
These changes will not affect other IT services (email, web, Windows access, etc.).

To increase the level of security when accessing files, the already existing protocols have been integrated: the file sharing protocol (NFS) and the authentication protocol (Kerberos V). Like this, only users with valid credentials can access the files, obviously by specifying their password.

How does the Kerberos protocol work?
Each DEI user has credentials that are stored in the Kerberos database (i.e., their password).
Some services require valid credentials to be used: logging into a Linux workstation, accessing files via NFS, etc.

When logging in, for example, by entering the password, the user obtains what's called a “ticket”, which is a credential that is typically valid for 24 hours.
Using this ticket, for as long as it is valid, the user can access other services that require such credentials without needing to re-enter the password.
One benefit of the Kerberos protocol is that the password is never transmitted “in clear text” over the network.
Once the ticket expires, the services become unavailable. The ticket can be renewed without retyping the password, for up to 14 days, to allow for long-running simulations, for example.

Please note that files and directories must still be properly protected from unauthorized access using the chmod command.
Below are some typical situations and related commands:

Graphical login on a Linux workstation within the DEI domain
Once logged in, a valid ticket is automatically created.
Issue: If the session remains open for more than a day, the ticket expires and access to the home directory is lost.
Solution: In a terminal, run the command kinit and enter your password, or activate a graphical program like krb5-auth-dialog, which will automatically appear in the session when the ticket expires.


Remote SSH login via terminal to a Linux workstation in the DEI domain
Once connected, a valid ticket is automatically created.
Issue: If the session remains open for more than a day, the ticket expires and access to the home directory is lost.
Solution: In the remote terminal, run the command kinit and enter your password.


Running a simulation that needs to last several days
From an authenticated session, run the following command:

kinit -r 14d

This requests a renewable ticket valid for 14 days.

Then, launch a program that automatically renews the ticket:

krenew -K NumberOfMinutes -b

where NumberOfMinutes is how often the ticket should be renewed automatically (for example, specify 240 minutes to renew every 4 hours).


Running a long simulation on a batch server (e.g., svrfirb.dei.unipd.it)
The instructions are the same as before, but in this type of server, the simulation may run on a different machine than the one it was launched from (master node). From an authenticated session, run the following commands:

kinit -r 14d -c ~/.ticket
export KRB5CCNAME=~/.ticket
krenew -k ~/.ticket -K NumberOfMinutes -b

For convenience, you can create a script like this:

#!/bin/bash
krenew -k ~/.ticket -K NumberOfMinutes -b
export KRB5CCNAME=~/.ticket
"simulation command"

and launch it using bsub.