Author Topic: auto update shallalist  (Read 5249 times)

fedotov_andrey

  • Zen Warrior
  • ***
  • Posts: 199
  • Karma: +16/-0
  • zentyal.su
    • View Profile
auto update shallalist
« on: April 15, 2014, 08:31:06 am »
Prompt, where the error?
Once the script is done, squid does not start.

Code: [Select]
#!/bin/sh
#
# u.sh, v 0.1 20140409

tmpdir="/var/tmp/blacklist"
workdir="/var/lib/zentyal/files/squid/categories/shallalist"
shallalist="http://www.shallalist.de/Downloads/shallalist.tar.gz"

rm -rf $tmpdir
mkdir $tmpdir

wget $shallalist -O $tmpdir/shallalist.tar.gz

tar xzf $tmpdir/shallalist.tar.gz -C $tmpdir


find /$tmpdir -type f -name domains -execdir sed 's/^/./wdomains.squid' {} \;


find /$tmpdir -type d -exec chmod 755 {} \;
find /$tmpdir -type d -exec chown root:ebox {} \;


rm -rf $workdir
mkdir $workdir


mv $tmpdir/BL $workdir


service squid3 restart


Oliver Sauder

  • Zen Apprentice
  • *
  • Posts: 8
  • Karma: +1/-0
    • View Profile
Re: auto update shallalist
« Reply #1 on: April 16, 2014, 03:39:13 pm »
I have been also looking for a automatic update shallalist script when I stumbled upon this post.

I have tested your script and also have the same issue that squid refuses connections after script has run.

I replaced service squid3 restart with /etc/init.d/zentyal squid restart to restart all zentyal proxy related services. Did not really help. Maybe anyone else has an idea?

fedotov_andrey

  • Zen Warrior
  • ***
  • Posts: 199
  • Karma: +16/-0
  • zentyal.su
    • View Profile
Re: auto update shallalist
« Reply #2 on: April 22, 2014, 10:03:13 am »
we need people who understand the programming php to figure out how it happens.
who can help?

Jott-Emm

  • Zen Apprentice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: auto update shallalist
« Reply #3 on: July 05, 2014, 12:29:00 pm »
Hello!
An analysis of your script has shown that a file could be missing. The source-file "shallalist.tar.gz"  must be in the folder /var/lib/zentyal/files/squid/archives and it has to be renamed to the name, the category-list has in zentyal. And you have to set the permissions of that file correctly (ebox:ebox -rw-------). I have downloaded the file shalla-update.sh from http://www.shallalist.de/helpers.html and customized it for me (attached to this reply). It works as cron-job, but after update I missed some special files in the blacklist, which were generated by the first installation with zentyal. At the moment, I have not recognized any problems by missing that files. If someone knows how to generate that special dansguard-files, let us know.
If you use the script in the attachment, you have to customize it for your own use. Please read the comments. But some comments are in german ... 8)

tuklu_san

  • Zen Apprentice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: auto update shallalist
« Reply #4 on: October 11, 2014, 05:33:23 pm »
The file permissions seem to be really important. This mashed-up cron job works on Zentyal 3.5. Before putting it into a cron job, download the http://www.shallalist.de/Downloads/shallalist.tar.gz blacklist file to a temporary directory (e.g. /tmp), and go to https://<your zentyal IP address>/Squid/View/CategorizedLists, add a new categorized list called "shallalist.tar.gz" and use the "File" button to load the downloaded blacklist file (e.g. /tmp/shallalist.tar.gz) into Zentyal. This creates the required directory structure for the script to run successfully then onwards. Adjust the script for the IP address of your Zentyal box. You can then use an entry in root's crontab like
47 5 * * * /home/<username>/blacklist_update.sh > /var/log/blacklist_update.log 2>&1
to automate updates to the blacklist.



# blacklist_update.sh
# Change the downloaded file name : BLACKLIST_NAME
# See it at https://<Your Zentyal IP Address>/Squid/View/CategorizedLists
BLACKLIST_NAME="shallalist.tar.gz"

# --- You should not need to change below here
DOWNLOAD_URL=http://www.shallalist.de/Downloads/shallalist.tar.gz
DIR="/var/lib/zentyal/files/squid/categories/${BLACKLIST_NAME}"
ARCHIVE_DIR="/var/lib/zentyal/files/squid/archives/"

wget $DOWNLOAD_URL -O ${DIR}/${BLACKLIST_NAME}
tar xvzf ${DIR}/${BLACKLIST_NAME} -C ${DIR}/
mv -vf ${DIR}/${BLACKLIST_NAME} ${ARCHIVE_DIR}
chmod -Rfv 644 ${DIR}
chown -Rfv root:ebox ${DIR}
chmod -Rfv 666 ${ARCHIVE_DIR}
ls -lR ${DIR}
ls -lR ${ARCHIVE_DIR}
service zentyal squid restart
« Last Edit: October 11, 2014, 08:48:55 pm by tuklu_san »