• Idefisk
  • Tools
  • Tutorials
  • Reviews
  • VoIP Providers
  • Archives
ZOIPER softphone
AsteriskGuru Archives
Mailing List Archives
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[asterisk-users] /etc/asterisk/startup.d

 
   AsteriskGuru Archives Forum Index -> Asterisk-Users
View previous topic :: View next topic  
Author Message
philipp.kempgen at amooma
Guest





PostPosted: Fri May 22, 2009 10:39 am    Post subject: [asterisk-users] /etc/asterisk/startup.d

Does anybody think it would make sense for /etc/init.d/asterisk
to run /etc/asterisk/startup.d/*.sh on start like safe_asterisk
did?


Philipp Kempgen
--
AMOOMA GmbH - Bachstr. 126 - 56566 Neuwied -> http://www.amooma.de
Geschäftsführer: Stefan Wintermeyer, Handelsregister: Neuwied B14998
Asterisk: http://the-asterisk-book.com - http://das-asterisk-buch.de
Videos of the AMOOCON VoIP conference 2009 -> http://www.amoocon.de
--

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
tzafrir.cohen at xorcom.c
Guest





PostPosted: Fri May 22, 2009 11:46 pm    Post subject: [asterisk-users] /etc/asterisk/startup.d

On Fri, May 22, 2009 at 01:33:59PM +0200, Philipp Kempgen wrote:
Quote:
Does anybody think it would make sense for /etc/init.d/asterisk
to run /etc/asterisk/startup.d/*.sh on start like safe_asterisk
did?

What would you put there? When should it be run? As which user?

--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen@xorcom.com
+972-50-7952406 mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com iax:guest@local.xorcom.com/tzafrir

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
philipp.kempgen at amooma
Guest





PostPosted: Sat May 23, 2009 1:50 pm    Post subject: [asterisk-users] /etc/asterisk/startup.d

Tzafrir Cohen schrieb:
Quote:
On Fri, May 22, 2009 at 01:33:59PM +0200, Philipp Kempgen wrote:
> Does anybody think it would make sense for /etc/init.d/asterisk
> to run /etc/asterisk/startup.d/*.sh on start like safe_asterisk
> did?

What would you put there?

Scripts to generate Asterisk config files in /etc/asterisk I guess.
Or scripts to log warnings to syslog if the configuration is insecure
(MySQL does that on Debian).
Or maybe scripts to open some ports on a firewall. Well, no, there
should be stop scripts as well then, so forget about the firewall.
OTOH: The scripts could be called with an argument just like init
scripts (start|stop|restart|...).

I'm not quite sure if that would be a useful thing to have or if
such tasks should rather be done by interdependent init scripts, i.e.
Required-Start, Required-Stop, Should-Start, Should-Stop headers.

Quote:
When should it be run?

Right before /etc/init.d/asterisk is about to (re?)start asterisk.

Quote:
As which user?

Good question. Obviously either as root because /etc/init.d/asterisk
is run by root or as Asterisk's runuser which is likely to be one
of root or asterisk. root would buy us more flexibility :-)


Philipp Kempgen
--
AMOOMA GmbH - Bachstr. 126 - 56566 Neuwied -> http://www.amooma.de
Geschäftsführer: Stefan Wintermeyer, Handelsregister: Neuwied B14998
Asterisk: http://the-asterisk-book.com - http://das-asterisk-buch.de
Videos of the AMOOCON VoIP conference 2009 -> http://www.amoocon.de
--

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
tzafrir.cohen at xorcom.c
Guest





PostPosted: Sat May 23, 2009 3:37 pm    Post subject: [asterisk-users] /etc/asterisk/startup.d

On Sat, May 23, 2009 at 04:43:52PM +0200, Philipp Kempgen wrote:
Quote:
Tzafrir Cohen schrieb:
> On Fri, May 22, 2009 at 01:33:59PM +0200, Philipp Kempgen wrote:
>> Does anybody think it would make sense for /etc/init.d/asterisk
>> to run /etc/asterisk/startup.d/*.sh on start like safe_asterisk
>> did?
>
> What would you put there?

Scripts to generate Asterisk config files in /etc/asterisk I guess.
Or scripts to log warnings to syslog if the configuration is insecure
(MySQL does that on Debian).

When exactly should those be run?

E.g.: asterisk -rx 'restart now' does not get them run. Do you want to
guarantee some script to be run before Asterisk is started?

Should it be run on a reload? On a logger-reload action?

Quote:
Or maybe scripts to open some ports on a firewall. Well, no, there
should be stop scripts as well then, so forget about the firewall.
OTOH: The scripts could be called with an argument just like init
scripts (start|stop|restart|...).

I'm not quite sure if that would be a useful thing to have or if
such tasks should rather be done by interdependent init scripts, i.e.
Required-Start, Required-Stop, Should-Start, Should-Stop headers.

> When should it be run?

Right before /etc/init.d/asterisk is about to (re?)start asterisk.

> As which user?

Good question. Obviously either as root because /etc/init.d/asterisk
is run by root or as Asterisk's runuser which is likely to be one
of root or asterisk. root would buy us more flexibility :-)

--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen@xorcom.com
+972-50-7952406 mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com iax:guest@local.xorcom.com/tzafrir

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
asterisk.org at sedwards.
Guest





PostPosted: Sat May 23, 2009 4:25 pm    Post subject: [asterisk-users] /etc/asterisk/startup.d

On Sat, 23 May 2009, Philipp Kempgen wrote:

Quote:
Tzafrir Cohen schrieb:

> As which user?

Good question. Obviously either as root because /etc/init.d/asterisk is
run by root or as Asterisk's runuser which is likely to be one of root
or asterisk. root would buy us more flexibility :-)

And insecurity.

I'd vote for the user Asterisk will be running as. You can always use sudo
in the script if needed.

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
tzafrir.cohen at xorcom.c
Guest





PostPosted: Sat May 23, 2009 5:32 pm    Post subject: [asterisk-users] /etc/asterisk/startup.d

On Sat, May 23, 2009 at 10:20:21AM -0700, Steve Edwards wrote:
Quote:
On Sat, 23 May 2009, Philipp Kempgen wrote:

> Tzafrir Cohen schrieb:
>
>> As which user?
>
> Good question. Obviously either as root because /etc/init.d/asterisk is
> run by root or as Asterisk's runuser which is likely to be one of root
> or asterisk. root would buy us more flexibility :-)

And insecurity.

I'd vote for the user Asterisk will be running as. You can always use sudo
in the script if needed.

Depends what the script needs to do. It's the sysadmin that adds those
scripts. If the script needs to check something with mysql, as in the
example given by the OP, running it as asterisk is pointless.

If the sysadmin wants to run something as asterisk, there's always su -c

--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen@xorcom.com
+972-50-7952406 mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com iax:guest@local.xorcom.com/tzafrir

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
philipp.kempgen at amooma
Guest





PostPosted: Sun May 31, 2009 11:56 am    Post subject: [asterisk-users] /etc/asterisk/startup.d

Tzafrir Cohen schrieb:
Quote:
On Sat, May 23, 2009 at 04:43:52PM +0200, Philipp Kempgen wrote:
> Tzafrir Cohen schrieb:
> > On Fri, May 22, 2009 at 01:33:59PM +0200, Philipp Kempgen wrote:
> >> Does anybody think it would make sense for /etc/init.d/asterisk
> >> to run /etc/asterisk/startup.d/*.sh on start like safe_asterisk
> >> did?
> >
> > What would you put there?
>
> Scripts to generate Asterisk config files in /etc/asterisk I guess.
> Or scripts to log warnings to syslog if the configuration is insecure
> (MySQL does that on Debian).

When exactly should those be run?

E.g.: asterisk -rx 'restart now' does not get them run. Do you want to
guarantee some script to be run before Asterisk is started?

Should it be run on a reload? On a logger-reload action?

Again, good questions. In order not to make things too complicated
I'd say any scripts in /etc/asterisk/startup.d should be called by
/etc/init.d/asterisk with the argument (action) to /etc/init.d/asterisk
as an argument. If somebody was to circumvent /etc/init.d/asterisk
by calling asterisk -rx ... directly then so be it - no action in
this case.

OTOH it might be a nice thing to build this functionality into
Asterisk itself which could then even call these scripts on
asterisk -rx 'restart now', asterisk -rx 'reload' etc.

However given the lack of much feedback here it seems such a thing
is not useful for many people.

Quote:
> Or maybe scripts to open some ports on a firewall. Well, no, there
> should be stop scripts as well then, so forget about the firewall.
> OTOH: The scripts could be called with an argument just like init
> scripts (start|stop|restart|...).
>
> I'm not quite sure if that would be a useful thing to have or if
> such tasks should rather be done by interdependent init scripts, i.e.
> Required-Start, Required-Stop, Should-Start, Should-Stop headers.
>
> > When should it be run?
>
> Right before /etc/init.d/asterisk is about to (re?)start asterisk.
>
> > As which user?
>
> Good question. Obviously either as root because /etc/init.d/asterisk
> is run by root or as Asterisk's runuser which is likely to be one
> of root or asterisk. root would buy us more flexibility :-)


Philipp Kempgen
--
AMOOMA GmbH - Bachstr. 126 - 56566 Neuwied -> http://www.amooma.de
Geschäftsführer: Stefan Wintermeyer, Handelsregister: Neuwied B14998
Asterisk: http://the-asterisk-book.com - http://das-asterisk-buch.de
Videos of the AMOOCON VoIP conference 2009 -> http://www.amoocon.de
--

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
tzafrir.cohen at xorcom.c
Guest





PostPosted: Sun May 31, 2009 12:20 pm    Post subject: [asterisk-users] /etc/asterisk/startup.d

On Sun, May 31, 2009 at 02:47:51PM +0200, Philipp Kempgen wrote:
Quote:
Tzafrir Cohen schrieb:
> On Sat, May 23, 2009 at 04:43:52PM +0200, Philipp Kempgen wrote:
>> Tzafrir Cohen schrieb:
>> > On Fri, May 22, 2009 at 01:33:59PM +0200, Philipp Kempgen wrote:
>> >> Does anybody think it would make sense for /etc/init.d/asterisk
>> >> to run /etc/asterisk/startup.d/*.sh on start like safe_asterisk
>> >> did?
>> >
>> > What would you put there?
>>
>> Scripts to generate Asterisk config files in /etc/asterisk I guess.
>> Or scripts to log warnings to syslog if the configuration is insecure
>> (MySQL does that on Debian).
>
> When exactly should those be run?
>
> E.g.: asterisk -rx 'restart now' does not get them run. Do you want to
> guarantee some script to be run before Asterisk is started?
>
> Should it be run on a reload? On a logger-reload action?

Again, good questions. In order not to make things too complicated
I'd say any scripts in /etc/asterisk/startup.d should be called by
/etc/init.d/asterisk with the argument (action) to /etc/init.d/asterisk
as an argument. If somebody was to circumvent /etc/init.d/asterisk
by calling asterisk -rx ... directly then so be it - no action in
this case.

OTOH it might be a nice thing to build this functionality into
Asterisk itself which could then even call these scripts on
asterisk -rx 'restart now', asterisk -rx 'reload' etc.

For those you can mostly use #exec .

Asterisk spends most of its life running as the user asterisk. If you
want your code running as root, you may have a problem.

Quote:

However given the lack of much feedback here it seems such a thing
is not useful for many people.

How useful are the equivalent safe_asterisk scripts?

Quote:

>> Or maybe scripts to open some ports on a firewall. Well, no, there
>> should be stop scripts as well then, so forget about the firewall.
>> OTOH: The scripts could be called with an argument just like init
>> scripts (start|stop|restart|...).
>>
>> I'm not quite sure if that would be a useful thing to have or if
>> such tasks should rather be done by interdependent init scripts, i.e.
>> Required-Start, Required-Stop, Should-Start, Should-Stop headers.
>>
>> > When should it be run?
>>
>> Right before /etc/init.d/asterisk is about to (re?)start asterisk.
>>
>> > As which user?
>>
>> Good question. Obviously either as root because /etc/init.d/asterisk
>> is run by root or as Asterisk's runuser which is likely to be one
>> of root or asterisk. root would buy us more flexibility :-)

--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen@xorcom.com
+972-50-7952406 mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com iax:guest@local.xorcom.com/tzafrir

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
Back to top
Display posts from previous:   
   AsteriskGuru Archives Forum Index -> Asterisk-Users 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


Powered by phpBB © 2001, 2005 phpBB Group
contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™