6d47df
From b3f06994b7b44a0f9cd0c6bd0302c9db87dc2502 Mon Sep 17 00:00:00 2001
6d47df
From: Christian Heimes <cheimes@redhat.com>
6d47df
Date: Tue, 15 Jan 2019 17:33:56 +0100
6d47df
Subject: [PATCH] Fix systemd-user HBAC rule
6d47df
6d47df
2ef6e14c5a87724a3b37dd5f0817af48c4411e03 added an invalid HBAC rule that
6d47df
encoded the service wrongly.
6d47df
6d47df
See: https://bugzilla.redhat.com/show_bug.cgi?id=1643928
6d47df
Fixes: https://pagure.io/freeipa/issue/7831
6d47df
Signed-off-by: Christian Heimes <cheimes@redhat.com>
6d47df
---
6d47df
 install/share/default-hbac.ldif            |  2 +-
6d47df
 ipatests/test_integration/test_commands.py | 12 +++++++++---
6d47df
 2 files changed, 10 insertions(+), 4 deletions(-)
6d47df
6d47df
diff --git a/install/share/default-hbac.ldif b/install/share/default-hbac.ldif
6d47df
index 8dd90685c..c89bd3eef 100644
6d47df
--- a/install/share/default-hbac.ldif
6d47df
+++ b/install/share/default-hbac.ldif
6d47df
@@ -21,7 +21,7 @@ cn: allow_systemd-user
6d47df
 accessruletype: allow
6d47df
 usercategory: all
6d47df
 hostcategory: all
6d47df
-servicecategory: systemd-user
6d47df
+memberService: cn=systemd-user,cn=hbacservices,cn=hbac,$SUFFIX
6d47df
 ipaenabledflag: TRUE
6d47df
 description: Allow pam_systemd to run user@.service to create a system user session
6d47df
 ipauniqueid: autogenerate
6d47df
diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py
6d47df
index 1fb6450a2..8b2c84fc6 100644
6d47df
--- a/ipatests/test_integration/test_commands.py
6d47df
+++ b/ipatests/test_integration/test_commands.py
6d47df
@@ -500,12 +500,18 @@ class TestIPACommand(IntegrationTest):
6d47df
         # https://pagure.io/freeipa/issue/7831
6d47df
         tasks.kinit_admin(self.master)
6d47df
         # check for presence
6d47df
-        self.master.run_command(
6d47df
-            ['ipa', 'hbacrule-show', 'allow_systemd-user']
6d47df
-        )
6d47df
         self.master.run_command(
6d47df
             ['ipa', 'hbacsvc-show', 'systemd-user']
6d47df
         )
6d47df
+        result = self.master.run_command(
6d47df
+            ['ipa', 'hbacrule-show', 'allow_systemd-user', '--all']
6d47df
+        )
6d47df
+        lines = set(l.strip() for l in result.stdout_text.split('\n'))
6d47df
+        assert 'User category: all' in lines
6d47df
+        assert 'Host category: all' in lines
6d47df
+        assert 'Enabled: TRUE' in lines
6d47df
+        assert 'Services: systemd-user' in lines
6d47df
+        assert 'accessruletype: allow' in lines
6d47df
 
6d47df
         # delete both
6d47df
         self.master.run_command(
6d47df
-- 
6d47df
2.20.1
6d47df