Re: run_kannel_box - forcing umask to be 077

Alejandro Guerrieri <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Alan,

Please check my post on how to build a Kannel RPM here:

http://www.blogalex.com/archives/23

You can grab the package kannel-rpm.tar.gz from here:

http://www.blogalex.com/wp-content/uploads/2008/10/kannel-rpm.tar.gz

Extract it and you'll find a "new" init.d script and a sample  
configuration file you can use to be running in no time. It is  
designed to be used with user "kannel". You can of course tweak it to  
suit your needs.

Regards,

Alejandro Guerrieri

El 17/11/2008, a las 11:02 p.m., Alan McNatty escribió:

> Hi Alex,
>
> How about this simple change for default kannel init.d script. Does  
> this look sensible?
>
> If this looks ok I can proceed to remove run_kannel_box from the  
> relevant builds, etc (I guess it can stay in utils and docs).
>
> Cheers,
> Alan
>
> Alexander Malysh wrote:
>> Hi Alan,
>> please stop using run_kannel_box because it's deprecated, just use:
>> /.../bearerbox --daemon
>> /.../smsbox --daemon
>> Thanks,
>> Alex
>> P.S. A new init scripts for debian using --daemon option are highly  
>> welcome...
>> Alan McNatty schrieb:
>>> Hi All,
>>>
>>> We're been on stock standard debian kannel installs for awhile now  
>>> so it's simply a matter of using kannel out of the box these days  
>>> which is great.
>>>
>>> However we've had an ongoing annoyance running kannel on servers  
>>> which we don't maintain. I won't go into the annoying details of  
>>> why but the long and short of it is that we have to do some user  
>>> hopping to tail the logs (you have to be able to become the kannel  
>>> user or root to view the logs, group access is not enough).
>>>
>>> The log permissons seem to be set in run_kannel_box (which is used  
>>> by default), it hard wires the umask (overriding anything set in  
>>> an init.d script or login.defs, etc) to be 077.  My belief here is  
>>> that this sort of thing is an installation / configuration setting  
>>> and shouldn't be dictated in code. But better managed in (for  
>>> example) postinstall scripts and umask setting, etc. Thus making  
>>> it configurable to individual requirements, server set-up, etc.
>>>
>>> Consider the default debian policy (for better or worse) is 022  
>>> but the kannel user gets added with the group 'nogroup' and then  
>>> finally the umask is set to 077 by run_kannel_box for the running  
>>> boxes. Would it not make more sense / be simpler / more  
>>> configurable to be kannel.adm with an init.d umask setting to 077  
>>> (or 027). Note the logrotate script sets the rotated logs to  
>>> kannel.adm with mode 640.
>>>
>>> Ultimately I guess I'm asking if anyone would object if this  
>>> enforcing was removed in an upstream release? All thoughts,  
>>> comments, etc welcome/appreciated.
>>>
>>> Consider (from utils/run_kannel_box.c):
>>>
>>> @@ -384,10 +384,6 @@
>>>        atexit(remove_pidfile);
>>>        write_pidfile();
>>>
>>> -       /* Set the umask to a known value, rather than inheriting
>>> -        * an unknown one. */
>>> -       umask(077);
>>> -
>>>        /* Leave file descriptors 0, 1, and 2 pointing to harmless
>>>         * places, and close all other file descriptors. */
>>>        rebind_standard_streams();
>>>
>>> I am happy to submit some debian patches to get the discussion  
>>> going also.
>>>
>>> Cheers,
>>> Alan
>>>
>
>
> -- 
> Alan McNatty
> Catalyst IT
>
> DDI: +64 (0)4 8032201, or
> TEL: +64 (0)4 4992267
> --- kannel.init	2008-11-18 13:54:39.000000000 +1300
> +++ /etc/init.d/kannel	2008-11-18 13:35:56.000000000 +1300
> @@ -47,33 +47,24 @@
>     start-stop-daemon --start --quiet \
> 	--pidfile $PIDFILES/kannel_bearerbox.pid \
> 	--chuid kannel \
> -	--exec $BOXPATH/run_kannel_box \
> -	-- \
> -	--pidfile $PIDFILES/kannel_bearerbox.pid \
> -	--no-extra-args \
> -	$BOXPATH/bearerbox -v 4 -- $CONF
> +	--exec $BOXPATH/bearerbox -- -v 4 --parachute --daemonize \
> +		--pid-file $PIDFILES/kannel_bearerbox.pid  $CONF
>     sleep 1 # Wait for bearerbox
>     test ! -z $START_WAPBOX && (
>     echo -n " wapbox"
> 	start-stop-daemon --start --quiet \
>     	    --pidfile $PIDFILES/kannel_wapbox.pid \
> 	    --chuid kannel \
> -	    --exec $BOXPATH/run_kannel_box \
> -	    -- \
> -	    --pidfile $PIDFILES/kannel_wapbox.pid \
> -	    --no-extra-args \
> -	    $BOXPATH/wapbox -v 4 -- $CONF
> +	    --exec $BOXPATH/wapbox -- -v 4 --parachute --daemonize \
> +		--pid-file $PIDFILES/kannel_wapbox.pid $CONF
>     )
>     test ! -z $START_SMSBOX && (
>     echo -n " smsbox"
> 	start-stop-daemon --start --quiet \
>     	    --pidfile $PIDFILES/kannel_smsbox.pid \
> 	    --chuid kannel \
> -	    --exec $BOXPATH/run_kannel_box \
> -	    -- \
> -	    --pidfile $PIDFILES/kannel_smsbox.pid \
> -	    --no-extra-args \
> -	    $BOXPATH/smsbox -v 4 -- $CONF
> +	    --exec $BOXPATH/smsbox -- -v 4 --parachute --daemonize \
> +		--pid-file $PIDFILES/kannel_smsbox.pid $CONF
>     )
>     echo "."
>     ;;
> @@ -84,18 +75,18 @@
> 	echo -n " smsbox"
> 	start-stop-daemon --stop --retry 5 --quiet \
>     	    --pidfile $PIDFILES/kannel_smsbox.pid \
> -	    --exec $BOXPATH/run_kannel_box
> +	    --name smsbox
>     )
>     test ! -z $START_WAPBOX && (
> 	echo -n " wapbox"
> 	start-stop-daemon --stop --retry 5 --quiet \
>     	    --pidfile $PIDFILES/kannel_wapbox.pid \
> -	    --exec $BOXPATH/run_kannel_box
> +	    --name wapbox
>     )
>     echo -n " bearerbox"
>     start-stop-daemon --stop --retry 5 --quiet \
>     	--pidfile $PIDFILES/kannel_bearerbox.pid \
> -	--exec $BOXPATH/run_kannel_box
> +	--name bearerbox
>     echo "."
>     ;;
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.