bump to version 0.99.18
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Add local or remote users
|
||||
# This file is part of the init.sh project
|
||||
# Copyright (c) 2019-2021 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
|
||||
# Copyright (c) 2019-2022 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
|
||||
# ------------------------------------------------------------------------------
|
||||
# This file is distributed under 3-clause BSD license.
|
||||
# The complete license agreement can be obtained at:
|
||||
@@ -13,14 +13,14 @@
|
||||
# * KDC_SERVER: Kerberos domain controler KADM_SERVER
|
||||
# * KADM_SERVER: Administrative Kerberos KADM_SERVER
|
||||
# * BASE_DC: Domain in LDAP format
|
||||
# * LDAP_SERVER: LDAP server
|
||||
# * LDAP_SERVER: LDAP server name or address
|
||||
# * REMOTE_USERS: List of remote users to add
|
||||
# * LOCAL_USERS: List of local users to create
|
||||
# * REMOVE_USERS: List of username to remove
|
||||
# * DEFAULT_SHELL: The shell to use when creating new users
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
export VER_authnz=0.2.1
|
||||
export VER_authnz=0.2.2
|
||||
export DEP_authnz="upgrade_dist"
|
||||
|
||||
# Users (from Ldap)
|
||||
@@ -35,7 +35,7 @@ add_remote_user()
|
||||
echo "+$1::::::" >> /etc/passwd
|
||||
prnt I "User $1 added to passwd..."
|
||||
fi
|
||||
if [[ $(grep "^+$1:" /etc/passwd) ]]; then
|
||||
if [[ $(grep "^+$1:" /etc/shadow) ]]; then
|
||||
prnt W "The remote user $1 is already connectable, nothing to do in shadow."
|
||||
else
|
||||
echo "+$1::::::::" >> /etc/shadow
|
||||
@@ -47,8 +47,11 @@ add_remote_user()
|
||||
remove_user()
|
||||
{
|
||||
if [[ $(grep "^$1:" /etc/{passwd,shadow,group,gshadow}) ]]; then
|
||||
# Using sed is more universal than any distro commands
|
||||
# Using sed is more universal than any distro commands - local case
|
||||
sed -i -e "/^$1:/d" /etc/{passwd,shadow,group,gshadow}
|
||||
elif [[ $(grep "^+$1:" /etc/{passwd,shadow,group,gshadow}) ]]; then
|
||||
# remote case
|
||||
sed -i -e "/^+$1:/d" /etc/{passwd,shadow,group,gshadow}
|
||||
else
|
||||
prnt W "User $1 don't exists in auth files, nothing to do."
|
||||
fi
|
||||
@@ -73,8 +76,8 @@ create_local_user()
|
||||
# Authentication
|
||||
authnz()
|
||||
{
|
||||
backup_dist /etc/passwd /etc/shadow /etc/group
|
||||
tag_file /etc/passwd /etc/shadow /etc/group
|
||||
backup_dist /etc/{passwd,shadow,group,gshadow}
|
||||
tag_file /etc/{passwd,shadow,group,gshadow}
|
||||
for usr in $REMOVE_USERS; do
|
||||
prnt I "Removing user $usr..."
|
||||
remove_user $usr
|
||||
@@ -111,14 +114,13 @@ authnz()
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -z $LOCAL_USERS ]]; then
|
||||
return 0
|
||||
if [[ -n $LOCAL_USERS ]]; then
|
||||
for usr in $LOCAL_USERS; do
|
||||
prnt I "Creating user $usr..."
|
||||
create_local_user $usr
|
||||
done
|
||||
fi
|
||||
|
||||
for usr in $LOCAL_USERS; do
|
||||
prnt I "Creating user $usr..."
|
||||
create_local_user $usr
|
||||
done
|
||||
NEED_REBOOT=true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user