netatalk.io

Netatalk 4.5.0

Authentication

AFP authentication basics

Apple chose a flexible model called “User Authentication Methods” (UAMs) for authentication between AFP clients and servers. An AFP client connecting to an AFP server first requests the list of UAMs that the server supports, then chooses the one with the strongest encryption that the client also supports.

Several UAMs have been developed by Apple over the years, and some by third-party developers.

UAMs supported by Netatalk

Netatalk supports the following UAMs by default:

With Kerberos support enabled at compile time, Netatalk also supports:

You can configure which UAMs to activate by setting uam list in the Global section. afpd logs which UAMs it activates and reports any problems in either netatalk.log or syslog at startup. asip-status can also query the available UAMs of AFP servers.

Having a specific UAM available on the server does not automatically mean that a client can use it. Client-side support is also required. For older Macintosh clients running Classic Mac OS, DHCAST128 support has been available since AppleShare client 3.8.x.

On macOS, there are client-side techniques to make the AFP client more verbose, allowing you to observe the UAM negotiation process. See this hint.

Which UAMs to activate?

The choice depends primarily on your needs and the clients you need to support. If your network consists exclusively of macOS (Mac OS X) clients, DHX2 provides strong encryption with PAM (or system password database) integration.

If you want stronger security and don’t mind the extra maintenance overhead of a separate verifier file, SRP is the best choice.

This is the strongest form of authentication available for Mac OS 8/9 clients.

For a more detailed overview of the technical implications of the different UAMs, see Apple’s File Server Security documentation.

Password storage

Randnum and SRP do not use system passwords directly. They both rely on separate files managed with afppasswd:

The key file must contain exactly 16 hexadecimal characters, such as 0123456789ABCDEF, with an optional trailing newline. Generate a fresh random key for each server instead of reusing this example value.

Using different authentication backends

Some UAMs support different authentication backends, namely uams_clrtxt.so, uams_dhx.so, and uams_dhx2.so. They can use either classic UNIX passwords from /etc/passwd (/etc/shadow) or PAM if the system supports it. uams_clrtxt.so can be symlinked to either uams_passwd.so or uams_pam.so, uams_dhx.so to uams_dhx_passwd.so or uams_dhx_pam.so, and uams_dhx2.so to uams_dhx2_passwd.so or uams_dhx2_pam.so.

If Netatalk’s UAM folder (by default /etc/netatalk/uams/) looks like this, then you are using PAM; otherwise you are using classic UNIX passwords:

uams_clrtxt.so -> uams_pam.so
uams_dhx.so -> uams_dhx_pam.so
uams_dhx2.so -> uams_dhx2_pam.so

The main advantage of PAM is that it integrates Netatalk into centralized authentication scenarios, such as LDAP, NIS, and similar systems. Keep in mind that the security of your users’ login credentials in such scenarios also depends on the encryption strength of the UAM in use.

Netatalk UAM overview table

An overview of the officially supported UAMs on Macs.

UAM No User Auth Cleartxt Passwrd RandNum Exchange DHCAST128 DHX2 Kerberos V SRP
Password length guest access max 8 chars max 8 chars max 64 chars max 255 chars Kerberos tickets max 255 chars
Client support built-in into all Mac OS versions built-in in all Mac OS versions except 10.0; deprecated in 10.7 and later built-in into almost all Mac OS versions; deprecated in 10.7 and later built-in since AppleShare client 3.8.4, available as a plug-in for 3.8.3; deprecated in 10.7 and later built-in since Mac OS X 10.2 built-in since Mac OS X 10.2 built-in since Mac OS X 10.7
Encryption Enables guest access without authentication between client and server. Password will be sent in cleartext over the wire. Just as bad as it sounds, therefore avoid at all costs. 8-byte random numbers are sent over the wire, comparable with DES, 56 bits. Vulnerable to offline dictionary attack. Requires separately stored server-side passwords. Password will be encrypted with 128 bit CAST, user will be authenticated against the server but not vice versa. Therefore weak against man-in-the-middle attacks. Password will be encrypted with 128 bit CAST in CBC mode. User will be authenticated against the server but not vice versa. Therefore weak against man-in-the-middle attacks. Password is not sent over the network. Due to the service principal detection method, this authentication method is vulnerable to man-in-the-middle attacks. Password is never sent; SRP uses a verifier and mutual proofs (M1/M2) to authenticate both client and server, providing protection against man‑in‑the‑middle attacks.
Server support uams_guest.so uams_clrtxt.so uams_randnum.so uams_dhx.so uams_dhx2.so uams_gss.so uams_srp.so
Password storage None Either system auth or PAM Separate afppasswd file (DES-encrypted) Either system auth or PAM Either system auth or PAM At the Kerberos Key Distribution Center Separate afppasswd.srp verifier file

See the Apple Support knowledge base article on Connecting to legacy AFP services on how to enable deprecated legacy UAM in macOS. It is not recommended that you do this in production environments, however, since this may expose AFP user credentials in network traffic.

Note that a number of open-source and other third-party AFP clients exist. Refer to their documentation for a list of supported UAMs.

Save and change passwords

Netatalk can be configured to allow clients to save or change their passwords on the server. The save password option in the Global section of afp.conf enables this feature, but the AFP client must also support and honor this flag.

To allow clients to change their passwords, set the set password option. This depends on the UAM in use and is not supported by all of them. Notably, the PAM-based UAMs support this feature, while those based on classic UNIX passwords do not.