|
|
@@ -0,0 +1,45 @@
|
|
|
+#!/bin/bash
|
|
|
+# info: add user login
|
|
|
+# options: USER IP [FINGERPRINT]
|
|
|
+
|
|
|
+# Argument definition
|
|
|
+user=$1
|
|
|
+ip=$2
|
|
|
+fingerprint=${3}
|
|
|
+
|
|
|
+# Includes
|
|
|
+source $HESTIA/func/main.sh
|
|
|
+source $HESTIA/conf/hestia.conf
|
|
|
+
|
|
|
+#----------------------------------------------------------#
|
|
|
+# Verifications #
|
|
|
+#----------------------------------------------------------#
|
|
|
+
|
|
|
+check_args '2' "$#" 'USER IP [FINGERPRINT]'
|
|
|
+is_format_valid 'user' 'ip'
|
|
|
+is_object_valid 'user' 'USER' "$user"
|
|
|
+
|
|
|
+browser=$(echo $browser | sed -e "s/\'//g");
|
|
|
+
|
|
|
+# Generating timestamp
|
|
|
+time_n_date=$(date +'%T %F')
|
|
|
+time=$(echo "$time_n_date" |cut -f 1 -d \ )
|
|
|
+date=$(echo "$time_n_date" |cut -f 2 -d \ )
|
|
|
+
|
|
|
+if [ ! -f $HESTIA/data/users/$user/auth.log ]; then
|
|
|
+ touch $HESTIA/data/users/$user/auth.log
|
|
|
+fi
|
|
|
+
|
|
|
+#----------------------------------------------------------#
|
|
|
+# Action #
|
|
|
+#----------------------------------------------------------#
|
|
|
+
|
|
|
+awk -i inplace -v finger="FINGERPRINT='$fingerprint'" -v active="active='no'" '$2 == finger {$5=active}1' $HESTIA/data/users/$user/auth.log
|
|
|
+
|
|
|
+echo "IP='$ip' FINGERPRINT='$fingerprint' DATE='$date' TIME='$time' active='yes'" >> $HESTIA/data/users/$user/auth.log
|
|
|
+
|
|
|
+#----------------------------------------------------------#
|
|
|
+# Hestia #
|
|
|
+#----------------------------------------------------------#
|
|
|
+
|
|
|
+exit
|