Skip to content

Commit dd501fe

Browse files
committed
refactor common.sh script for service_sssd_enabled
1 parent 52ce486 commit dd501fe

1 file changed

Lines changed: 11 additions & 31 deletions

File tree

  • linux_os/guide/services/sssd/service_sssd_enabled/tests
Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,16 @@
11
# sssd.service needs /etc/sssd/sssd.conf to start
2-
if [ ! -f /etc/sssd/sssd.conf ]; then
3-
cat << EOF > /etc/sssd/sssd.conf
4-
[sssd]
5-
config_file_version = 2
6-
services = nss, pam
7-
domains = example.com
2+
SSSD_CONF="/etc/sssd/sssd.conf"
3+
SSSD_CONF_DIR="/etc/sssd/conf.d"
4+
{{{ bash_sssd_ensure_default_config("$SSSD_CONF", "$SSSD_CONF_DIR") }}}
85

9-
[domain/example.com]
10-
{{%- if ('rhel' in product or 'ol' in families) and product not in ['ol8', 'ol9', 'rhel8', 'rhel9']%}}
11-
id_provider = proxy
12-
proxy_lib_name = files
13-
local_auth_policy = only
14-
{{%- else %}}
15-
id_provider = files
16-
access_provider = simple
17-
simple_allow_users = user1, user2
6+
{{%- if ('rhel' in product or 'ol' in families) and product not in ['ol7', 'ol8', 'ol9', 'rhel8', 'rhel9']%}}
7+
{{{ bash_ensure_ini_config("$SSSD_CONF $SSSD_CONF_DIR/*.conf", "pam", "pam_cert_auth", "True") }}}
188
{{%- endif %}}
199

20-
[nss]
21-
filter_groups = root
22-
filter_users = root
23-
24-
[pam]
25-
{{%- if ('rhel' in product or 'ol' in families) and product not in ['ol8', 'ol9', 'rhel8', 'rhel9']%}}
26-
pam_cert_auth = True
10+
{{%- if product in ["fedora"] or (('rhel' in product or 'ol' in families) and product not in ['ol7', 'ol8', 'ol9', 'rhel8', 'rhel9']) %}}
11+
{{{ bash_package_install("sssd-proxy") }}}
12+
authselect select sssd with-smartcard
13+
chmod 0640 $SSSD_CONF
14+
{{%- else %}}
15+
chmod 0600 $SSSD_CONF
2716
{{%- endif %}}
28-
EOF
29-
{{%- if ('rhel' in product or 'ol' in families) and product not in ['ol8', 'ol9', 'rhel8', 'rhel9']%}}
30-
dnf install sssd-proxy -y
31-
authselect select sssd with-smartcard
32-
chmod 0640 /etc/sssd/sssd.conf
33-
{{%- else %}}
34-
chmod 0600 /etc/sssd/sssd.conf
35-
{{%- endif %}}
36-
fi

0 commit comments

Comments
 (0)