Extensions.conf Asterisk 18.8.0 Question

Home » Asterisk Users » Extensions.conf Asterisk 18.8.0 Question
Asterisk Users 4 Comments

I am trying to run this command:
exten => _4XX,n,System(/usr/bin/rm /tmp/test.incoming.txt)

From the log:
Executing [402@smvoice-sip:7] System(“SIP/103-00000018”, “/usr/bin/rm
/tmp/test.incoming.txt”) in new stack

Is “rm” not an allowed command – the above file is not removed.
-rw-rw-rw- 1 silentm silentm 3 Jan 10 14:02 /tmp/test.incoming.txt

Thanks!

Jerry

4 thoughts on - Extensions.conf Asterisk 18.8.0 Question

  • 1. Does your asterisk instance run as user “silentm”?

    2. What happens if you add the “-f” parameter to the “rm” command in the dialplan?

    3. What does “sudo -u asteriskuser rm /tmp/test.incoming.txt” do, if you run it as the root user, and substituting whichever user your asterisk instance runs as in place of “asteriskuser”?

    Antony.


    A user interface is like a joke. If you have to explain it, it means it doesn’t work.

    Please reply to the list;
    please *don’t* CC me.

  • ———————–e8861aa7ed1f7a96ee59dc75f0398fc7
    Content-Type: multipart/alternative;boundary=———————5c64af9724897c30bdae26e53075f896

    ———————–5c64af9724897c30bdae26e53075f896
    Content-Transfer-Encoding: quoted-printable Content-Type: text/plain;charset=utf-8

    If you’re on RHEL or CentOS or one of its descendants, I would check if SELinux is enforcing (`sestatus` or `cat /etc/selinux/config` and look for “SELINUX=enforcing”), if it is, you’ll probably need to create a policy to allow the Asterisk context to execute rm and/or delete files. I use `audit2why` and `audit2allow` in policycoreutils-devel (on CentOS) to generate SELinux policy modules.

    -Michael Englehorn

    ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
    ———————–5c64af9724897c30bdae26e53075f896
    Content-Type: multipart/related;boundary=———————01caca0b595acde93af2cf552d72f3d0

    ———————–01caca0b595acde93af2cf552d72f3d0
    Content-Type: text/html;charset=utf-8
    Content-Transfer-Encoding: base64

    PGRpdiBzdHlsZT0iZm9udC1mYW1pbHk6IGFyaWFsOyBmb250LXNpemU6IDE0cHg7Ij48ZGl2IHN0
    eWx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dmVkLjxicj48L2Rpdj48ZGl2Pi1y dy1ydy1ydy0gMSBzaWxlbnRtIHNpbGVudG0gMyBKYW4gMTAgMTQ6MDIgL3RtcC90ZXN0LmluY29t aW5nLnR4dDxicj48L2Rpdj48ZGl2Pjxicj48L2Rpdj48L2Rpdj48ZGl2PlRoYW5rcyE8YnI+PC9k aXY+PGRpdj48YnI+PC9kaXY+PGRpdj5KZXJyeTxicj48L2Rpdj48L2Rpdj48L2Jsb2NrcXVvdGU+
    PGRpdiBzdHlsZT0iZm9udC1mYW1pbHk6IGFyaWFsOyBmb250LXNpemU6IDE0cHg7Ij48YnI+PC9k aXY+
    ———————–01caca0b595acde93af2cf552d72f3d0

  • Oh, now that reminds me that those systems also tend to alias “rm” to “rm -i”, so they won’t delete files without confirmation.

    Irritating in general IMHO, but it might be the cause of your puzzlement…

    Antony.


    Just when you think you’re done, a cat floats by with buttered toast strapped to its back.

    – Steve Krug, “Don’t make me think”

    Please reply to the list;
    please *don’t* CC me.