From 40b794e6f4bb05f3cde1499b324df09d2431db30 Mon Sep 17 00:00:00 2001 From: q3aql Date: Sun, 14 Apr 2024 20:41:58 +0200 Subject: [PATCH] Check integrity of configuration file --- blockauth | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/blockauth b/blockauth index 67bca5d..ccdf28e 100755 --- a/blockauth +++ b/blockauth @@ -78,8 +78,27 @@ else echo "always_ip_allowed=\"192.168.0.1 192.168.0.2\"" >> /etc/blockauth/blockauth.conf echo "blocklist=\"/etc/blockauth/blocklist.list\"" >> /etc/blockauth/blockauth.conf echo "filelog=\"/etc/blockauth/blockauth.log\"" >> /etc/blockauth/blockauth.conf + echo "max_ip_blocklist=\"12500\"" >> /etc/blockauth/blockauth.conf fi +# Check integrity of configuration file +if [ -z "${valid_users}" ] ; then + echo "valid_users=\"test1 test2\"" >> /etc/blockauth/blockauth.conf +fi +if [ -z "${always_ip_allowed}" ] ; then + echo "always_ip_allowed=\"192.168.0.1 192.168.0.2\"" >> /etc/blockauth/blockauth.conf +fi +if [ -z "${blocklist}" ] ; then + echo "blocklist=\"/etc/blockauth/blocklist.list\"" >> /etc/blockauth/blockauth.conf +fi +if [ -z "${filelog}" ] ; then + echo "filelog=\"/etc/blockauth/blockauth.log\"" >> /etc/blockauth/blockauth.conf +fi +if [ -z "${max_ip_blocklist}" ] ; then + echo "max_ip_blocklist=\"12500\"" >> /etc/blockauth/blockauth.conf +fi +source /etc/blockauth/blockauth.conf + echo "blockauth: running process" blockauth=0 while [ ${blockauth} -eq 0 ] ; do