c - Should syslog's openlog() be called before or after seteuid/setegid -


the code have calls openlog() once, before altering effective uid/gid of program (a daemon). security standpoint, or predictability standpoint, calling openlog() after setting effective uid/gid better?

i'm guessing on platforms openlog() open unix socket syslogd? permissions on restrictive allow socket opened system users.

perhaps has specific case openlog requires elevated privileges, found none (and have in mind lynx, used have in compiled-in default features - til 2009). daemons (see this page) not have run root, , use feature.

the book the hacker's handbook: strategy behind breaking , defending networks cites openlog , associated functions vulnerability,

which allow attacker inject "counterfeit" syslog messages log file

given that, ensuring there no weaknesses in application doubly important (since there possibility of becoming agent of other program's intrusion).

so answer seems no, there may no need this, dropping privileges early rule. if find specific case need privileges, point @ reconsider use.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -