|
|
|
@@ -4,9 +4,6 @@
|
|
|
|
|
# Implements 2FA for SSH, Cockpit, and Webmin services
|
|
|
|
|
# Uses Google Authenticator (TOTP) for time-based tokens
|
|
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
# Source framework functions
|
|
|
|
|
# Script can be called from different contexts, so use absolute path resolution
|
|
|
|
|
SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
|
|
|
|
|
PROJECT_ROOT="$(dirname "$(dirname "$(dirname "$SCRIPT_DIR")")")"
|
|
|
|
@@ -14,9 +11,27 @@ PROJECT_ROOT="$(dirname "$(dirname "$(dirname "$SCRIPT_DIR")")")"
|
|
|
|
|
# Set up framework variables expected by includes
|
|
|
|
|
export PROJECT_ROOT_PATH="$PROJECT_ROOT"
|
|
|
|
|
|
|
|
|
|
source "$PROJECT_ROOT/Framework-Includes/PrettyPrint.sh"
|
|
|
|
|
source "$PROJECT_ROOT/Framework-Includes/Logging.sh"
|
|
|
|
|
source "$PROJECT_ROOT/Framework-Includes/ErrorHandling.sh"
|
|
|
|
|
export PROJECT_ROOT_PATH
|
|
|
|
|
PROJECT_ROOT_PATH="$(realpath ../../../)"
|
|
|
|
|
|
|
|
|
|
export GIT_VENDOR_PATH_ROOT
|
|
|
|
|
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
|
|
|
|
|
|
|
|
|
|
export KNELShellFrameworkRoot
|
|
|
|
|
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
|
|
|
|
|
|
|
|
|
|
#Framework variables are read from hee
|
|
|
|
|
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
|
|
|
|
|
|
|
|
|
|
# Source framework functions
|
|
|
|
|
for framework_include_file in $KNELShellFrameworkRoot/Framework-Includes/*; do
|
|
|
|
|
source "$framework_include_file"
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
for project_include_file in ../Project-Includes/*; do
|
|
|
|
|
source "$project_include_file"
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 2FA Configuration
|
|
|
|
|
BACKUP_DIR="/root/backup/2fa"
|
|
|
|
|