[solved] ScriptSMSProvider does not execute bash script

Hey guys,

after pip installing privacyIDEA on Rocky Linux, I’m currently testing the ScriptSMSProvider but it seems I can’t get it to actually execute a simple bash script.
The script should just echo a string into an existing file. The permissions of both files are correct but nothing happens although the log states that the script was started.

What am I doing wrong?

#!/bin/bash
sms="/opt/privacyidea/sms_test.txt"
echo "To: $1" > $sms

rwxr–r–. 1 privacyidea privacyidea /etc/privacyidea/scripts/send_sms.sh

-rw-rw-r–. 1 privacyidea privacyidea /opt/privacyidea/sms_test.txt

/var/log/privacyidea/privacyidea.log:

[privacyidea.lib.smsprovider.ScriptSMSProvider:78] Starting script '/etc/privacyidea/scripts/send_sms.sh'.
[privacyidea.lib.smsprovider.ScriptSMSProvider:95] SMS delivered to +49[...].

Thanks in advance

Have a nice day!

Okay nevermind, it looks like I’m just struggling with SELinux…

I will update this topic as soon as I fixed the permissions.

1 Like

My solution for now was creating a new directory with httpd rw context in /opt/privacyidea to temporarily store the SMS files before sending and deleting them:

mkdir /opt/privacyidea/sms
chown privacyidea:privacyidea /opt/privacyidea/sms
chmod 0700 /opt/privacyidea/sms
semanage fcontext -a -t httpd_sys_rw_content_t /opt/privacyidea/sms
restorecon -Rv /opt/privacyidea/sms