diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-12-22 13:46:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-22 13:46:58 +0100 |
commit | eb313d1ce15b65a5d4f69338f00beeeb5e824652 (patch) | |
tree | 7b0088f3218dd19a71e7c1da71fbfa7313538bd8 /src/op_mode | |
parent | 0cbd24fb4a73c7a7cab6243830fcff7c5ae6bcf1 (diff) | |
parent | ba9850c74b3d79d7b75093c3ef88fa97fa244b9f (diff) | |
download | vyos-1x-eb313d1ce15b65a5d4f69338f00beeeb5e824652.tar.gz vyos-1x-eb313d1ce15b65a5d4f69338f00beeeb5e824652.zip |
Merge pull request #1722 from aapostoliuk/webproxybackport
T3810: Fixed all issues in T3810
Diffstat (limited to 'src/op_mode')
-rwxr-xr-x | src/op_mode/webproxy_update_blacklist.sh | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/op_mode/webproxy_update_blacklist.sh b/src/op_mode/webproxy_update_blacklist.sh index 43a4b79fc..4fb9a54c6 100755 --- a/src/op_mode/webproxy_update_blacklist.sh +++ b/src/op_mode/webproxy_update_blacklist.sh @@ -18,6 +18,23 @@ blacklist_url='ftp://ftp.univ-tlse1.fr/pub/reseau/cache/squidguard_contrib/black data_dir="/opt/vyatta/etc/config/url-filtering" archive="${data_dir}/squidguard/archive" db_dir="${data_dir}/squidguard/db" +conf_file="/etc/squidguard/squidGuard.conf" +tmp_conf_file="/tmp/sg_update_db.conf" + +#$1-category +#$2-type +#$3-list +create_sg_db () +{ + FILE=$db_dir/$1/$2 + if test -f "$FILE"; then + rm -f ${tmp_conf_file} + printf "dbhome $db_dir\ndest $1 {\n $3 $1/$2\n}\nacl {\n default {\n pass any\n }\n}" >> ${tmp_conf_file} + /usr/bin/squidGuard -b -c ${tmp_conf_file} -C $FILE + rm -f ${tmp_conf_file} + fi + +} while [ $# -gt 0 ] do @@ -88,7 +105,17 @@ if [[ -n $update ]] && [[ $update -eq "yes" ]]; then # fix permissions chown -R proxy:proxy ${db_dir} - chmod 2770 ${db_dir} + + #create db + category_list=(`find $db_dir -type d -exec basename {} \; `) + for category in ${category_list[@]} + do + create_sg_db $category "domains" "domainlist" + create_sg_db $category "urls" "urllist" + create_sg_db $category "expressions" "expressionlist" + done + chown -R proxy:proxy ${db_dir} + chmod 755 ${db_dir} logger --priority WARNING "webproxy blacklist entries updated (${count_before}/${count_after})" |