diff options
author | Stefan Knoblich <stkn@gentoo.org> | 2005-05-15 21:46:23 +0000 |
---|---|---|
committer | Stefan Knoblich <stkn@gentoo.org> | 2005-05-15 21:46:23 +0000 |
commit | 85b46ac95b1e4795a8ab98f582f25f7fbdee2317 (patch) | |
tree | 10c6c6c43bae02c3ecd5db1f8e0c13a4f1e7e3ad /net-misc | |
parent | gcc -> toolchain-funcs conversion (diff) | |
download | historical-85b46ac95b1e4795a8ab98f582f25f7fbdee2317.tar.gz historical-85b46ac95b1e4795a8ab98f582f25f7fbdee2317.tar.bz2 historical-85b46ac95b1e4795a8ab98f582f25f7fbdee2317.zip |
Added initgroups support to asterisk, this fixes realtime priority support (-p). Fixed the init script, users will have to run ebuild config to change permissions on the filesystem, warning messages have been added.
Package-Manager: portage-2.0.51.19
Diffstat (limited to 'net-misc')
-rw-r--r-- | net-misc/asterisk/ChangeLog | 11 | ||||
-rw-r--r-- | net-misc/asterisk/Manifest | 49 | ||||
-rw-r--r-- | net-misc/asterisk/asterisk-1.0.7-r1.ebuild | 87 | ||||
-rw-r--r-- | net-misc/asterisk/files/1.0.0/asterisk-1.0.7-initgroups.diff | 64 | ||||
-rw-r--r-- | net-misc/asterisk/files/1.0.0/asterisk.confd.sec | 12 | ||||
-rw-r--r-- | net-misc/asterisk/files/1.0.0/asterisk.rc6.sec | 30 |
6 files changed, 195 insertions, 58 deletions
diff --git a/net-misc/asterisk/ChangeLog b/net-misc/asterisk/ChangeLog index cb544f272476..062b0b47e817 100644 --- a/net-misc/asterisk/ChangeLog +++ b/net-misc/asterisk/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for net-misc/asterisk # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/ChangeLog,v 1.53 2005/05/11 23:27:57 stkn Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/ChangeLog,v 1.54 2005/05/15 21:46:23 stkn Exp $ + + 15 May 2005; Stefan Knoblich <stkn@gentoo.org> + +files/1.0.0/asterisk-1.0.7-initgroups.diff, files/1.0.0/asterisk.confd.sec, + files/1.0.0/asterisk.rc6.sec, asterisk-1.0.7-r1.ebuild: + Added initgroups support to asterisk instead of using start-stop-daemon's + --chguid because that one broke running asterisk with realtime priority (-p). + Fixed init script for initgroups. Users will have to use ebuild config after + updating asterisk to fix permissions on the filesystem, warning messages have + been added. 12 May 2005; Stefan Knoblich <stkn@gentoo.org> +files/1.0.0/asterisk-1.0.7-scripts.diff, asterisk-1.0.7-r1.ebuild: diff --git a/net-misc/asterisk/Manifest b/net-misc/asterisk/Manifest index 8b4a3572082a..e61171dff8b1 100644 --- a/net-misc/asterisk/Manifest +++ b/net-misc/asterisk/Manifest @@ -1,38 +1,39 @@ -MD5 1ea090ea65964e37a832a7a31c8c48e3 asterisk-1.0.7-r1.ebuild 13188 +MD5 af6efb0e1e4f80dc12bb5f1650c2d9a9 ChangeLog 10152 +MD5 b551ce4bb8eb4a03cb0e551c279ab02c asterisk-0.9.0.ebuild 3161 +MD5 6201814863e121c6cae9a8209b0b9a27 asterisk-1.0.0.ebuild 3394 MD5 c870e11d5cfc72f46a1290e769a491cc asterisk-1.0.1.ebuild 5576 -MD5 443437a5d15fe53ff78a0f93004a04f4 asterisk-1.0.7.ebuild 9725 -MD5 c7b911a01a3bd822055a9ec010dfbae1 asterisk-1.0.5.ebuild 6314 -MD5 44cf247f04cc83413fcb40ed59d0847a metadata.xml 248 +MD5 465f444622b40abb34bbb311b571ed24 asterisk-1.0.2.ebuild 5585 +MD5 0a9506b97103f05fdd15df48db9b3506 asterisk-1.0.3-r1.ebuild 5865 MD5 9af7f719e9db949d2d7870e01cd6faa1 asterisk-1.0.3.ebuild 5845 MD5 867bae5d74f56337feec21310c14ecca asterisk-1.0.5-r1.ebuild 7170 -MD5 0a9506b97103f05fdd15df48db9b3506 asterisk-1.0.3-r1.ebuild 5865 -MD5 6201814863e121c6cae9a8209b0b9a27 asterisk-1.0.0.ebuild 3394 -MD5 0e212aad308e32fa1762909de26a2981 ChangeLog 9636 -MD5 b551ce4bb8eb4a03cb0e551c279ab02c asterisk-0.9.0.ebuild 3161 -MD5 465f444622b40abb34bbb311b571ed24 asterisk-1.0.2.ebuild 5585 +MD5 c7b911a01a3bd822055a9ec010dfbae1 asterisk-1.0.5.ebuild 6314 +MD5 44cf247f04cc83413fcb40ed59d0847a metadata.xml 248 MD5 1f0cf9681436a84a7be9a324e8375ef3 asterisk-1.0.6.ebuild 8622 -MD5 4fa7ca8f47238dee3484dae5fb8f294c files/digest-asterisk-1.0.3-r1 213 -MD5 1bb1cf45f134eeae6adcc7dc17b6b5db files/digest-asterisk-1.0.0 141 +MD5 443437a5d15fe53ff78a0f93004a04f4 asterisk-1.0.7.ebuild 9725 +MD5 5a504aac8e179ef4d4d048ba2e1855c9 asterisk-1.0.7-r1.ebuild 14619 MD5 0243bdde80a5b8433cf93c306458dfd8 files/digest-asterisk-0.9.0 67 -MD5 cafa114e45cae0cc2dd505d1deaa7184 files/digest-asterisk-1.0.7-r1 210 +MD5 1bb1cf45f134eeae6adcc7dc17b6b5db files/digest-asterisk-1.0.0 141 MD5 b97c969a083704e6f8c8c9b07d56db3b files/digest-asterisk-1.0.1 213 -MD5 d7a0d59fff2e991e7b091341893ec554 files/digest-asterisk-1.0.7 210 MD5 5474694f8ec88752718f88d84e587468 files/digest-asterisk-1.0.2 213 -MD5 f399592939cd5b43b7851e20744a108e files/digest-asterisk-1.0.6 210 MD5 4fa7ca8f47238dee3484dae5fb8f294c files/digest-asterisk-1.0.3 213 -MD5 bfa11ecbbe1f5f9ecc73e121855fcf48 files/digest-asterisk-1.0.5-r1 213 +MD5 4fa7ca8f47238dee3484dae5fb8f294c files/digest-asterisk-1.0.3-r1 213 MD5 08f910cf85384f1d08c01a439cb3634e files/digest-asterisk-1.0.5 213 -MD5 6a50db2ee46d4139128d0c4225ac071f files/1.0.0/asterisk-uclibc-dns.diff 433 +MD5 bfa11ecbbe1f5f9ecc73e121855fcf48 files/digest-asterisk-1.0.5-r1 213 +MD5 f399592939cd5b43b7851e20744a108e files/digest-asterisk-1.0.6 210 +MD5 d7a0d59fff2e991e7b091341893ec554 files/digest-asterisk-1.0.7 210 +MD5 cafa114e45cae0cc2dd505d1deaa7184 files/digest-asterisk-1.0.7-r1 210 +MD5 5b7ebf09c4c7988bd16cadaaad08d8f6 files/0.9.0/asterisk.confd 290 +MD5 da4846c3843d6f94b278c687d3b2ad21 files/0.9.0/asterisk.rc6 465 +MD5 309907bd4419c2a5308d2bcaf119e590 files/1.0.0/asterisk.rc6.sec 1217 +MD5 f0fe0308b464c71f83cf2483388c8058 files/1.0.0/asterisk-1.0.1-linux26.diff 474 MD5 f20e5b869d5e221194187dd7f504d38b files/1.0.0/asterisk-1.0.5-astcfg-0.0.2.diff 5829 -MD5 ab552fbbe803766b5291d61942dbcd9f files/1.0.0/res_perl-1.0.7-bristuff-0.2.0.diff 860 MD5 a839d8b6b55e3b6ad17b9a7f4be2e6ba files/1.0.0/asterisk-1.0.5-hppa.patch 909 +MD5 93d2e0533a32a38e21f99f278f635266 files/1.0.0/asterisk-1.0.5-speex.diff 1214 +MD5 08d718c04e911f465f867577d649d204 files/1.0.0/asterisk-1.0.5-uclibc-dns.diff 304 +MD5 6a50db2ee46d4139128d0c4225ac071f files/1.0.0/asterisk-uclibc-dns.diff 433 MD5 85e291d6eb70a24fdc82469ed53bfe54 files/1.0.0/asterisk.confd 283 MD5 920f8ae54f895cfa46a8a037c865e59a files/1.0.0/asterisk.rc6 517 -MD5 f0fe0308b464c71f83cf2483388c8058 files/1.0.0/asterisk-1.0.1-linux26.diff 474 -MD5 08d718c04e911f465f867577d649d204 files/1.0.0/asterisk-1.0.5-uclibc-dns.diff 304 -MD5 edf12407ea851d46ced85276149aedf1 files/1.0.0/asterisk.rc6.sec 760 +MD5 ab552fbbe803766b5291d61942dbcd9f files/1.0.0/res_perl-1.0.7-bristuff-0.2.0.diff 860 +MD5 aa9927c6c7b3e4c761adb982ff94b540 files/1.0.0/asterisk.confd.sec 526 MD5 78b01073a94beded6a86a2b45409df43 files/1.0.0/asterisk-1.0.7-scripts.diff 1629 -MD5 e82caefb3c418cc276a2f5c253852b10 files/1.0.0/asterisk.confd.sec 419 -MD5 93d2e0533a32a38e21f99f278f635266 files/1.0.0/asterisk-1.0.5-speex.diff 1214 -MD5 5b7ebf09c4c7988bd16cadaaad08d8f6 files/0.9.0/asterisk.confd 290 -MD5 da4846c3843d6f94b278c687d3b2ad21 files/0.9.0/asterisk.rc6 465 +MD5 0c31aac944f4fdff2b26b446d0d0eef4 files/1.0.0/asterisk-1.0.7-initgroups.diff 1826 diff --git a/net-misc/asterisk/asterisk-1.0.7-r1.ebuild b/net-misc/asterisk/asterisk-1.0.7-r1.ebuild index c2a380cbb114..aa307deda547 100644 --- a/net-misc/asterisk/asterisk-1.0.7-r1.ebuild +++ b/net-misc/asterisk/asterisk-1.0.7-r1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/asterisk-1.0.7-r1.ebuild,v 1.4 2005/05/11 23:27:57 stkn Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/asterisk-1.0.7-r1.ebuild,v 1.5 2005/05/15 21:46:23 stkn Exp $ IUSE="alsa doc gtk mmx mysql pri zaptel uclibc debug postgres vmdbmysql vmdbpostgres bri hardened speex resperl" @@ -65,9 +65,13 @@ pkg_setup() { ewarn " http://bugs.gentoo.org/show_bug.cgi?id=88732" ewarn " http://www.voip-info.org/wiki-Asterisk+non-root" ewarn - eerror "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - eerror "! NEW PERMISSIONS WILL BE AUTOMATICALLY SET DURING INSTALLATION !" - eerror "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + if has_version "net-misc/asterisk"; then + echo + eerror "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + eerror "! PLEASE RUN THE FOLLOWING COMMAND AFTER UPDATING ASTERISK: !" + eerror "! \"ebuild /usr/portage/net-misc/asterisk/asterisk-${PVR}.ebuild config\" !" + eerror "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + fi echo einfo "Press Ctrl+C to abort" echo @@ -265,7 +269,13 @@ src_unpack() { sed -i -e "s:^\(ASTVARRUNDIR=\).*:\1\$(INSTALL_PREFIX)/var/run/asterisk:" \ Makefile + # fix contrib scripts for non-root epatch ${FILESDIR}/1.0.0/${P}-scripts.diff + + # add initgroups support to asterisk, this is needed + # to support supplementary groups for the asterisk + # user (start-stop-daemons --chguid breaks realtime priority support) + epatch ${FILESDIR}/1.0.0/${P}-initgroups.diff } src_compile() { @@ -427,31 +437,58 @@ pkg_postinst() { ewarn " http://bugs.gentoo.org/show_bug.cgi?id=88732" ewarn " http://www.voip-info.org/wiki-Asterisk+non-root" echo + if has_version "net-misc/asterisk"; then + eerror "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + eerror "! NOW RUN !" + eerror "! \"ebuild /usr/portage/net-misc/asterisk/asterisk-${PVR}.ebuild config\" !" + eerror "! TO FIX PERMISSION ON THE FILESYSTEM !" + eerror "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + fi echo +} - # - # Change permissions and ownerships of asterisk - # directories and files - # - einfo "Fixing permissions and ownerships" - # fix permissions - for x in spool run lib log; do - chown -R asterisk:asterisk ${ROOT}/var/${x}/asterisk - chmod -R u=rwX,g=rX,o= ${ROOT}/var/${x}/asterisk - done - chown -R root:asterisk ${ROOT}/etc/asterisk - chmod -R u=rwX,g=rX,o= ${ROOT}/etc/asterisk +pkg_config() { + local x + + ewarn "This will change permissions of asterisk related files:" + einfo + einfo "- Permissions of /etc/asterisk will be changed to root:asterisk" + einfo " 750 (rwxr-x--- directories) / 640 (rw-r----- files)" + einfo + einfo "- Permissions of /var/{log,lib,run,spool}/asterisk will be changed" + einfo " to asterisk:asterisk 750 / 640" + einfo + ewarn "Continue [Y/n]?" + read x - if [[ -z "$(grep "/var/run/asterisk" ${ROOT}/etc/asterisk/asterisk.conf)" ]] + if [[ "$x" = "y" ]] || [[ "$x" = "Y" ]] || [[ -z "$x" ]] then - einfo "Fixing astrundir in ${ROOT}/etc/asterisk/asterisk.conf" - mv -f ${ROOT}/etc/asterisk/asterisk.conf \ - ${ROOT}/etc/asterisk/asterisk.conf.bak - sed -e "s:^\(astrundir[\t ]=>\).*:\1 /var/run/asterisk:" \ - ${ROOT}/etc/asterisk/asterisk.conf.bak >\ - ${ROOT}/etc/asterisk/asterisk.conf - einfo "Backup has been saved as ${ROOT}/etc/asterisk/asterisk.conf.bak" + # + # Change permissions and ownerships of asterisk + # directories and files + # + einfo "Fixing permissions and ownerships" + # fix permissions + for x in spool run lib log; do + chown -R asterisk:asterisk ${ROOT}/var/${x}/asterisk + chmod -R u=rwX,g=rX,o= ${ROOT}/var/${x}/asterisk + done + + chown -R root:asterisk ${ROOT}/etc/asterisk + chmod -R u=rwX,g=rX,o= ${ROOT}/etc/asterisk + + if [[ -z "$(grep "/var/run/asterisk" ${ROOT}/etc/asterisk/asterisk.conf)" ]] + then + einfo "Fixing astrundir in ${ROOT}/etc/asterisk/asterisk.conf" + mv -f ${ROOT}/etc/asterisk/asterisk.conf \ + ${ROOT}/etc/asterisk/asterisk.conf.bak + sed -e "s:^\(astrundir[\t ]=>\).*:\1 /var/run/asterisk:" \ + ${ROOT}/etc/asterisk/asterisk.conf.bak >\ + ${ROOT}/etc/asterisk/asterisk.conf + einfo "Backup has been saved as ${ROOT}/etc/asterisk/asterisk.conf.bak" + fi + else + einfo "Aborted!" fi } - diff --git a/net-misc/asterisk/files/1.0.0/asterisk-1.0.7-initgroups.diff b/net-misc/asterisk/files/1.0.0/asterisk-1.0.7-initgroups.diff new file mode 100644 index 000000000000..98ae11aa180c --- /dev/null +++ b/net-misc/asterisk/files/1.0.0/asterisk-1.0.7-initgroups.diff @@ -0,0 +1,64 @@ +--- asterisk-1.0.7/asterisk.c.orig 2005-05-12 21:33:21.000000000 +0200 ++++ asterisk-1.0.7/asterisk.c 2005-05-12 21:38:33.000000000 +0200 +@@ -1581,7 +1581,9 @@ int main(int argc, char *argv[]) + int num; + char *buf; + char *runuser=NULL, *rungroup=NULL; +- struct pollfd silly_macos[1]; ++ struct pollfd silly_macos[1]; ++ gid_t runasgid = 0; ++ uid_t runasuid = 0; + + /* Remember original args for restart */ + if (argc > sizeof(_argv) / sizeof(_argv[0]) - 1) { +@@ -1701,17 +1703,9 @@ int main(int argc, char *argv[]) + ast_log(LOG_WARNING, "No such group '%s'!\n", rungroup); + exit(1); + } +- if (setgid(gr->gr_gid)) { +- ast_log(LOG_WARNING, "Unable to setgid to %d (%s)\n", gr->gr_gid, rungroup); +- exit(1); +- } +- if (option_verbose) +- ast_verbose("Running as group '%s'\n", rungroup); ++ runasgid = gr->gr_gid; + } + +- if (set_priority(option_highpriority)) { +- exit(1); +- } + if (runuser) { + struct passwd *pw; + pw = getpwnam(runuser); +@@ -1719,8 +1713,29 @@ int main(int argc, char *argv[]) + ast_log(LOG_WARNING, "No such user '%s'!\n", runuser); + exit(1); + } +- if (setuid(pw->pw_uid)) { +- ast_log(LOG_WARNING, "Unable to setuid to %d (%s)\n", pw->pw_uid, runuser); ++ runasuid = pw->pw_uid; ++ } ++ ++ if (set_priority(option_highpriority)) { ++ exit(1); ++ } ++ ++ if (runasgid) { ++ if (setgid(runasgid)) { ++ ast_log(LOG_WARNING, "Unable to setgid to %d (%s)\n", runasgid, rungroup); ++ exit(1); ++ } ++ if (option_verbose) ++ ast_verbose("Running as group '%s'\n", rungroup); ++ } ++ ++ if (runasuid) { ++ if(initgroups(runuser, runasgid) < 0) { ++ ast_log(LOG_WARNING, "Unable to set supplemental groups for %s\n", runuser); ++ exit(1); ++ } ++ if (setuid(runasuid)) { ++ ast_log(LOG_WARNING, "Unable to setuid to %d (%s)\n", runasuid, runuser); + exit(1); + } + if (option_verbose) diff --git a/net-misc/asterisk/files/1.0.0/asterisk.confd.sec b/net-misc/asterisk/files/1.0.0/asterisk.confd.sec index 1c678d8346b9..780903613d2a 100644 --- a/net-misc/asterisk/files/1.0.0/asterisk.confd.sec +++ b/net-misc/asterisk/files/1.0.0/asterisk.confd.sec @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.0.0/asterisk.confd.sec,v 1.2 2005/05/11 12:47:06 stkn Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.0.0/asterisk.confd.sec,v 1.3 2005/05/15 21:46:23 stkn Exp $ # # see "asterisk -h" for a list of options @@ -13,6 +13,14 @@ ASTERISK_OPTS="" # Examples: # "user:group" # "user" -# "" for root +# "" or unset = root:root # ASTERISK_USER="asterisk:asterisk" + +# +# Nicelevel +# +# Set the priority of the asterisk process +# +# Range: 20 +#ASTERISK_NICE="-20" diff --git a/net-misc/asterisk/files/1.0.0/asterisk.rc6.sec b/net-misc/asterisk/files/1.0.0/asterisk.rc6.sec index 6ab451443ac9..5d2b14b28082 100644 --- a/net-misc/asterisk/files/1.0.0/asterisk.rc6.sec +++ b/net-misc/asterisk/files/1.0.0/asterisk.rc6.sec @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.0.0/asterisk.rc6.sec,v 1.1 2005/05/07 18:35:35 stkn Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.0.0/asterisk.rc6.sec,v 1.2 2005/05/15 21:46:23 stkn Exp $ depend() { need net logger @@ -9,15 +9,33 @@ depend() { } start() { + local OPTS USER GROUP + + if [[ -n "${ASTERISK_NICE}" ]]; then + if [[ ${ASTERISK_NICE} -ge -20 ]] && \ + [[ ${ASTERISK_NICE} -le 19 ]]; then + OPTS="--nicelevel ${ASTERISK_NICE}" + else + eerror "Nice value must be between -20 and 19" + fi + fi + if [[ -n "${ASTERISK_USER}" ]]; then - ebegin "Starting asterisk PBX (as ${ASTERISK_USER})" - start-stop-daemon --start --exec /usr/sbin/asterisk \ - --chuid ${ASTERISK_USER} -- ${ASTERISK_OPTS} + USER=${ASTERISK_USER/:*/} + GROUP=$(echo $ASTERISK_USER | awk -F: '/.*:.*/ { print $2 }') + if [[ -n "${USER}" ]]; then + ASTERISK_OPTS="${ASTERISK_OPTS} -U ${USER}" + fi + if [[ -n "${GROUP}" ]]; then + ASTERISK_OPTS="${ASTERISK_OPTS} -G ${GROUP}" + GROUP=":${GROUP}" # make it look nice... + fi + ebegin "Starting asterisk PBX (as ${USER}${GROUP})" else ebegin "Starting asterisk PBX (as root)" - start-stop-daemon --start --exec /usr/sbin/asterisk -- \ - ${ASTERISK_OPTS} fi + start-stop-daemon --start --exec /usr/sbin/asterisk \ + ${OPTS} -- ${ASTERISK_OPTS} eend $? } |