rsync icon indicating copy to clipboard operation
rsync copied to clipboard

PAM Support - Open for Discussion

Open steadytao opened this issue 5 months ago • 3 comments

Requested in 2 places:

  • https://github.com/RsyncProject/rsync/issues/682

  • https://github.com/RsyncProject/rsync/discussions/949

Adding support for PAM seems like the easiest way to get 2FA (and perhaps other desirables) going with rsyncd. Other 2FA alternatives for rsync I'm aware of also encrypt the data payload(yuck) rather than simply the credentials. I may dare take a stab at it myself if it's something rsync maintainers would willingly accept..

I am not completely opposed to the idea. Will leave this open for opinions.

steadytao avatar Jun 05 '26 15:06 steadytao

@steadytao I don't know a lot about PAM, I'd trust your judgement on this

tridge avatar Jun 06 '26 06:06 tridge

@steadytao I don't know a lot about PAM, I'd trust your judgement on this

Will think on what shape may fit rsync best and get back to this.

steadytao avatar Jun 06 '26 10:06 steadytao

I have thought about the shape of this a bit more and I do not think PAM can be treated as a simple drop-in replacement for the current rsyncd secrets-file check. The current daemon auth protocol is a challenge-response where the client sends user digest(password + challenge), not the clear password. Ordinary PAM authentication expects the application to provide authentication tokens through a PAM conversation so full PAM password/2FA auth would imply either a new protocol path or sending clear authentication material over the daemon connection. That is not something I would want to make casual or implicit, especially since raw rsync daemon traffic is not encrypted.

The shape I think could fit rsync first is narrower:

  • keep auth users and secrets file as the authentication mechanism
  • add optional PAM account validation after successful rsyncd authentication
  • make it build-time optional and off by default
  • use a configurable PAM service name, probably defaulting to rsyncd
  • call pam_acct_mgmt() rather than pam_authenticate()
  • document clearly that this is account/policy gating, not 2FA

That would let admins apply PAM account policy such as disabled/expired accounts or host/access restrictions without changing the daemon protocol or exposing clear passwords. Full PAM authentication/2FA is a larger design question. I would keep that separate because it needs protocol, transport, prompt/conversation and compatibility decisions before it even becomes possibly safe to implement.

steadytao avatar Jun 09 '26 05:06 steadytao