Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 529192 - net-misc/asterisk - add systemd service files
Summary: net-misc/asterisk - add systemd service files
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Tony Vroon (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: install-systemd-unit
  Show dependency tree
 
Reported: 2014-11-13 23:38 UTC by Craig Andrews
Modified: 2014-12-30 21:30 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Andrews gentoo-dev 2014-11-13 23:38:50 UTC
Gentoo doesn't provide systemd service files for net-misc/asterisk.

Suggested file asterisk.service (taken from Fedora http://pkgs.fedoraproject.org/cgit/asterisk.git/tree/asterisk.service ):

[Unit]
Description=Asterisk PBX and telephony daemon.
After=network.target

[Service]
Type=simple
Environment=HOME=/var/lib/asterisk
WorkingDirectory=/var/lib/asterisk
User=asterisk
Group=asterisk
ExecStart=/usr/sbin/asterisk -f -C /etc/asterisk/asterisk.conf
ExecStop=/usr/sbin/asterisk -rx 'core stop now'
ExecReload=/usr/sbin/asterisk -rx 'core reload'

# To emulate some of the features of the safe_asterisk script, copy
# this file to /etc/systemd/system/asterisk.service and uncomment one
# or more of the following lines.  For more information on what these
# parameters mean see:
#
# http://0pointer.de/public/systemd-man/systemd.service.html
# http://0pointer.de/public/systemd-man/systemd.exec.html

#Nice=0
#UMask=0002
#LimitCORE=infinity
#LimitNOFILE=
#Restart=always
#RestartSec=4

# If you uncomment the following you should add '-c' to the ExecStart line above

#TTYPath=/dev/tty7
#StandardInput=tty
#StandardOutput=tty
#StandardError=tty

PrivateTmp=true

[Install]
WantedBy=multi-user.target


Here's the upstream bug report:
https://issues.asterisk.org/jira/browse/ASTERISK-21991

Reproducible: Always
Comment 1 Matthias Maier gentoo-dev 2014-12-30 21:27:02 UTC
I've put some inital service files in place - which is mainly a cleaned up version of the version coming from fedora. The user configurable part for enabling a debug console on a TTY now resides (completeyl commented in) under /etc/systemd/system/asterisk.service.d/00gentoo.conf

There is a minor caveat with above configuration with the configuration and a bug in systemd, though [1]. A fix is to not set User=asterisk, Group=asterisk in the service file but in the configuration file /etc/asterisk/asterisk.conf.
But due to history, this is way too dangerous to change - if a user forgets to update a modified asterisk.conf file, asterisk runs with root privileges :-/

[1] https://bugs.freedesktop.org/show_bug.cgi?id=85255



*asterisk-11.14.2-r1 (30 Dec 2014)
*asterisk-11.15.0-r1 (30 Dec 2014)
*asterisk-12.8.0-r1 (30 Dec 2014)
*asterisk-12.7.2-r1 (30 Dec 2014)

  30 Dec 2014; Matthias Maier <tamiko@gentoo.org> +asterisk-11.14.2-r1.ebuild,
  +asterisk-11.15.0-r1.ebuild, +asterisk-12.7.2-r1.ebuild,
  +asterisk-12.8.0-r1.ebuild, +files/asterisk.service,
  +files/asterisk.service.conf, +files/asterisk.tmpfiles.conf:
  provide systemd service files, bug #529192
Comment 2 Matthias Maier gentoo-dev 2014-12-30 21:30:44 UTC
A, I should have been a bit more precise: This bug only triggers if the optional TTY debug console is enabled. The default service file commited is unaffected.