Drift/Kerberos

From Programvareverkstedet
Revision as of 13:51, 25 March 2010 by Oysteini (talk | contribs) (seksjon om å lage admin-principal)

Nye kerberos-klienter

Legg til host principal. Dette må gjøres fra en maskin som allerede er kerberisert, f.eks. kvikk som i dette eksemplet. Hvis du ikke har admin-principal, se #Lage admin-principal.

knuta@kvikk ~ $ kadmin -p knuta/admin
kadmin> add --random-key host/berners-lee.pvv.ntnu.no
Max ticket life [1 day]:
Max renewable life [1 week]:
Principal expiration time [never]:
Password expiration time [never]:
Attributes [requires-pre-auth]:

Logg inn på maskinen.

installer heimdal:

berners-lee:~# aptitude install heimdal-clients libpam-krb5

last ned keytab

berners-lee:~# ktutil get -p knuta/admin host/berners-lee.pvv.ntnu.no

Konfigurer pam. Oppsettet kan for eksempel se slik ut på en debian-maskin:

/etc/pam.d/common-account:

account required        pam_krb5.so     minimum_uid=1000
account required        pam_unix.so

/etc/pam.d/common-auth:

auth    sufficient      pam_krb5.so     minimum_uid=1000
auth    required        pam_unix.so nullok_secure

/etc/pam.d/common-password:

# NB! Sjekk denne, den ser litt feil ut!
password        sufficient      pam_krb5.so     minimum_uid=1000
password   required   pam_unix.so nullok obscure md5

/etc/pam.d/common-session:

session optional        pam_krb5.so     minimum_uid=1000
session required        pam_unix.so

Installasjon av KDC

Rediger /etc/hosts så public-ipen (f.eks. 129.241.210.168) peker på hostnavnet til kdc, ellers virker det ikke.

Installer heimdal-clients og heimdal-kdc

aptitude install heimdal-clients og heimdal-kdc

Logg inn lokalt (siden det ikke finnes noen adminbrukere enda)

asgard:~# kadmin -l
kadmin> init PVV.NTNU.NO
Realm max ticket life [unlimited]:
Realm max renewable ticket life [unlimited]:
kadmin: create_random_entry(krbtgt/PVV.NTNU.NO@PVV.NTNU.NO): randkey failed: Principal or policy already exists
kadmin: create_random_entry(kadmin/changepw@PVV.NTNU.NO): randkey failed: Principal or policy already exists
kadmin: create_random_entry(kadmin/admin@PVV.NTNU.NO): randkey failed: Principal or policy already exists
kadmin: create_random_entry(changepw/kerberos@PVV.NTNU.NO): randkey failed: Principal or policy already exists
kadmin: create_random_entry(kadmin/hprop@PVV.NTNU.NO): randkey failed: Principal or policy already exists
kadmin: kadm5_create_principal: Principal or policy already exists

Juster default-innstillingene litt

kadmin> modify -a -disallow-all-tix,requires-pre-auth default
kadmin> get default
            Principal: default@PVV.NTNU.NO
    Principal expires: never
     Password expires: never
 Last password change: 2009-06-16 18:16:07 UTC
      Max ticket life: 1 day
   Max renewable life: 1 week
                 Kvno: 1
                Mkvno: 0
Last successful login: never
    Last failed login: never
   Failed login count: 0
        Last modified: 2009-06-16 18:18:43 UTC
             Modifier: kadmin/admin@PVV.NTNU.NO
           Attributes: requires-pre-auth
             Keytypes: aes256-cts-hmac-sha1-96(pw-salt), aes128-cts-hmac-sha1-96(pw-salt), des3-cbc-sha1(pw-salt), arcfour-hmac-md5(pw-salt)
          PK-INIT ACL: 
              Aliases: 

Lag deg en admin-principal

kadmin> add knuta/admin
Max ticket life [1 day]:
Max renewable life [1 week]:
Principal expiration time [never]:
Password expiration time [never]:
Attributes [requires-pre-auth]:
knuta/admin@PVV.NTNU.NO's Password: 
Verifying - knuta/admin@PVV.NTNU.NO's Password: 

Rediger /etc/heimdal-kdc/kadmind.acl og legg til følgende:

knuta/admin all

Lag symlink (på grunn av en bug i heimdal-kdc):

ln -s /etc/heimdal-kdc/kadmind.acl /var/lib/heimdal-kdc/

Rediger /etc/heimdal-kdc/kdc.conf og sett følgende opsjoner:

[password_quality]
min_length = 8

[kadmin]
default_keys = aes256-cts-hmac-sha1-96:pw-salt aes128-cts-hmac-sha1-96:pw-salt des3-cbc-sha1:pw-salt arcfour-hmac-md5:pw-salt


Lage admin-principal

Logg inn som root på asgard (via SSH fra decibel).

asgard:~# kadmin -l
kadmin> add knuta/admin
Max ticket life [1 day]:
Max renewable life [1 week]:
Principal expiration time [never]:
Password expiration time [never]:
Attributes [requires-pre-auth]:
knuta/admin@PVV.NTNU.NO's Password: 
Verifying - knuta/admin@PVV.NTNU.NO's Password: 

Rediger /etc/heimdal-kdc/kadmind.acl og legg til følgende:

knuta/admin all