[Home]

Summary:ASTERISK-12447: [patch] set ASTVARRUNDIR=$(localstatedir)/run/asterisk as default path
Reporter:Paul Belanger (pabelanger)Labels:
Date Opened:2008-07-24 17:14:15Date Closed:2009-06-11 21:20:54
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/BuildSystem
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 2009012900_bug13153-nonrootscripts.diff.txt
( 1) Makefile_ASTVARDIRRUN.branch_1.6.patch
( 2) Makefile_ASTVARDIRRUN.branch_1.6.patch2
( 3) Makefile_ASTVARDIRRUN.branch_1.6.patch3
( 4) varrunasterisk.diff.txt
Description:A simple patch to change the default location for ASTVARRUNDIR.

The reason for this revolves around running asterisk as a non-root user.  With this patch, we can setup specific permission on the folder for our non-root user to control.

Without this patch, there is no way to control the permission on the ASTVARRUNDIR path because other application also write to this path.

A conversation on #asterisk-dev with seanbright raised no major objections.

****** ADDITIONAL INFORMATION ******

If there are no major objections to this patch / logic, we'll be submitting follow-up patches to allow a user to install asterisk as non-root as well.
Comments:By: Paul Belanger (pabelanger) 2008-07-24 17:17:47

Should have no problems applying to trunk too.

By: Tzafrir Cohen (tzafrir) 2008-07-24 18:12:31

Small note: on some systems (Ubuntu. Anything else?) /var/run is in a ramdisk and hence is effectively wiped on boot.

So if we make that the default, the init.d script should also verify it exists?

By: Paul Belanger (pabelanger) 2008-07-25 08:55:15

Version 2:
- Add logic to rc.debian.asterisk to make ASTVARRUNDIR if not exists.
- Also removed hardcoded paths from script.

By: Paul Belanger (pabelanger) 2008-09-18 15:52:18

Any objections on getting this? Or is it possible to commit.

By: Michiel van Baak (mvanbaak) 2008-09-21 03:27:58

You should also chown the ASTVARRUNDIR if asterisk is started as non-root user.

By: Tzafrir Cohen (tzafrir) 2008-09-21 03:36:46

Basically:

if [ $AST_USER ] ; then
  chown -R $AST_USER:$AST_GROUP $ASTVARRUNDIR
fi

(and hope nobody sets AST_GROUP without setting AST_USER)

By: Michiel van Baak (mvanbaak) 2008-09-21 04:02:09

if [ $AST_USER]; then
 chown -R $AST_USER: $ASTVARRUNDIR
fi
if [ $AST_GROUP ]; then
 chgrp -R $AST_GROUP $ASTVARRUNDIR
fi

That way it doesn't matter :)



By: Paul Belanger (pabelanger) 2008-11-04 12:30:55.000-0600

Version 3 per comments.

By: Michiel van Baak (mvanbaak) 2008-11-05 01:57:16.000-0600

Thanks.

Tzafrir, you agree as well? Then we can get this in

By: Paul Belanger (pabelanger) 2008-11-05 23:40:53.000-0600

mvanbaak: We may need to add the same logic into the other init.d scripts.  I don't have a problem submitting patches, if the latest one looks good.

PB



By: Michiel van Baak (mvanbaak) 2009-01-29 13:00:33.000-0600

How about this ?
Did it almost the same way, but tweaked a couple of things and also added creating __ASTERISK_VARRUN_DIR__ in safe_asterisk

By: Digium Subversion (svnbot) 2009-02-21 07:13:36.000-0600

Repository: asterisk
Revision: 177852

U   trunk/Makefile
U   trunk/contrib/init.d/rc.archlinux.asterisk
U   trunk/contrib/init.d/rc.debian.asterisk
U   trunk/contrib/scripts/safe_asterisk

------------------------------------------------------------------------
r177852 | mvanbaak | 2009-02-21 07:13:36 -0600 (Sat, 21 Feb 2009) | 18 lines

set ASTVARRUNDIR=$(localstatedir)/run/asterisk as default path

When running asterisk as non-root and without this patch the pidfile wants
to go into /var/run/asterisk.pid. This directory is not writable for
the non-root user and changing permissions is not an option.
Putting it in /var/run/asterisk/asterisk.pid makes it possible
to set permissions on the /var/run/asterisk dir so everything
works as it should be.

Patched committed is based on pabelanger's patch.

(closes issue ASTERISK-12447)
Reported by: pabelanger
Patches:
     2009012900_bug13153-nonrootscripts.diff.txt uploaded by mvanbaak (license 7)

Review: http://reviewboard.digium.com/r/139/

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=177852

By: Digium Subversion (svnbot) 2009-02-21 07:14:51.000-0600

Repository: asterisk
Revision: 177853

_U  branches/1.6.0/

------------------------------------------------------------------------
r177853 | mvanbaak | 2009-02-21 07:14:51 -0600 (Sat, 21 Feb 2009) | 24 lines

Blocked revisions 177852 via svnmerge

........
 r177852 | mvanbaak | 2009-02-21 14:13:35 +0100 (Sat, 21 Feb 2009) | 18 lines
 
 set ASTVARRUNDIR=$(localstatedir)/run/asterisk as default path
 
 When running asterisk as non-root and without this patch the pidfile wants
 to go into /var/run/asterisk.pid. This directory is not writable for
 the non-root user and changing permissions is not an option.
 Putting it in /var/run/asterisk/asterisk.pid makes it possible
 to set permissions on the /var/run/asterisk dir so everything
 works as it should be.
 
 Patched committed is based on pabelanger's patch.
 
 (closes issue ASTERISK-12447)
 Reported by: pabelanger
 Patches:
       2009012900_bug13153-nonrootscripts.diff.txt uploaded by mvanbaak (license 7)
 
 Review: http://reviewboard.digium.com/r/139/
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=177853

By: Digium Subversion (svnbot) 2009-02-21 07:19:41.000-0600

Repository: asterisk
Revision: 177863

_U  branches/1.6.1/

------------------------------------------------------------------------
r177863 | mvanbaak | 2009-02-21 07:19:41 -0600 (Sat, 21 Feb 2009) | 24 lines

Blocked revisions 177852 via svnmerge

........
 r177852 | mvanbaak | 2009-02-21 14:13:35 +0100 (Sat, 21 Feb 2009) | 18 lines
 
 set ASTVARRUNDIR=$(localstatedir)/run/asterisk as default path
 
 When running asterisk as non-root and without this patch the pidfile wants
 to go into /var/run/asterisk.pid. This directory is not writable for
 the non-root user and changing permissions is not an option.
 Putting it in /var/run/asterisk/asterisk.pid makes it possible
 to set permissions on the /var/run/asterisk dir so everything
 works as it should be.
 
 Patched committed is based on pabelanger's patch.
 
 (closes issue ASTERISK-12447)
 Reported by: pabelanger
 Patches:
       2009012900_bug13153-nonrootscripts.diff.txt uploaded by mvanbaak (license 7)
 
 Review: http://reviewboard.digium.com/r/139/
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=177863

By: Michiel van Baak (mvanbaak) 2009-03-05 13:19:25.000-0600

reopen because this appears to be a bug that more ppl are experiencing.
Uploading 1.6.0 patch

By: Michiel van Baak (mvanbaak) 2009-03-05 13:20:07.000-0600

Last file is patch against current 1.6.0 svn

By: Michiel van Baak (mvanbaak) 2009-03-10 16:08:44

This is not going into 1.6.0 nor 1.6.1.
You can use my patch uploaded to this issue or you can use trunk or you can wait for 1.6.2

By: Digium Subversion (svnbot) 2009-06-11 21:20:20

Repository: asterisk
Revision: 200254

U   trunk/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r200254 | seanbright | 2009-06-11 21:20:20 -0500 (Thu, 11 Jun 2009) | 5 lines

Call chgrp instead of chown when setting run directory group ownership.

(issue ASTERISK-12447)
Reported by: pabelanger

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=200254

By: Digium Subversion (svnbot) 2009-06-11 21:20:54

Repository: asterisk
Revision: 200255

_U  branches/1.6.2/
U   branches/1.6.2/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r200255 | seanbright | 2009-06-11 21:20:54 -0500 (Thu, 11 Jun 2009) | 12 lines

Merged revisions 200254 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r200254 | seanbright | 2009-06-11 22:20:19 -0400 (Thu, 11 Jun 2009) | 5 lines
 
 Call chgrp instead of chown when setting run directory group ownership.
 
 (issue ASTERISK-12447)
 Reported by: pabelanger
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=200255