mirror of
https://github.com/openwrt/openwrt.git
synced 2026-11-28 16:41:08 +04:00
50-ppp-secrets-mode.sh makes chap-secrets and pap-secrets readable for
the ppp group, so that the jailed pppd can read them. pppd 2.5.4 refuses
a secrets file with any group or other permission while
strict-secrets-files is on, which is the default, and logs "Can't use
/etc/ppp/chap-secrets: secret file has world and/or group access".
After the script neither the jailed pppd nor a pppd running as root,
such as the one pptpd starts, can use the files.
pppd also wants the file owned by root or by its own uid, so one file
cannot serve both. Have the jail setup copy each secrets file to
/var/run/pppd, owned by ppp with mode 0600, the same way it writes the
options file. The chap-secrets and pap-secrets options point the
jailed pppd at the copies, and teardown removes them.
The script now puts the files back to the 0600 root:root mode they are
installed with, so that a pppd running as root can read them again. It
only touches a file in the state it left: owned by root, group ppp,
mode 0640.
A jailed pppd reads the copies made when the interface was set up, so a
change to the secrets files reaches it at the next setup. A pppd running
as root rereads them at every authentication.
The RADIUS servers file stays group readable, because the radius plugin
reads it without the secrets file check.
Fixes: b855f33ea9 ("ppp: run pppd in ujail as an unprivileged user")
Signed-off-by: Semih Baskan <strst.gs@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26319
Signed-off-by: Robert Marko <robimarko@gmail.com>