mirror of
https://github.com/m8tin/cis.git
synced 2025-12-06 15:58:26 +01:00
Revised and CIS introduced
This commit is contained in:
@@ -51,17 +51,17 @@ function prepareFolder() {
|
||||
}
|
||||
|
||||
function defineAuthorizedKeysOfUser() {
|
||||
local _ROOT _CORE_SCRIPTS _DOMAIN _DEFINITIONS _USER
|
||||
local _CIS_ROOT _CORE_SCRIPTS _DOMAIN _DEFINITIONS _USER
|
||||
_DEFINITIONS="$(realpath -s "${1:?"Missing first parameter DEFINITIONS: 'ROOT/definitions/DOMAIN'"}")"
|
||||
_ROOT="${_DEFINITIONS%%/definitions/*}/" #Removes longest matching pattern '/definitions/*' from the end
|
||||
_DOMAIN="${_DEFINITIONS##*/definitions/}" #Removes longest matching pattern '*/definitions/' from the begin
|
||||
_DOMAIN="${_DOMAIN%/}" #Removes shortest matching pattern '/' from the end
|
||||
_CIS_ROOT="${_DEFINITIONS%%/definitions/*}/" #Removes longest matching pattern '/definitions/*' from the end
|
||||
_DOMAIN="${_DEFINITIONS##*/definitions/}" #Removes longest matching pattern '*/definitions/' from the begin
|
||||
_DOMAIN="${_DOMAIN%/}" #Removes shortest matching pattern '/' from the end
|
||||
#Build from components for safety
|
||||
_DEFINITIONS="${_ROOT:?"Missing ROOT"}definitions/${_DOMAIN:?"Missing DOMAIN"}"
|
||||
_DEFINITIONS="${_CIS_ROOT:?"Missing ROOT"}definitions/${_DOMAIN:?"Missing DOMAIN"}"
|
||||
|
||||
_USER="${2:?"Missing second parameter USER"}"
|
||||
_CORE_SCRIPTS="${_ROOT:?"Missing ROOT"}core/"
|
||||
readonly _ROOT _CORE_SCRIPTS _DOMAIN _DEFINITIONS _USER
|
||||
_CORE_SCRIPTS="${_CIS_ROOT:?"Missing ROOT"}core/"
|
||||
readonly _CIS_ROOT _CORE_SCRIPTS _DOMAIN _DEFINITIONS _USER
|
||||
|
||||
case "${_USER:?"Missing USER"}" in
|
||||
root)
|
||||
@@ -83,4 +83,6 @@ function defineAuthorizedKeysOfUser() {
|
||||
defineAuthorizedKeysOfUser \
|
||||
"$(echo ${1} | sed -E 's|[^a-zA-Z0-9/:@._-]*||g')" \
|
||||
"$(echo ${2} | sed -E 's|[^a-zA-Z0-9/:@._-]*||g')" \
|
||||
&& exit 0 || exit 1
|
||||
&& exit 0
|
||||
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user