From fb145c1e962d63412e9107d45b9d9f6bbac24d21 Mon Sep 17 00:00:00 2001 From: Mikhail Novosyolov Date: Tue, 9 Feb 2021 17:02:47 +0300 Subject: [PATCH] Add forgotten reading of ACL for all servers --- duma-ssh-central-auth.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/duma-ssh-central-auth.sh b/duma-ssh-central-auth.sh index 7d625dc..eb4ccc8 100755 --- a/duma-ssh-central-auth.sh +++ b/duma-ssh-central-auth.sh @@ -16,6 +16,7 @@ _main(){ echo_err "No user defined!" return 1 fi + ALLOWED=0 user="$1" # not --fqdn, it may give strange results, # e.g. webinar.dumalogiya.ru -> webinar @@ -43,9 +44,15 @@ _main(){ ACL="${DIR}/servers/${hostname}" if [ ! -f "$ACL" ] || [ ! -r "$ACL" ]; then echo_err "ACL for this server does not exist or cannot be read!" - return 2 fi if grep -q "^${user}$" "$ACL"; then + ALLOWED=1 + else + if grep -q "^${user}$" "${DIR}/servers/all"; then + ALLOWED=1 + fi + fi + if [ "$ALLOWED" = 1 ]; then # Выводим все публичные ключи пользователя на stdout # Если файлы не будут найдены, xargs сделает ненулевой код возврата find "${DIR}/users/${user}" -name "*.key" -type f | xargs cat