-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for new Polkit (versions >= 124) (#1147)
The new Polkit introduced quite some changes, even syntax ones. Since then, users had to install an additional compatibility package to make the privilege escalation policy work. This PR adds support for the new Polkit versions whilst still supporting clients that have the older versions and properly handling migration between versions as well. UDENG-5318
- Loading branch information
Showing
159 changed files
with
795 additions
and
285 deletions.
There are no files selected for viewing
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
...icyUpdate/golden/already_up_to_date/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-user:[email protected]","unix-group:[email protected]"]; | ||
}); |
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
...rtmonger_or_cepces_is_not_available/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-user:[email protected]","unix-group:[email protected]"]; | ||
}); |
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
...d-bus_proxy_object_is_not_available/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-user:[email protected]","unix-group:[email protected]"]; | ||
}); |
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
..._get_machine_from_cache_(no_update)/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-group:sudo","unix-group:admin","unix-user:carole [email protected]"]; | ||
}); |
7 changes: 7 additions & 0 deletions
7
...che_is_cleared,_with_policies_cache/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-group:sudo","unix-group:admin","unix-user:carole [email protected]"]; | ||
}); |
6 changes: 0 additions & 6 deletions
6
..._machine_from_old_data/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...e,_regenerate_machine_from_old_data/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-group:sudo","unix-group:admin","unix-user:carole [email protected]"]; | ||
}); |
6 changes: 0 additions & 6 deletions
6
...en/machine,_first_time/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...cyUpdate/golden/machine,_first_time/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-user:[email protected]","unix-group:[email protected]"]; | ||
}); |
6 changes: 0 additions & 6 deletions
6
...e_with_winbind_backend/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...ne,_first_time_with_winbind_backend/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-user:[email protected]","unix-group:[email protected]"]; | ||
}); |
File renamed without changes.
6 changes: 0 additions & 6 deletions
6
...chine,_update_old_data/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...ate/golden/machine,_update_old_data/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-user:[email protected]","unix-group:[email protected]"]; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,9 @@ | |
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
[Configuration] | ||
AdminIdentities=unix-group:sudo;unix-group:admin | ||
|
||
[Configuration] | ||
AdminIdentities=unix-user:[email protected];unix-group:[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
|
||
[Configuration] | ||
AdminIdentities=unix-user:carole [email protected] | ||
|
File renamed without changes.
6 changes: 0 additions & 6 deletions
6
.../refresh_all_connected/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...Update/golden/refresh_all_connected/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-user:[email protected]","unix-group:[email protected]"]; | ||
}); |
File renamed without changes.
6 changes: 0 additions & 6 deletions
6
...refresh_some_connected/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...pdate/golden/refresh_some_connected/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-user:[email protected]","unix-group:[email protected]"]; | ||
}); |
File renamed without changes.
6 changes: 0 additions & 6 deletions
6
...ected_updates_machines/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
..._no_user_connected_updates_machines/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-user:[email protected]","unix-group:[email protected]"]; | ||
}); |
File renamed without changes.
6 changes: 0 additions & 6 deletions
6
...es_the_respective_user/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...symlink_ignores_the_respective_user/polkit-1/rules.d/00-adsys-privilege-enforcement.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is managed by adsys. | ||
# Do not edit this file manually. | ||
# Any changes will be overwritten. | ||
|
||
polkit.addAdminRule(function(action, subject){ | ||
return ["unix-user:[email protected]","unix-group:[email protected]"]; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,8 +139,15 @@ func action(ctx context.Context, cmd *command.Command) (err error) { | |
"[email protected]" ALL=(ALL:ALL) ALL`); err != nil { | ||
return err | ||
} | ||
|
||
// Due to differences in polkit versions between Ubuntu versions, the file path is different | ||
polkitFilePath := "/etc/polkit-1/rules.d/00-adsys-privilege-enforcement.rules" | ||
if cmd.Inventory.Codename == "focal" || cmd.Inventory.Codename == "jammy" { | ||
polkitFilePath = "/etc/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf" | ||
} | ||
|
||
// Only partly assert the polkit file contents as there are differences in polkit configurations between Ubuntu versions | ||
if err := rootClient.RequireContains(ctx, "cat /etc/polkit-1/localauthority.conf.d/99-adsys-privilege-enforcement.conf", "unix-user:[email protected]"); err != nil { | ||
if err := rootClient.RequireContains(ctx, fmt.Sprintf("cat %s", polkitFilePath), "unix-user:[email protected]"); err != nil { | ||
return err | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package privilege | ||
|
||
// WithPolicyKitSystemDir sets the directory where the default policykit files are stored. | ||
func WithPolicyKitSystemDir(dir string) func(*option) { | ||
return func(o *option) { | ||
o.policyKitSystemDir = dir | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.