rc.news: checking whether we run as the news user

Julien ÉLIE julien at trigofacile.com
Wed Sep 24 20:12:26 UTC 2014


Hi all,

In the rc.news man page, there is a BUGS section that mentions:

     "Running rc.news start as root is never the right thing to do,
     so we should at minimum check for this and error, or perhaps
     change effective user ID."


I suggest to check whether rc.news is run as another user ID than the 
"news" user (in all cases, be it start or stop).  If it is the case, we 
exit with the error:

     rc.news should be run as the "news" user

where "news" is in fact the value of the runasuser keyword in inn.conf 
(the real news user).
I don't think we should change effective user ID (if root).  It might 
hide another issue.



Would this behaviour be OK to do for INN 2.6.0 (CURRENT)?
I ask because some of you may know use cases where rc.news should be run 
as root or another user than the news user.



P.-S.:  To be as portable as possible, we should retrieve the current 
user in a way similar to what we already do in our Makefile.global:
     (whomi || perl -e 'print scalar getpwuid($>), "\n"') 2>/dev/null

-- 
Julien ÉLIE

« Pour Rome, la direction importe peu, car tous les chemins y
   mènent. » (Astérix)


More information about the inn-workers mailing list