File tree 3 files changed +28
-6
lines changed
3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,19 @@ cvmfs_geoip_db_update_day: "{{ 28 | random(seed=inventory_hostname) }}"
124
124
# 3. this points to a cert bundle that contains CA certs for your Stratum 0 (the default here is valid for EL).
125
125
# cvmfs_x509_cert_bundle: /etc/pki/tls/cert.pem
126
126
127
+ # The role will deploy a PolicyKit rule that allows unprivileged users to manage the services in cvmfs_manage_units if
128
+ # either of the following two options are set.
129
+
130
+ # Either a list of usernames, or set to a boolean true to automatically use the 'owner's in cvmfs_repositories
131
+ # cvmfs_manage_units_users: ...
132
+
133
+ # A group name
134
+ # cvmfs_manage_units_group: ...
135
+
136
+ # The list of units that can be managed by users in the above group
137
+ cvmfs_manage_units :
138
+ - squid.service
139
+
127
140
#
128
141
# Galaxy-specific stuff follows
129
142
#
Original file line number Diff line number Diff line change 129
129
src : 01-manage-units.rules.j2
130
130
dest : /etc/polkit-1/rules.d/01-manage-units.rules
131
131
mode : 0644
132
- when : cvmfs_manage_units_group is defined
132
+ when : cvmfs_manage_units_users is defined or cvmfs_manage_units_group is defined
Original file line number Diff line number Diff line change 2
2
* This file is managed by Ansible. ALL CHANGES WILL BE OVERWRITTEN.
3
3
*/
4
4
5
- /* Allow users in the docker group to manage units. Way more control than we
6
- * would like to give, but the "unit" and "verb" action variables (used with
7
- * action.lookup()) were not added to systemd until 226, so unless RedHat
8
- * backports them, we are SOL.
9
- */
5
+ // Allow CVMFS repo owners to manage related services
10
6
polkit.addRule(function(action, subject) {
7
+ var allowedUnits = {{ cvmfs_manage_units | to_json }};
8
+ {% if cvmfs_manage_units_users is defined and cvmfs_manage_units_users is true %}
9
+ var allowedUsers = {{ cvmfs_repositories | map(attribute='owner') | unique | to_json }};
10
+ {% elif cvmfs_manage_units_users is defined %}
11
+ var allowedUsers = {{ cvmfs_manage_units_users | to_json }};
12
+ {% endif %}
11
13
if (action.id == "org.freedesktop.systemd1.manage-units" &&
14
+ allowedUnits.includes(action.lookup("unit")) &&
15
+ {% if cvmfs_manage_units_users is defined and cvmfs_manage_units_group is defined %}
16
+ (allowedUsers.includes(subject.user) || subject.isInGroup("{{ cvmfs_manage_units_group }}"))) {
17
+ {% elif cvmfs_manage_units_users is defined %}
18
+ allowedUsers.includes(subject.user)) {
19
+ {% elif cvmfs_manage_units_group is defined %}
12
20
subject.isInGroup("{{ cvmfs_manage_units_group }}")) {
21
+ {% endif %}
13
22
return polkit.Result.YES;
14
23
}
15
24
});
You can’t perform that action at this time.
0 commit comments