[OpenSIPS-Users] calling external command with sudo

Dragomir Haralambiev goup2010 at gmail.com
Fri Sep 20 20:34:43 CEST 2013


I have figured it out after some struggling. Sudo won't work due to tty
requirement set by default in sudoers. So in order to be able to execute
sudo command we need to disable tty requirement for that particular user in
/etc/sudoers by adding:

Defaults:opensips !requiretty

(where opensips is the userid which opensips runs as)


2013/9/20 Stefano Pisani <stefano.pisani at omnianet.it>

>  are you sure to know how to configure sudo?
> please post the user used by openSIPS and sudo configuration (sudoers)
>
>
>
> Il 20/09/2013 19.11, Dragomir Haralambiev ha scritto:
>
>  Hello everyone,
>
> I am trying to execute 'iptables' from opensips in the script, which works
> if opensips runs as root. However if opensips is configured to run as
> non-privileged user, in order to control iptables, I have to call iptables
> via sudo. Command works on the command prompt when executed manually under
> the user opensips run as, but does not seem to execute if run by opensips
> itself.
>
> This is how I try to call it:
>
> exec_msg("/usr/bin/sudo /sbin/iptables -A INPUT -s $si -p udp -j DROP");
>
> log file says command is executed, but the firewall rules do not get
> updated.
>
> Any idea why?
>
>
> _______________________________________________
> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20130920/c010a358/attachment.htm>


More information about the Users mailing list