Subversion Repositories ALCASAR

Rev

Rev 2712 | Rev 2883 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2712 Rev 2841
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
#
2
#
3
# $Id: alcasar-conup.sh 2712 2019-03-10 23:28:36Z tom.houdayer $
3
# $Id: alcasar-conup.sh 2841 2020-06-28 21:49:00Z rexy $
4
#
4
#
5
# alcasar-conup.sh
5
# alcasar-conup.sh
6
# by Rexy
6
# by Rexy
7
# This script is distributed under the Gnu General Public License (GPL)
7
# This script is distributed under the Gnu General Public License (GPL)
8
 
8
 
Line 29... Line 29...
29
 
29
 
30
filter=$(echo "$db_res"             | awk '$1 == "Alcasar-Filter"                     { print $2 }')
30
filter=$(echo "$db_res"             | awk '$1 == "Alcasar-Filter"                     { print $2 }')
31
filterProto=$(echo "$db_res"        | awk '$1 == "Alcasar-Protocols-Filter"           { print $2 }')
31
filterProto=$(echo "$db_res"        | awk '$1 == "Alcasar-Protocols-Filter"           { print $2 }')
32
statusOpenRequired=$(echo "$db_res" | awk '$1 == "Alcasar-Status-Page-Must-Stay-Open" { print $2 }')
32
statusOpenRequired=$(echo "$db_res" | awk '$1 == "Alcasar-Status-Page-Must-Stay-Open" { print $2 }')
33
 
33
 
34
if [ "$filter" == '4' ]; then	# HAVP_WL
34
if [ "$filter" == '4' ]; then	# AV_WL
35
	set_filter="havp_wl"
35
	set_filter="av_wl"
36
elif [ "$filter" == '3' ]; then	# HAVP_BL
36
elif [ "$filter" == '3' ]; then	# AV_BL
37
	set_filter="havp_bl"
37
	set_filter="av_bl"
38
elif [ "$filter" == '2' ]; then	# HAVP
38
elif [ "$filter" == '2' ]; then	# AV
39
	set_filter="havp"
39
	set_filter="av"
40
else				# NOT_FILTERED
40
else				# NOT_FILTERED
41
	set_filter="not_filtered"
41
	set_filter="not_filtered"
42
fi
42
fi
43
 
43
 
44
if [ "$filterProto" == '4' ]; then	# PROFILE 3 (Custom)
44
if [ "$filterProto" == '4' ]; then	# PROFILE 3 (Custom)
Line 53... Line 53...
53
 
53
 
54
ipset add $set_filter      $FRAMED_IP_ADDRESS
54
ipset add $set_filter      $FRAMED_IP_ADDRESS
55
ipset add $set_filterProto $FRAMED_IP_ADDRESS
55
ipset add $set_filterProto $FRAMED_IP_ADDRESS
56
 
56
 
57
# Add user IP permanently to current_users.txt if no status_open_required
57
# Add user IP permanently to current_users.txt if no status_open_required
58
current_users_file="/var/tmp/havp/current_users.txt"
58
current_users_file="/tmp/current_users.txt"
59
[ ! -e $current_users_file ] && touch $current_users_file && chown apache:apache $current_users_file
59
[ ! -e $current_users_file ] && touch $current_users_file && chown apache:apache $current_users_file
60
if [ "$statusOpenRequired" == '2' ]; then	# no status_open_required
60
if [ "$statusOpenRequired" == '2' ]; then	# no status_open_required
61
	echo "$FRAMED_IP_ADDRESS:PERM" >> $current_users_file
61
	echo "$FRAMED_IP_ADDRESS:PERM" >> $current_users_file
62
fi
62
fi
63
 
63