kerberos and nfs4 on linux · § actually kerberos 5 or v § ticket based authentication system...

35
| | isginf Workshop 13.03.18 Stefan Walter 1 Kerberos and NFS4 on Linux

Upload: others

Post on 05-Aug-2020

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

isginf Workshop

13.03.18 Stefan Walter 1

Kerberos and NFS4 on Linux

Page 2: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  First workshop we organize!

§  Background info and three practical labs

§  Goal is to show you how to get NFS4 with

Kerberos working on your Linux systems

! Get coffee and sweets before we start! !

13.03.18 Stefan Walter 2

Welcome

Page 3: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

Kerberos

13.03.18 Stefan Walter 3

Page 4: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Actually Kerberos 5 or V

§  Ticket based authentication system with a central

authentication service

§  Often called Single Sign On (SSO) in business IT language

§  The Key Distribution Center (KDC) as central service

§  Has a database of all user credentials and services

13.03.18 Stefan Walter 4

Kerberos

Page 5: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Each KDC has ist own Realm

§  Active Directory (AD) calls this Domain

§  The ITS AD uses the Realm or Domain is D.ETHZ.CH

§  AD also uses the short name D

§  KDC only reachable from ETH networks

§  Use VPN otherwise

13.03.18 Stefan Walter 5

Kerberos Realm

Page 6: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Principals are unique names in the Realm

§  Active Directory knows three types of principals:

§  Users (hmuster)

§  Computers (server$)

§  Services (service/server)

§  Service principals are typically held by computers

§  All princpals of a user have the same keys

13.03.18 Stefan Walter 6

Kerberos Principals

Page 7: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Token for a principal with a defined life time and purpose

§  Replace a password when accessing a service

§  Security trade-off

§  Two types of tickets

§  Ticket Granting Tickets (TGTs) held by users to obtain Service

Tickets

§  Service Tickets presented to servers to access a service

§  Obtaining a TGT often used for simple authentication

13.03.18 Stefan Walter 7

Kerberos Tickets

Page 8: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  TGTs have two lifetimes

§  Initial lifetime is 10 hours (at ETH)

§  Can be renewed for 7 days (at ETH) without password if still valid

§  Often done in the background (krenew, sssd, Gnome)

§  Service tickets have a 1 hour lifetime (at ETH)

§  TGTs can be forwarded (or not)

§  Important for SSH for passwordless login

13.03.18 Stefan Walter 8

Kerberos Ticket Properties

Page 9: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  A keytab contains the hashed password of a user principal

§  Actually several hashes, one per encryption type

§  AD knows five encryption types, only the two AES variants are secure

§  A keytab can be used instead of a password

§  kinit –k –t keytab

§  Must be kept as secure as the password

§  Keeping a keytab for a user principal only viable on personal systems

13.03.18 Stefan Walter 9

Kerberos Keytab

Page 10: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| | 13.03.18 Stefan Walter 10

Kerberos Protocol Without Crypto

User: hmuster

KDC

Service

1: “I am hmuster”

2: TGT 3: “I want Service”, TGT

4: Service Ticket

5: Service Ticket

Client

Page 11: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| | 13.03.18 Stefan Walter 11

Kerberos Protocol With Basic Crypto

User: hmuster Pass: abc

Khmuster: hash(abc) KKDC, KSVC

KDC

Service

KSVC

1: “I am hmuster”

2: (TTGS+K)Khmuster, (TTGS+K) KKDC 3: (“Service”)K, (TTGS+K) KKDC

4: (TSVC+KS)K, (TSVC+KS) KSVC

5: (“hmuster”)KS,(TSVC+KS) KSVC

Client

Timestamps used in all requests and

answers to prevent replay

attacks.

Page 12: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  PAC in TGTs

§  Holds information about the user at the time of authentication

§  Policies, member groups, etc.

§  Used by MS systems and the ITS NAS, do not disable

§  Joining Computers to the AD §  Typically using an admin account (insecure for network deployment)

§  Secure alternative using web service of isginf

13.03.18 Stefan Walter 12

Active Directory Implementation

Page 13: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Basic Kerberos support

§  kinit, klist, krenew and friends

§  Services that support authenticating against Kerberos

§  SSH, apache, web applications

§  Services that support authentication using tickets §  SSH, NFS4, SMB/CIFS

13.03.18 Stefan Walter 13

Kerberos in Linux

Page 14: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

Lab 1

13.03.18 Stefan Walter 14

Page 15: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Start here:

https://www.isg.inf.ethz.ch/Main/AboutUsActivitiesWorkshopsKerberos

or

https://www.isg.inf.ethz.ch è About us è Activities è Workshops

è Kerberos and NFS4 on Linux Workshop

§  First do all the preparation steps before going to Lab 1

13.03.18 Stefan Walter 15

Preparation

Page 16: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

Login and Kerberos

13.03.18 Stefan Walter 16

Page 17: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Goal: Any login should create a ticket

§  Needed for home directories using NFS4 with Kerberos

§  Need to set up PAM and SSH

§  Tickets should also be renewed

§  sssd does this automatically, except when using SSH

§  Some desktop extensions also do this

13.03.18 Stefan Walter 17

Login In General

Page 18: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  OpenSSH sshd works with Kerberos

§  Create a ticket after login (with password or forwardable ticket)

§  Login using a ticket

§  OpenSSH sshd does not renew tickets

§  Can use krenew to do so

§  Public key authentication does not work with Kerberos!

§  Ugly workaround with keytab possible

13.03.18 Stefan Walter 18

SSH

Page 19: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  PAM must be set up for all logins

§  Graphical login (gdm), SSH

§  Ubuntu and Red Hat distros make it pretty easy

§  Instructions for optional Kerberos authentication available

§  Try to get a ticket for local users

§  Most distros are configured for mandatory Kerberos authentication

§  Local user must use NETHZ user names for this to work

13.03.18 Stefan Walter 19

PAM

Page 20: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

Lab 2

13.03.18 Stefan Walter 20

Page 21: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

NFS4

13.03.18 Stefan Walter 21

With Kerberos, that is why we are here today

Page 22: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Old protocol from 2000 (NFS3 was from 1995...)

§  All traffic over port 2049, client initiated

§  Client does not need special firewall configuration

§  Supports ACLs that are somewhat compatible to Windows

§  Security part of the Standard

§  But: Slower than NFS3, not as wide-spread

13.03.18 Stefan Walter 22

NFS4

Page 23: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  I/O commands contain unprotected uid:gid for access

§  root can become any user...

§  NFS3 only allows IP-based security

§  Which does not work with MAC Authentication Bypass (MAB)

13.03.18 Stefan Walter 23

NFS3 Insecurity

“OK”

“write file as 1000:1000”

NFS3 Server NFS3 Client

Page 24: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Session established with Kerberos (session key!)

§  All accesses are authenticated (+signed) (+encrypted)

§  root can only steal valid tickets on a client

13.03.18 Stefan Walter 24

NFS4 With Kerberos

(“OK”)KS

(“write file”)KS

Kerberos exchange è KS

NFS4 Server NFS4 Client

Page 25: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Mounting a share is simple:

mount –o vers=4,sec=krb5p server.ethz.ch:/share /mnt

§  Three security levels:

§  krb5: Just authentication

§  krbi: Integrity protection but no enctyption

§  krb5p: Integrity protection and encryption ç RECOMMENDED

§  krb5i/p cost ~30-40% load of a CPU core for a 1Gb link

13.03.18 Stefan Walter 25

Mounting NFS4 Shares

Page 26: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  NFS4 transfers user/group names not numeric IDs

§  ID Mapper used on both sides to translate

§  If names different then rename typically done done by client

13.03.18 Stefan Walter 26

NFS4 Identity Mapping

“owner hmuster”

“stat file”

“write as hmuster” nethz:

hmuster

local: hans

hans è hmuster

hans ç hmuster

NFS4 Server NFS4 Client

Page 27: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Identity mapping requires NFS4 domain and realm

§  The NFS4 domain should be ethz.ch.

§  The realm is the AD domain d.ethz.ch.

§  Long names in flight look like this:

§  Users: [email protected]@ETHZ.CH.

§  Groups: D\[email protected].

§  But: Plain Linux servers often use short names

§  [email protected] & [email protected]

13.03.18 Stefan Walter 27

NFS4 Identity Mapping

Page 28: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  man nfs4_acl

§  Querying ACLs:

§  nfs4_getfacl {file}

§  Adding ACLs:

§  nfs_setfacl –a A::[email protected]@ETHZ.CH:R {file}

§  Inheritance:

§  nfs_setfacl –a A:fd:[email protected]@ETHZ.CH:R {dir}

28

NFS4 ACLs

Page 29: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  NFS4 also works without Kerberos (sec=sys)

§  IP-based security just like NFS3

§  Recommended if:

§  Server and client in server rooms

§  Performance is needed

§  Users want to use public key login with SSH

29

NFS4 Without Kerberos

Page 30: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  NFS4 clients must renew locks regularly

§  Clients that are away from the network too long lose locks

§  Locks are reclaimed when online again but files may have changed

§  Linux has the nfs.reclaim_lost_locks parameter

§  If 0 applications get EIO and fail

§  If 1 data corruption may be possible in some cases

§  We recommended to set this to 1

30

NFS4 Locking

Page 31: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  NFS client utilities with:

§  Correctly configured rpc.gssd (does the Kerberos part)

§  Correctly configured ID mapper (plugin required!)

§  NFS4 ACL utilities

§  System keytab (or ticket for root) for mounting

§  Ticket for each user accessing data on a mounted share

§  Any of the previous methods will do (kinit, PAM, ...)

13.03.18 Stefan Walter 31

Client Requirements

Page 32: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

Lab 3

13.03.18 Stefan Walter 32

Page 33: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  For personal systems the info on our site should suffice

§  If you manage systems for your group, contact us for

§  Configuring sssd

§  Joining with real host principal

§  Seting up NSS with LDAP/AD

§  Can all be done already now

§  Does not impact current NFS3 client setup

13.03.18 Stefan Walter 33

Where To Go From Here

Page 34: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

§  Kerberos

https://www.isg.inf.ethz.ch/HelpDesktopsAndLaptopsLinuxKerberos

§  NFS4

https://www.isg.inf.ethz.ch/HelpDesktopsAndLaptopsLinuxNfsV4Server

34

Links

Page 35: Kerberos and NFS4 on Linux · § Actually Kerberos 5 or V § Ticket based authentication system with a central authentication service § Often called Single Sign On (SSO) in business

| |

Questions

and more coffee

13.03.18 Stefan Walter 35