Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Messing with initscripts for fun and profit
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5720

PostPosted: Fri Feb 03, 2012 3:19 am    Post subject: Messing with initscripts for fun and profit Reply with quote

procps-3.3.2 seems to have broken "sysctl -p" entirely. While I'm sure it's probably been fixed by the time I post this, I found something interesting while trying to fix it locally. I just came across this in "man sysctl":
Code:
PARAMETERS
       --system
              Load settings from all system configuration files.
              /run/sysctl.d/*.conf
              /etc/sysctl.d/*.conf
              /usr/local/lib/sysctl.d/*.conf
              /usr/lib/sysctl.d/*.conf
              /lib/sysctl.d/*.conf
              /etc/sysctl.conf

Not only does it work, it also seems to make 99% of /etc/init.d/sysctl redundant, so I've changed that on my machine to contain this:
Code:
start()
{
   local err

   ebegin "Configuring kernel parameters"

   if ! err=$(sysctl -q --system 2>&1) ; then
      sysctl -q -e --system
   fi

   eend $? "Some errors were encountered: ${err}"
}

Might be worth doing to save a process or two if you're a boot speed freak :)
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1609
Location: U.S.A.

PostPosted: Tue Feb 07, 2012 5:27 am    Post subject: Reply with quote

Makes sense to me. Maybe you should create a bug enhancement request with a unified diff of your modified init script attached as a proposed patch.

I only have one concern. Will the sysctl command implement any file it finds at these named locations regardless of ownership of the files? If so, the only thing preventing a user from injecting arbitrary sysctl directives by creating a file at one of these locations would be the directory permissions.
_________________
patrix_neo wrote:
The human thought: I cannot win.
The ratbrain in me : I can only go forward and that's it.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5720

PostPosted: Tue Feb 07, 2012 11:47 am    Post subject: Reply with quote

The reason I haven't opened a bug is that it's a --long-option which means probably a GNU-only extension. AFAIK openrc should only be using POSIX stuff.

It doesn't seem to care about file ownership, neither does the current initscript. If your system's at risk of random users being able to write to system directories then I'd say /sbin is a bigger problem than /etc/sysctl.d.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum