Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
a1c7c9a0
Commit
a1c7c9a0
authored
Mar 19, 2022
by
amegami
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support to AstraLinux
parent
19639773
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
49 deletions
+55
-49
tune_sssd.sh
dc-client/tune_sssd.sh
+55
-49
No files found.
dc-client/tune_sssd.sh
View file @
a1c7c9a0
...
@@ -10,39 +10,35 @@ fatal()
...
@@ -10,39 +10,35 @@ fatal()
exit
1
exit
1
}
}
if
!
which subst 2>/dev/null
;
then
subst
()
{
sed
-i
-e
"
$@
"
}
fi
if
epm assure etckeeper
;
then
if
epm assure etckeeper
;
then
[
-d
/etc/.git
]
||
fatal
"For first, initialize /etc with # etckeeper init"
[
-d
/etc/.git
]
||
fatal
"For first, initialize /etc with # etckeeper init"
else
else
echo
"Can't install etckeeper, so skipping it"
echo
"Can't install etckeeper, so skipping it"
fi
fi
[
"
$(
hostname
)
"
=
"
$(
hostname
-s
)
"
]
&&
fatal
"Hostname
$(
hostname
)
is short (without domain)."
ADMIN
=
Administrator
ADMIN
=
Administrator
if
[
-n
"
$1
"
]
;
then
if
[
-n
"
$1
"
]
;
then
ADMIN
=
"
$1
"
ADMIN
=
"
$1
"
shift
shift
fi
fi
epm assure bind-utils
||
fatal
# Get REALM (needed for sssd tuning only) from DNS
REALM
=
$(
host
-t
txt _kerberos |
sed
-e
's|.*"\(.*\)".*|\1|'
)
#"
if
[
-z
"
$REALM
"
]
||
echo
"
$REALM
"
|
grep
"not found"
;
then
if
[
-n
"
$1
"
]
;
then
REALM
=
"
$1
"
shift
else
fatal
"Check your DNS with
$
host -t txt _kerberos or run with REALM as param"
fi
fi
echo
"Use REALM
$REALM
..."
case
$(
epm print info
-d
)
in
case
$(
epm print info
-d
)
in
Ubuntu|Debian|AstraLinux
)
Ubuntu|Debian|AstraLinux
)
# Ubuntu
# Ubuntu
epmi
--skip-installed
samba-common-bin krb5-config krb5-user ldb-tools sssd-ad s
amba
epmi
--skip-installed
samba-common-bin krb5-config krb5-user ldb-tools sssd-ad s
ssd-tools samba bind9-host
;;
;;
ALTLinux
)
ALTLinux
)
epmi
--skip-installed
krb5-kinit ldb-tools sssd-ad samba-common-tools samba-common-client samba-common
epmi
--skip-installed
krb5-kinit ldb-tools sssd-ad samba-common-tools samba-common-client samba-common
bind-utils
# pam_mount task-auth-ad-sssd
# pam_mount task-auth-ad-sssd
;;
;;
Fedora|RedOS|GosLinux|CentOS|RHEL
)
Fedora|RedOS|GosLinux|CentOS|RHEL
)
...
@@ -53,7 +49,21 @@ case $(epm print info -d) in
...
@@ -53,7 +49,21 @@ case $(epm print info -d) in
;;
;;
esac
esac
if
[
-d
/etc/krb5.conf.d/
]
;
then
# Get REALM (needed for sssd tuning only) from DNS
REALM
=
$(
host
-t
txt _kerberos |
sed
-e
's|.*"\(.*\)".*|\1|'
)
#"
if
[
-z
"
$REALM
"
]
||
echo
"
$REALM
"
|
grep
"not found"
;
then
if
[
-n
"
$1
"
]
;
then
REALM
=
"
$1
"
shift
else
fatal
"Check your DNS with
$
host -t txt _kerberos or run with REALM as param"
fi
fi
echo
"Use REALM
$REALM
..."
if
grep
-q
"include /etc/krb5.conf.d"
/etc/krb5.conf
;
then
mkdir
-p
/etc/krb5.conf.d/
cat
<<
EOF
>/etc/krb5.conf.d/ad
cat
<<
EOF
>/etc/krb5.conf.d/ad
[libdefaults]
[libdefaults]
dns_lookup_kdc = true
dns_lookup_kdc = true
...
@@ -63,17 +73,16 @@ EOF
...
@@ -63,17 +73,16 @@ EOF
# rdns disabled!
# rdns disabled!
# See https://bugs.etersoft.ru/show_bug.cgi?id=15473#c13
# See https://bugs.etersoft.ru/show_bug.cgi?id=15473#c13
else
else
echo
"Can't set dns_lookup* in /etc/krb5.conf.d"
echo
"Switch dns_lookup* right in /etc/krb5.conf"
subst
"s|dns_lookup_kdc = false|dns_lookup_kdc = true|"
/etc/krb5.conf
subst
"s|dns_lookup_realm = false|dns_lookup_realm = true|"
/etc/krb5.conf
subst
"s|rdns = false|rdns = true|"
/etc/krb5.conf
if
!
grep
-q
"rdns = true"
/etc/krb5.conf
;
then
subst
"s|
\(
.*
\)
dns_lookup_realm = true|
\1
dns_lookup_realm = true
\n\1
rdns = true|"
/etc/krb5.conf
fi
fi
fi
if
!
which subst 2>/dev/null
;
then
subst
()
{
sed
-i
-e
"
$@
"
}
fi
#LIBDIR=$(getconf LIBDIR)
#LIBDIR=$(getconf LIBDIR)
#if [ ! -d "$LIBDIR" ] ; then
#if [ ! -d "$LIBDIR" ] ; then
# LIBDIR=/usr/lib64
# LIBDIR=/usr/lib64
...
@@ -87,10 +96,12 @@ fi
...
@@ -87,10 +96,12 @@ fi
# ln -s $LIBDIR/ldb/modules/ldb $LIBDIR/samba/ldb
# ln -s $LIBDIR/ldb/modules/ldb $LIBDIR/samba/ldb
#fi
#fi
if
[
-d
/etc/sssd/conf.d
]
;
then
SSSDCONF
=
/etc/sssd/conf.d/ad.conf
[
-f
/etc/sssd/conf.d/etersoft.conf
]
&&
rm
-vf
/etc/sssd/conf.d/etersoft.conf
if
[
!
-d
/etc/sssd/conf.d
]
||
[
!
-s
/etc/sssd/sssd.conf
]
;
then
SSSDCONF
=
/etc/sssd/sssd.conf
fi
cat
<<
EOF
>
/etc/sssd/conf.d/ad.conf
|| fatal
cat
<<
EOF
>
$SSSDCONF
|| fatal
[sssd]
[sssd]
config_file_version = 2
config_file_version = 2
services = nss, pam
services = nss, pam
...
@@ -98,15 +109,16 @@ domains = $REALM
...
@@ -98,15 +109,16 @@ domains = $REALM
debug_level = 1
debug_level = 1
EOF
EOF
# TODO: что на других системах?
if
[
"
$(
epm print info
-d
)
"
=
"ALTLinux"
]
;
then
if
[
"
$(
epm print info
-d
)
"
=
"ALTLinux"
]
;
then
cat
<<
EOF
>>
/etc/sssd/conf.d/ad.conf
|| fatal
cat
<<
EOF
>>
$SSSDCONF
|| fatal
; Should be used until ALT#34124 will be resolved
; Should be used until ALT#34124 will be resolved
user = root
user = root
EOF
EOF
fi
fi
cat
<<
EOF
>>
/etc/sssd/conf.d/ad.conf
|| fatal
cat
<<
EOF
>>
$SSSDCONF
|| fatal
[nss]
[nss]
debug_level = 1
debug_level = 1
...
@@ -131,30 +143,21 @@ ldap_chpass_dns_service_name = ad
...
@@ -131,30 +143,21 @@ ldap_chpass_dns_service_name = ad
ldap_id_mapping = False
ldap_id_mapping = False
use_fully_qualified_names = False
use_fully_qualified_names = False
; always ask KDC
cache_credentials = true
cache_credentials = true
enumerate = true
enumerate = true
dyndns_update = False
dyndns_update = False
EOF
EOF
chmod
0600 /etc/sssd/conf.d/ad.conf
chmod
0600
$SSSDCONF
else
echo
"Skipping sssd conf creating (/etc/sssd/conf.d/ad.conf is exists)"
fi
# TODO: Fedora has special command for change nssswitch.conf
# TODO: проверить на ALT, если control system-auth sss уже достаточно
#passwd: files sss
#if ! grep -q " sss" /etc/nsswitch.conf ; then
#shadow: tcb files sss
# for i in passwd shadow group gshadow ; do
#group: files sss role
# subst "s|^\($i:.*\)files\(.*\)|\1files sss\2|g" /etc/nsswitch.conf
#gshadow: files sss
# done
# ( cd /etc ; git diff nsswitch.conf | cat )
if
!
grep
-q
" sss"
/etc/nsswitch.conf
;
then
#fi
for
i
in
passwd shadow group gshadow
;
do
subst
"s|^
\(
$i
:.*
\)
files
\(
.*
\)
|
\1
files sss
\2
|g"
/etc/nsswitch.conf
done
(
cd
/etc
;
git diff nsswitch.conf |
cat
)
fi
# TODO: realmd
# TODO: realmd
...
@@ -186,7 +189,7 @@ kinit $ADMIN || fatal "Can't get kerberos ticket for '$ADMIN'"
...
@@ -186,7 +189,7 @@ kinit $ADMIN || fatal "Can't get kerberos ticket for '$ADMIN'"
echo
"Have got a kerberos ticker!"
echo
"Have got a kerberos ticker!"
[
-f
/etc/krb5.keytab
]
&&
echo
"Removing old keytab /etc/krb5.keytab ..."
&&
rm
-fv
/etc/krb5.keytab
[
-f
/etc/krb5.keytab
]
&&
echo
"Removing old keytab /etc/krb5.keytab ..."
&&
rm
-fv
/etc/krb5.keytab
echo
"Join to domain... "
echo
"Join to domain... "
net ads
join
-k
||
fatal
"Failed to join to the domain '
$REALM
'"
net ads
join
-k
--no-dns-updates
||
fatal
"Failed to join to the domain '
$REALM
'"
kdestroy
kdestroy
case
$(
epm print info
-d
)
in
case
$(
epm print info
-d
)
in
...
@@ -198,11 +201,14 @@ case $(epm print info -d) in
...
@@ -198,11 +201,14 @@ case $(epm print info -d) in
roleadd etersysadmin wheel
roleadd etersysadmin wheel
;;
;;
RedOS|Fedora|CentOS
)
RedOS|Fedora|CentOS
)
echo
"Check the script for autoselect"
#
echo "Check the script for autoselect"
authselect
select
sssd
--force
authselect
select
sssd
--force
authselect apply-changes
authselect apply-changes
authconfig
--enablemkhomedir
authconfig
--enablemkhomedir
;;
;;
Debian|Ubuntu|AstraLinux
)
pam-auth-update
--package
;;
*
)
*
)
echo
"Unknown system
$(
epm print info
-d
)
. Check /etc/pam.d/system-auth for pam_sss.so using"
echo
"Unknown system
$(
epm print info
-d
)
. Check /etc/pam.d/system-auth for pam_sss.so using"
;;
;;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment