Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
22.4. Testing Host-Based Access Control Rules
hbactest
command can test different host-based access control scenarios to make sure that the rules are working as expected.
Note
hbactest
command does not work with trusted Active Directory users. Active Directory user/group associations are determined dynamically, as a user logs in, and those data are not stored in the IdM LDAP directory. The hbactest
command, then, is unable to resolve the group memberships to check how access control rules will be applied.
22.4.1. The Limits of Host-Based Access Control Configuration
- A new rule needs to be tested before it is implemented.
- There are problems with the existing rules, and the testing tool can identify what rule is behaving badly.
- A subset of existing rules can be tested to see how they are performing.
22.4.2. Test Scenarios for Host-Based Access Control (CLI-Based)
Note
hbactest
command does not work with trusted Active Directory users. Active Directory user/group associations are determined dynamically, as a user logs in, and those data are not stored in the IdM LDAP directory. The hbactest
command, then, is unable to resolve the group memberships to check how access control rules will be applied.
hbactest
command tests configured host-based access control rules in very specific situations. A test run defines:
- The user to run the operation as to test the rule performance for that user (
--user
). - Using the login client Y (
--service
). - To target host Z (
--host
). - The rule to test (
--rules
); if this is not used, then all enabled rules are tested. - Optional The
hbactest
returns detailed information about which rules were matched, not matched, or invalid. This detailed rule output can be disabled using--nodetail
, so the test simply runs and returns whether access was granted.
Note
hbactest
script does not actually connect to the target host. Instead, it uses the rules within the IdM database to simulate how those rules would be applied in a specific situation as if an SSSD client were connecting to the IdM server.
Example 22.4. Testing All Active Rules
kinit admin ipa hbactest --user=jsmith --host=target.example.com --service=ssh
[jsmith@server ~]$ kinit admin
[jsmith@server ~]$ ipa hbactest --user=jsmith --host=target.example.com --service=ssh
--------------------
Access granted: True
--------------------
Matched rules: allow_all
Matched rules: sshd-jsmith
Matched rules: web-rules
Not matched rules: allGroup
Example 22.5. Testing a Specific Rule
kinit admin ipa hbactest --user=jsmith --host=target.example.com --service=ssh --rules=myrule
[jsmith@server ~]$ kinit admin
[jsmith@server ~]$ ipa hbactest --user=jsmith --host=target.example.com --service=ssh --rules=myrule
---------------------
Access granted: True
---------------------
notmatched: myrule
Example 22.6. Testing Specific Rules Plus All Enabled
--rules
option lists specific rules to test, but it may be useful to test the specified rules against all of the enabled rules in the domain. This can be done by adding the --enabled
option, which includes the (unspecified) enabled rules along with the specified rules.
kinit admin ipa hbactest --user=jsmith --host=target.example.com --service=ssh --rules=myrule --enabled
[jsmith@server ~]$ kinit admin
[jsmith@server ~]$ ipa hbactest --user=jsmith --host=target.example.com --service=ssh --rules=myrule --enabled
--------------------
Access granted: True
--------------------
matched: my-second-rule
notmatched: my-third-rule
matched: myrule
matched: allow_all
--disabled
option. With the --rules
option, the specified rule plus all of the disabled rules are checked. With the --disabled
option, all disabled rules are checked.
22.4.3. Testing Host-Based Access Control Rules in the UI
Note
hbactest
command does not work with trusted Active Directory users. Active Directory user/group associations are determined dynamically, as a user logs in, and those data are not stored in the IdM LDAP directory. The hbactest
command, then, is unable to resolve the group memberships to check how access control rules will be applied.
- The user to run the operation as to test the rule performance for that user (Who).
- To target host Z (Accessing).
- Using the login client Y (Via Service).
- The rule to test; if this is not used, then all enabled rules are tested (Rules).

Figure 22.2. The From Tab to Set up an HBAC Test

Figure 22.3. HBAC Test Results
Note