Florian Schlichting <[email protected]> writes: >> > Then I suggest: >> >> > if (!S_ISREG(buf.st_mode) || (buf.st_mode & 0137) != 0 >> > || ((buf.st_mode & 0040) != 0 && buf.st_gid != getgid())) { >> > syslog(L_ERROR, "bad ownership or permissions on private key" >> > " '%s': private key must be mode 640 at most, and readable by >> > the news " >> > "group only", cert_file); > ^^^^^^^^^ > this must be key_file, by the way, the error message "bad ownership or > permissions on private key '/etc/news/cert.pem'" is rather confusing...
> And may I request that my key.pem may be a symlink pointing to the > actual key file? Currently, this won't work as a symlink's permissions > will always be lrwxrwxrwx. We should probably be doing a stat, not an lstat. The permissions of the symlink are irrelevant; we only care about the permissions of the underlying file. And actually, given the S_ISREG() check, the effect of the current check using lstat is to prohibit symlinking the key file regardless of the permissions on the symlink. That's probably over-restrictive; I don't see a need to do that. Just changing to stat() there would allow symlinks and check the permissions of the underlying file. -- Russ Allbery ([email protected]) <http://www.eyrie.org/~eagle/> -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

