|
|
@@ -476,7 +476,8 @@ create_user() {
|
|
|
if ! [[ "$limit" =~ ^[0-9]+$ ]]; then echo -e "\n${C_RED}❌ Invalid number.${C_RESET}"; return; fi
|
|
|
local expire_date
|
|
|
expire_date=$(date -d "+$days days" +%Y-%m-%d)
|
|
|
- useradd -m -s /usr/sbin/nologin "$username"; echo "$username:$password" | chpasswd; chage -E "$expire_date" "$username"
|
|
|
+ expire_date=$(date -d "+$days days" +%Y-%m-%d)
|
|
|
+ useradd -m -s /usr/local/bin/firewallfalcon-shell "$username"; echo "$username:$password" | chpasswd; chage -E "$expire_date" "$username"
|
|
|
echo "$username:$password:$expire_date:$limit" >> "$DB_FILE"
|
|
|
|
|
|
clear; show_banner
|
|
|
@@ -2521,7 +2522,7 @@ fi
|
|
|
EOF
|
|
|
chmod +x "$login_script"
|
|
|
|
|
|
- # Add to profile.d so it runs on login
|
|
|
+ # Add to profile.d so it runs on login (fallback)
|
|
|
cat > /etc/profile.d/00-firewallfalcon-login.sh <<EOF
|
|
|
#!/bin/bash
|
|
|
if [ -x "$login_script" ]; then
|
|
|
@@ -2529,6 +2530,30 @@ if [ -x "$login_script" ]; then
|
|
|
fi
|
|
|
EOF
|
|
|
chmod +x /etc/profile.d/00-firewallfalcon-login.sh
|
|
|
+
|
|
|
+ # Create a Custom Shell Wrapper
|
|
|
+ # This ensures the banner is shown even for non-interactive logins (common in VPN apps)
|
|
|
+ local custom_shell="/usr/local/bin/firewallfalcon-shell"
|
|
|
+ cat > "$custom_shell" <<EOF
|
|
|
+#!/bin/bash
|
|
|
+# Run the login notifier script first
|
|
|
+if [ -x "$login_script" ]; then
|
|
|
+ "$login_script"
|
|
|
+fi
|
|
|
+
|
|
|
+# Then execute the requested command or fall back to bash
|
|
|
+if [ -n "\$SSH_ORIGINAL_COMMAND" ]; then
|
|
|
+ eval "\$SSH_ORIGINAL_COMMAND"
|
|
|
+else
|
|
|
+ exec /bin/bash -l
|
|
|
+fi
|
|
|
+EOF
|
|
|
+ chmod +x "$custom_shell"
|
|
|
+
|
|
|
+ # Ensure it's in /etc/shells
|
|
|
+ if ! grep -q "$custom_shell" /etc/shells; then
|
|
|
+ echo "$custom_shell" >> /etc/shells
|
|
|
+ fi
|
|
|
}
|
|
|
|
|
|
|