2
I tried to add the following rule to polkit:
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.systemd1.manage-units") {
polkit.log("action=" + action)
polkit.log("subject=" + subject)
polkit.log("unit="+action.lookup("unit"))
polkit.log("verb="+action.lookup("verb"))
if (action.lookup("unit") == "jira.service" ||
action.lookup("unit") == "bamboo.service" ||
action.lookup("unit") == "bitbucket.service") {
var verb = action.lookup("verb");
if (verb == "start" || verb == "stop" || verb == "restart") {
polkit.log("returning YES")
return polkit.Result.YES;
}
}
}
polkit.log("returning NO") });
When I run:
systemctl stop bamboo
I get:
Failed to stop bamboo.service: Interactive authentication required.
And the /var/log/secure file has the following lines:
Apr 12 11:19:00 myhost polkitd[1081]: Registered Authentication Agent for unix-process:22681:1068941302 (system bus name :1.192164 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Apr 12 11:19:00 myhost polkitd[1081]: /etc/polkit-1/rules.d/10-buildsys-mgmt.rules:3: action=[Action id='org.freedesktop.systemd1.manage-units']
Apr 12 11:19:00 myhost polkitd[1081]: /etc/polkit-1/rules.d/10-buildsys-mgmt.rules:4: subject=[Subject pid=22681 user='myuser' groups=wheel,cvsgrp, seat='' session='' local=false active=false]
Apr 12 11:19:00 myhost polkitd[1081]: /etc/polkit-1/rules.d/10-buildsys-mgmt.rules:5: unit=undefined
Apr 12 11:19:00 myhost polkitd[1081]: /etc/polkit-1/rules.d/10-buildsys-mgmt.rules:6: verb=undefined
Apr 12 11:19:00 myhost polkitd[1081]: /etc/polkit-1/rules.d/10-buildsys-mgmt.rules:17: returning NO
Apr 12 11:19:00 myhost polkitd[1081]: Unregistered Authentication Agent for unix-process:22681:1068941302 (system bus name :1.192164, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
The important part is that the action object doesn't seem to have keys defined for "unit" or "verb". I cribbed this rule from here: https://wiki.archlinux.org/index.php/Polkit#Allow_management_of_individual_systemd_units_by_regular_users
Any progress on this? – devin – 2016-08-24T19:41:59.393