DVSwitch and ASL3

Good day,

I understand security is tighter on the system, so the question I have is I have these scripts that I got elsewhere, not mine, that would change the DMR Networks, like from BM to TGIF. They work perfectly in Root, so I presume it has to do with the security.

part of the instructions are:

these files in the /opt/Analog_Bridge

BM_chng.sh Changes MMDVM Bridge to Brandmeister
TGIF_chng.sh Changes MMDVM Bridge to TGIF

BM_chng.sh

#! /bin/bash
cp /opt/MMDVM_Bridge/MMDVM_Bridge_BM.ini /opt/MMDVM_Bridge/MMDVM_Bridge.ini
systemctl restart mmdvm_bridge.service

TGIF_chng.sh

#! /bin/bash
cp /opt/MMDVM_Bridge/MMDVM_Bridge_TGIF.ini /opt/MMDVM_Bridge/MMDVM_Bridge.ini
systemctl restart mmdvm_bridge.service

Make the scripts Executable:

chmod 755 /opt/Analog_Bridge/BM_chng.sh
chmod 755 /opt/Analog_Bridge/TGIF_chng.sh

but when I try to use a DTMF command, they don’t work.

13 = /opt/Analog_Bridge/TGIF_chng.sh
14 = /opt/Analog_Bridge/BM_chng.sh

I do assume it is something new due to all the security updates with ASL3, but I am a newbie at this, so I am asking for assistance on getting this to work.

thank you & 73

Rob - K6IRK

Indeed, on ASL3 the asterisk process is running as the “asterisk” user instead of root, so if you are trying to have asterisk execute scripts it can only execute them as the “asterisk” user.

To give permission for asterisk to copy the ini files in, you can try

sudo chown :asterisk /opt/MMDVM_Bridge/
sudo chmod 775 /opt/MMDVM_Bridge/

To fix the systemctl restart command, you could create polkit rules, like the ones that were just added to ASL3 HERE.

For instance, create a file /etc/polkit-1/rules.d/50-mmdvm.rules
And put these contents in the file

polkit.addRule(function(action, subject) {
    if ( action.id == "org.freedesktop.systemd1.manage-units" &&
			subject.user == "asterisk" && (
   		     	action.lookup("unit") == "mmdvm_bridge.service")
		)
 		{ return polkit.Result.YES; }
});

The above edit probably requires a logout/login, or a restart to take effect.

Now, to test executing the scripts as the asterisk user use the following command

sudo -u asterisk /opt/Analog_Bridge/TGIF_chng.sh

If this works, then the DTMF macros should work as well. If it is not working, then you will need to continue to make edits to the commands in the scripts or to the permissions on the system until it does work.

Disclaimer: I did not test any of these changes as I am not running a MMDVM Bridge. I’m just sharing general Linux knowledge that should get you closer to where you want to be.

Polkit rules take effect immediately.