Polkit'e şu kuralı eklemeye çalıştım:
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") });
Koşarken:
systemctl stop bamboo
Alırım:
Failed to stop bamboo.service: Interactive authentication required.
Ve / var / log / secure dosyasında aşağıdaki satırlar bulunur:
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)
Önemli olan, eylem nesnesinin "birim" veya "fiil" için tanımlanmış tuşlara sahip görünmemesidir. Bu kuralı buradan aldım: https://wiki.archlinux.org/index.php/Polkit#Allow_management_of_individual_systemd_units_by_regular_users
Bu konuda herhangi bir gelişme var mı?
—
Devin