As admin, I would like the "ipa sudorule-add-user adminrule --groups somerandomgroup" command to return an error code if the group does not exist instead of adding it as an external user.
The sudorule-add-user command adds the nonexistent group as an external user.
ipa sudorule-add adminrule Added Sudo Rule "adminrule" Rule name: adminrule Enabled: True bash-4.4# ipa sudorule-add-user adminrule --groups somerandomgroup Rule name: adminrule Enabled: True External User: somerandomgroup Number of members added 1
The command returns an error code of 1 if the group does not exist. In bash, I should be able to execute "echo $?" and see a 1.
This is using the Rocky Linux Docker container. $ rpm -q freeipa-server freeipa-client ipa-server ipa-client 389-ds-base pki-ca krb5-server package freeipa-server is not installed package freeipa-client is not installed ipa-server-4.9.10-6.module+el8.7.0+1075+05db0c1d.x86_64 ipa-client-4.9.10-6.module+el8.7.0+1075+05db0c1d.x86_64 389-ds-base-1.4.3.30-6.module+el8.7.0+1060+852806e7.x86_64 package pki-ca is not installed krb5-server-1.18.2-22.el8_7.x86_64
I think this would be more inline with other commands that validate something exists and return an error if it does not. This would also help prevent misconfigurations from admins adding incorrect groups and maybe even security incidents from those external groups being able to being able to run things with sudo.
Metadata Update from @ftrivino: - Issue assigned to abbra