|
|
(182 versions intermédiaires par 5 utilisateurs non affichées) |
Ligne 1 : |
Ligne 1 : |
| lien sur le [http://www.debian-fr.org/controle-parental-pour-le-pc-debian-de-vos-enfants-t42009.html forum]
| | __TOC__ |
| '''CTparental.sh'''
| |
| <code bash>
| |
| #!/bin/bash
| |
| # CTparental.sh
| |
| #
| |
| # par guillaume MARSAT
| |
| # une parti du code est tirer du scripte alcasar-bl.sh créer par Franck BOUIJOUX and Richard REY
| |
| # présent dans le code du projet alcasar en version 2.6.1 ; web page http://www.alcasar.net/
| |
|
| |
|
| # This script is distributed under the Gnu General Public License (GPL)
| | Petit rappel : Le contrôle parental ne doit pas se substituer aux coups d’œil et dialogues avec vos enfants de temps en temps mais apporte un plus. |
| #if [ ! $UID -eq 0 ]; then
| |
| # echo "Il vous faut les droit root pour lancer ce scripte"
| |
| # exit 1
| |
| #fi
| |
| args=${1}
| |
| SED="/bin/sed -i"
| |
| DIR_CONF="/usr/local/etc/CTparental"
| |
| FILE_CONF="$DIR_CONF/CTparental.conf"
| |
| FILE_HCONF="$DIR_CONF/CThours.conf";
| |
| if [ ! -f $FILE_CONF ] ; then
| |
| mkdir -p $DIR_CONF
| |
| cat << EOF > $FILE_CONF
| |
| LASTUPDATE=0
| |
| DNSMASQ=BLACK
| |
| AUTOUPDATE=OFF
| |
| HOURSCONNECT=OFF
| |
| EOF
| |
|
| |
|
| fi
| | Je vous propose donc de mettre en place un filtrage directement sur le pc a protéger, à l'aide de : |
|
| |
|
| tempDIR="/tmp/alcasar"
| | iptables+dnsmasq+dansguardian+privoxy (Pour le filtrage) |
| RougeD="\033[1;31m"
| |
| BleuD="\033[1;36m"
| |
| VertD="\033[1;32m"
| |
| Fcolor="\033[0m"
| |
| GESTIONNAIREDESESSIONS=" login gdm lightdm slim kdm xdm "
| |
| FILEPAMTIMECONF="/etc/security/time.conf"
| |
| DIRPAM="/etc/pam.d/"
| |
| DAYS=( lundi mardi mercredi jeudi vendredi samedi dimanche )
| |
| DAYSPAM=( Mo Tu We Th Fr Sa Su )
| |
| DAYSCRON=( mon tue wed thu fri sat sun )
| |
|
| |
| service --help 2&> /dev/null
| |
| if [ $? -eq 0 ] ; then
| |
| CMDSERVICE="service "
| |
| else
| |
| CMDSERVICE="/etc/init.d/"
| |
| fi
| |
| DNSMASQCONF="/etc/dnsmasq.conf"
| |
| MAINCONFHTTPD="/etc/lighttpd/lighttpd.conf"
| |
| DIRCONFENABLEDHTTPD="/etc/lighttpd/conf-enabled"
| |
| CTPARENTALCONFHTTPD=$DIRCONFENABLEDHTTPD"/10-CTparental.conf"
| |
| RESOLVCONFMAIN="/etc/resolvconf"
| |
| RESOLVDNSMASQ="$RESOLVCONFMAIN/run/interface/lo.dnsmasq"
| |
| RESOLVCONFORDER="$RESOLVCONFMAIN/interface-order"
| |
| DIRHTML="/var/www/CTparental"
| |
| DIRadminHTML="/var/www/CTadmin"
| |
| namservicednsmaq="dnsmasq"
| |
| namservicehttpd="lighttpd"
| |
| namservicecrond="cron"
| |
| PASSWORDFILEHTTPD="/etc/lighttpd/lighttpd-htdigest.user"
| |
| REALMADMINHTTPD="interface admin"
| |
| CMDINSTALL=""
| |
| yum help 2&> /dev/null
| |
| if [ $? -eq 0 ] ; then
| |
| ## "Distribution baser sur yum exemple readhat,fedora..."
| |
| CMDINSTALL="yum install "
| |
| CMDREMOVE="yum remove "
| |
| yum info openresolv 2&> /dev/null
| |
| if [ $? -eq 0 ] ; then
| |
| paquetresolv="openresolv"
| |
| else
| |
| paquetresolv="resolvconf"
| |
| fi
| |
| fi
| |
| urpmi --help 2&> /dev/null
| |
| if [ $? -eq 1 ] ; then
| |
| ## "Distribution baser sur urpmi exemple mandriva..."
| |
| CMDINSTALL="urpmi -a --auto "
| |
| CMDREMOVE="urpme --auto "
| |
| namservicecrond="crond"
| |
| paquetresolv="openresolv"
| |
| fi
| |
| apt-get -h 2&> /dev/null
| |
| if [ $? -eq 0 ] ; then
| |
| ## "Distribution baser sur apt-get exemple debian,ubuntu ..."
| |
| CMDINSTALL="apt-get -y --force-yes install "
| |
| CMDREMOVE="apt-get -y --force-yes remove --purge "
| |
| paquetresolv="resolvconf" # pour compatibiliter debian 6
| |
| fi
| |
| if [ $args="-i" ] ; then
| |
| namserviceNetworkManager="network-manager"
| |
| if [ -f /etc/NetworkManager/NetworkManager.conf ];then
| |
| $SED "s/^dns=dnsmasq/#dns=dnsmasq/g" /etc/NetworkManager/NetworkManager.conf
| |
| $CMDSERVICE$namserviceNetworkManager restart
| |
| sleep 5
| |
| fi
| |
| fi
| |
| if [ $( echo $CMDINSTALL | wc -m ) -eq 1 ] ; then
| |
| echo "Aucun gestionner de paquet connu , n'a été détecté."
| |
| exit 1
| |
| fi
| |
|
| |
|
| | lighttpd (Pour la page de redirection et l'interface d'administration) |
|
| |
|
|
| |
|
| interface_WAN=$(ip route | awk '/^default via/{print $5}') # suppose que la passerelle est la route par default
| |
|
| |
|
| if [ -f $DIR_CONF/resolv.conf.sav ];then
| | == Les sources. == |
| DNS1=$(cat $DIR_CONF/resolv.conf.sav | grep ^nameserver | cut -d " " -f2 | tr "\n" " " | cut -d " " -f1)
| |
| DNS2=$(cat $DIR_CONF/resolv.conf.sav | grep ^nameserver | cut -d " " -f2 | tr "\n" " " | cut -d " " -f2)
| |
| else
| |
| DNS1=$(cat /etc/resolv.conf | grep ^nameserver | cut -d " " -f2 | tr "\n" " " | cut -d " " -f1)
| |
| DNS2=$(cat /etc/resolv.conf | grep ^nameserver | cut -d " " -f2 | tr "\n" " " | cut -d " " -f2)
| |
| fi
| |
|
| |
|
| PRIVATE_IP="127.0.0.10"
| | Toutes les sources sont sur le [https://gitlab.com/marsat/CTparental site officiel] |
| FILE_tmp="$tempDIR/filetmp.txt"
| |
| BL_SERVER="dsi.ut-capitole.fr"
| |
| CATEGORIES_ENABLED="$DIR_CONF/categories-enabled"
| |
| BL_CATEGORIES_AVAILABLE="$DIR_CONF/bl-categories-available"
| |
| WL_CATEGORIES_AVAILABLE="$DIR_CONF/wl-categories-available"
| |
| DIR_DNS_FILTER_AVAILABLE="$DIR_CONF/dnsfilter-available"
| |
| DIR_DNS_BLACKLISTE_ENABLED="$DIR_CONF/blackliste-enabled"
| |
| DIR_DNS_WHITELIST_ENABLED="$DIR_CONF/whitelist-enabled"
| |
| DNS_FILTER_OSSI="$DIR_CONF/blackliste-local"
| |
| DREAB="$DIR_CONF/domaine-rehabiliter"
| |
| THISDAYS=$(expr $(date +%Y) \* 365 + $(date +%j))
| |
| MAXDAYSFORUPDATE="7" # update tous les 7 jours
| |
| CHEMINCTPARENTLE=$(readlink -f $0)
| |
|
| |
|
| initblenabled () {
| | == Installation par le deb : == |
| cat << EOF > $CATEGORIES_ENABLED
| |
| adult
| |
| agressif
| |
| dangerous_material
| |
| dating
| |
| drogue
| |
| gambling
| |
| hacking
| |
| malware
| |
| marketingware
| |
| mixed_adult
| |
| phishing
| |
| redirector
| |
| sect
| |
| strict_redirector
| |
| strong_redirector
| |
| tricheur
| |
| warez
| |
| ossi
| |
| EOF
| |
|
| |
|
| |
|
| }
| | Téléchargez la dernière version deb correspondant à votre distribution sur https://gitlab.com/marsat/CTparental/-/releases . |
|
| |
|
| addadminhttpd() {
| | il y a 2 branches encore actives du logiciel en fonction des paquets utilisés pour effectuer le filtrages, ce qui permet d’être plus modulable en fonction des machines et distributions utilisées. |
| if [ ! -f $PASSWORDFILEHTTPD ] ; then
| | (à partir des versions versions 5.x.x) |
| echo -n > $PASSWORDFILEHTTPD
| |
| fi
| |
| chown root:$USERHTTPD $PASSWORDFILEHTTPD
| |
| chmod 640 $PASSWORDFILEHTTPD
| |
| USERADMINHTTPD=${1}
| |
| pass=${2}
| |
| hash=`echo -n "$USERADMINHTTPD:$REALMADMINHTTPD:$pass" | md5sum | cut -b -32`
| |
| ligne=$(echo "$USERADMINHTTPD:$REALMADMINHTTPD:$hash")
| |
| $SED "/^$USERADMINHTTPD:$REALMADMINHTTPD.*/d" $PASSWORDFILEHTTPD
| |
| echo $ligne >> $PASSWORDFILEHTTPD
| |
| }
| |
|
| |
|
| download() {
| | - '''master''' = nftables (successeur d'iptables), dnscrypt-proxy (remplaçant dnsmasq), lighttpd ou nginx, privoxy et e2guardian ( successeur de dansguardian ). |
| rm -rf $tempDIR
| |
| mkdir $tempDIR
| |
| wget -P $tempDIR http://$BL_SERVER/blacklists/download/blacklists.tar.gz 2>&1 | cat
| |
| if [ ! $? -eq 0 ]; then
| |
| echo "erreur lors du téléchargement processu interompu"
| |
| rm -rf $tempDIR
| |
| exit 1
| |
| fi
| |
| tar -xzf $tempDIR/blacklists.tar.gz -C $tempDIR
| |
| if [ ! $? -eq 0 ]; then
| |
| echo "erreur d'extraction de l'archive processu interompu"
| |
| exit 1
| |
| fi
| |
| rm -rf $DIR_DNS_FILTER_AVAILABLE/
| |
| mkdir $DIR_DNS_FILTER_AVAILABLE
| |
| }
| |
| autoupdate() {
| |
| LASTUPDATEDAY=`grep LASTUPDATE= $FILE_CONF | cut -d"=" -f2`
| |
| LASTUPDATEDAY=${LASTUPDATEDAY:=0}
| |
| DIFFDAY=$(expr $THISDAYS - $LASTUPDATEDAY)
| |
| if [ $DIFFDAY -ge $MAXDAYSFORUPDATE ] ; then
| |
| download
| |
| adapt
| |
| catChoice
| |
| dnsmasqon
| |
| $SED "s?^LASTUPDATE.*?LASTUPDATE=$THISDAYS=`date +%d-%m-%Y\ %T`?g" $FILE_CONF
| |
| exit 0
| |
| fi
| |
| }
| |
| autoupdateon() {
| |
| $SED "s?^AUTOUPDATE.*?AUTOUPDATE=ON?g" $FILE_CONF
| |
| echo "*/10 * * * * root $CHEMINCTPARENTLE -aup" > /etc/cron.d/CTparental-autoupdate
| |
| $CMDSERVICE$namservicecrond restart
| |
| }
| |
|
| |
|
| autoupdateoff() {
| | - '''min''' = nftables = nftables (successeur d'iptables), dnscrypt-proxy (remplaçant dnsmasq), lighttpd ou nginx. |
| $SED "s?^AUTOUPDATE.*?AUTOUPDATE=OFF?g" $FILE_CONF
| |
| rm -f /etc/cron.d/CTparental-autoupdate
| |
| $CMDSERVICE$namservicecrond restart
| |
| }
| |
| adapt() {
| |
| dnsmasqoff
| |
| if [ ! -f $DNS_FILTER_OSSI ] ; then
| |
| echo > $DNS_FILTER_OSSI
| |
| fi
| |
|
| |
|
| if [ -d $tempDIR ] ; then
| | et 5 branches historique, non maintenu qui ce basé sur dnsmasq, dansguardian , iptables .(jusqu'aux versions 4.x.x) |
| CATEGORIES_AVAILABLE=$tempDIR/categories_available
| |
| ls -FR $tempDIR/blacklists | grep '/$' | sed -e "s/\///g" > $CATEGORIES_AVAILABLE
| |
| echo -n > $BL_CATEGORIES_AVAILABLE
| |
| echo -n > $WL_CATEGORIES_AVAILABLE
| |
| if [ ! -f $DIR_DNS_FILTER_AVAILABLE/ossi.conf ] ; then
| |
| echo > $DIR_DNS_FILTER_AVAILABLE/ossi.conf
| |
| fi
| |
| for categorie in `cat $CATEGORIES_AVAILABLE` # creation des deux fichiers de categories (BL / WL)
| |
| do
| |
| if [ -e $tempDIR/blacklists/$categorie/usage ]
| |
| then
| |
| is_whitelist=`grep white $tempDIR/blacklists/$categorie/usage|wc -l`
| |
| else
| |
| is_whitelist=0 # ou si le fichier 'usage' n'existe pas, on considère que la catégorie est une BL
| |
| fi
| |
| if [ $is_whitelist -eq "0" ]
| |
| then
| |
| echo "$categorie" >> $BL_CATEGORIES_AVAILABLE
| |
| else
| |
| echo "$categorie" >> $WL_CATEGORIES_AVAILABLE
| |
| fi
| |
| done
| |
| echo -n "Toulouse Black and White List migration process. Please wait : "
| |
| for DOMAINE in `cat $CATEGORIES_AVAILABLE` # pour chaque catégorie
| |
| do
| |
| echo -n "."
| |
| # suppression des @IP, de caractères acccentués et des lignes commentées ou vide
| |
| egrep -v "([0-9]{1,3}\.){3}[0-9]{1,3}" $tempDIR/blacklists/$DOMAINE/domains > $FILE_tmp
| |
| $SED "/[äâëêïîöôüû]/d" $FILE_tmp
| |
| $SED "/^#.*/d" $FILE_tmp
| |
| $SED "/^$/d" $FILE_tmp
| |
| $SED "s/\.\{2,1000\}/\./g" $FILE_tmp # supprime les suite de "." exemple: address=/fucking-big-tits..com/127.0.0.10 devient address=/fucking-big-tits.com/127.0.0.10
| |
| is_blacklist=`grep $DOMAINE $BL_CATEGORIES_AVAILABLE |wc -l`
| |
| if [ $is_blacklist -ge "1" ] ; then
| |
| $SED "s?.*?address=/&/$PRIVATE_IP?g" $FILE_tmp # Mise en forme dnsmasq des listes noires
| |
| mv $FILE_tmp $DIR_DNS_FILTER_AVAILABLE/$DOMAINE.conf
| |
| else
| |
| $SED "s?.*?server=/&/#?g" $FILE_tmp # Mise en forme dnsmasq des listes blanches
| |
| mv $FILE_tmp $DIR_DNS_FILTER_AVAILABLE/$DOMAINE.conf
| |
| fi
| |
| done
| |
| else
| |
| mkdir $tempDIR
| |
| echo -n "."
| |
| # suppression des @IP, de caractères acccentués et des lignes commentées ou vide
| |
| egrep -v "([0-9]{1,3}\.){3}[0-9]{1,3}" $DNS_FILTER_OSSI > $FILE_tmp
| |
| $SED "/[äâëêïîöôüû]/d" $FILE_tmp
| |
| $SED "/^#.*/d" $FILE_tmp
| |
| $SED "/^$/d" $FILE_tmp
| |
| $SED "s/\.\{2,1000\}/\./g" $FILE_tmp # supprime les suite de "." exemple: address=/fucking-big-tits..com/127.0.0.10 devient address=/fucking-big-tits.com/127.0.0.10
| |
| $SED "s?.*?address=/&/$PRIVATE_IP?g" $FILE_tmp # Mise en forme dnsmasq
| |
| mv $FILE_tmp $DIR_DNS_FILTER_AVAILABLE/ossi.conf
| |
| fi
| |
| echo
| |
| rm -rf $tempDIR
| |
| }
| |
| catChoice() {
| |
| # echo "catChoice"
| |
| rm -rf $DIR_DNS_BLACKLISTE_ENABLED/
| |
| mkdir $DIR_DNS_BLACKLISTE_ENABLED
| |
| rm -rf $DIR_DNS_WHITELIST_ENABLED/
| |
| mkdir $DIR_DNS_WHITELIST_ENABLED
| |
|
| |
| for CATEGORIE in `cat $CATEGORIES_ENABLED` # on affecte les catégories dnsmasq
| |
| do
| |
| is_blacklist=`grep $CATEGORIE $BL_CATEGORIES_AVAILABLE |wc -l`
| |
| if [ $is_blacklist -ge "1" ] ; then
| |
| cp $DIR_DNS_FILTER_AVAILABLE/$CATEGORIE.conf $DIR_DNS_BLACKLISTE_ENABLED/
| |
| else
| |
| cp $DIR_DNS_FILTER_AVAILABLE/$CATEGORIE.conf $DIR_DNS_WHITELIST_ENABLED/
| |
| fi
| |
| done
| |
| cp $DIR_DNS_FILTER_AVAILABLE/ossi.conf $DIR_DNS_BLACKLISTE_ENABLED/
| |
| # echo "fincatChoice"
| |
| reabdomaine
| |
| }
| |
|
| |
|
| reabdomaine () {
| | - '''dnsmasq''' = nftables (successeur d'iptables), dnsmasq, lighttpd ou nginx, privoxy et e2guardian ( successeur de dansguardian ). |
| if [ ! -f $DREAB ] ; then
| |
| cat << EOF > $DREAB
| |
| www.google.com
| |
| www.google.fr
| |
| EOF
| |
| fi
| |
| if [ ! -f $DIR_DNS_BLACKLISTE_ENABLED/ossi.conf ] ; then
| |
| echo > $DIR_DNS_BLACKLISTE_ENABLED/ossi.conf
| |
| fi
| |
| echo
| |
| echo -n "Application de la liste blanche (domaine réabiliter):"
| |
| for CATEGORIE in `cat $CATEGORIES_ENABLED ` # pour chaque catégorie
| |
| do
| |
| is_blacklist=`grep $CATEGORIE $BL_CATEGORIES_AVAILABLE |wc -l`
| |
| if [ $is_blacklist -ge "1" ] ; then
| |
| echo -n "."
| |
| for DOMAINE in `cat $DREAB`
| |
| do
| |
| $SED "/$DOMAINE/d" $DIR_DNS_BLACKLISTE_ENABLED/$CATEGORIE.conf
| |
| done
| |
| fi
| |
| done
| |
| echo -n "."
| |
| cat $DREAB | sed -e "s? ??g" | sed -e "s?.*?server=/&/#?g" > $DIR_DNS_WHITELIST_ENABLED/whiteliste.ossi.conf
| |
| echo
| |
| }
| |
|
| |
|
| dnsmasqon () {
| | - '''dnsmasq_min''' = nftables = nftables (successeur d'iptables), dnsmasq, lighttpd ou nginx. |
| categorie1=`sed -n "1 p" $CATEGORIES_ENABLED` # on considaire que si la 1 er categorie activer est un blackliste on fonctionne par blackliste.
| |
| is_blacklist=`grep $categorie1 $BL_CATEGORIES_AVAILABLE |wc -l`
| |
| if [ $is_blacklist -ge "1" ] ; then
| |
| $SED "s?^DNSMASQ.*?DNSMASQ=BLACK?g" $FILE_CONF
| |
| cat << EOF > $DNSMASQCONF
| |
| # Configuration file for "dnsmasq with blackhole"
| |
| # Inclusion de la blacklist <domains> de Toulouse dans la configuration
| |
| conf-dir=$DIR_DNS_BLACKLISTE_ENABLED
| |
| # conf-file=$DIR_DEST_ETC/alcasar-dns-name # zone de definition de noms DNS locaux
| |
| no-dhcp-interface=$interface_WAN
| |
| bind-interfaces
| |
| cache-size=1024
| |
| domain-needed
| |
| expand-hosts
| |
| bogus-priv
| |
| server=$DNS1
| |
| server=$DNS2
| |
|
| |
| EOF
| |
| $CMDSERVICE$namservicednsmaq restart
| |
| else
| |
| dnsmasqwhitelistonly
| |
| fi
| |
| }
| |
| dnsmasqoff () {
| |
| $SED "s?^DNSMASQ.*?DNSMASQ=OFF?g" $FILE_CONF
| |
| cat << EOF > $DNSMASQCONF
| |
| # Configuration file for "dnsmasq with blackhole"
| |
| # Inclusion de la blacklist <domains> de Toulouse dans la configuration
| |
| # conf-dir=$DIR_DNS_BLACKLISTE_ENABLED
| |
| # conf-file=$DIR_DEST_ETC/alcasar-dns-name # zone de definition de noms DNS locaux
| |
| no-dhcp-interface=$interface_WAN
| |
| bind-interfaces
| |
| cache-size=0
| |
| domain-needed
| |
| expand-hosts
| |
| bogus-priv
| |
| server=$DNS1
| |
| server=$DNS2
| |
|
| |
| EOF
| |
|
| |
|
| $CMDSERVICE$namservicednsmaq restart
| | - '''iptables''' = iptables, ipset, dnsmasq, lighttpd ou nginx, privoxy et e2guardian ( successeur de dansguardian ). |
| }
| |
| dnsmasqwhitelistonly () {
| |
| $SED "s?^DNSMASQ.*?DNSMASQ=WHITE?g" $FILE_CONF
| |
| cat << EOF > $DNSMASQCONF
| |
| # Configuration file for "dnsmasq with blackhole"
| |
| # Inclusion de la blacklist <domains> de Toulouse dans la configuration
| |
| conf-dir=$DIR_DNS_WHITELIST_ENABLED
| |
| # conf-file=$DIR_DEST_ETC/alcasar-dns-name # zone de definition de noms DNS locaux
| |
| no-dhcp-interface=$interface_WAN
| |
| bind-interfaces
| |
| cache-size=0
| |
| domain-needed
| |
| expand-hosts
| |
| bogus-priv
| |
| server=$DNS1
| |
| server=$DNS2
| |
| address=/#/$PRIVATE_IP #redirige vers $PRIVATE_IP pour tous ce qui n'a pas étais resolut dans les listes blanches
| |
| EOF
| |
|
| |
|
| $CMDSERVICE$namservicednsmaq restart
| | - '''dansguardian''' = iptables, ipset, dnsmasq, lighttpd, privoxy et dansguardian. |
| }
| |
|
| |
|
| | - '''iptables_min''' = iptables, ipset,dnsmasq, lighttpd ou nginx. |
|
| |
|
| FoncHTTPDCONF () {
| | exemple pour debian9 il y a 4 paquet possible. 2 paquet dérivé de la branche iptables avec lighttpd ou nginx et 2 autres dérivé de la branche iptables_min si l'on veut utiliser moins de ressources. |
| $CMDSERVICE$namservicehttpd stop
| |
| rm -rf $DIRHTML/*
| |
| mkdir -v $DIRHTML
| |
| if [ ! -z $DIRhtmlPersonaliser ];then
| |
| cp -r $DIRhtmlPersonaliser/* $DIRHTML
| |
| else
| |
| s="span"
| |
| st="style"
| |
| c="$c"
| |
| cab=";\">"
| |
|
| |
|
| cat << EOF > $DIRHTML/index.html
| | == Pour ceux qui veulent tester en ipv6 == |
| <HTML>
| |
| <HEAD>
| |
| <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
| |
| <TITLE>danger</TITLE>
| |
| </HEAD>
| |
| <BODY LANG="fr-FR" DIR="LTR">
| |
| <CENTER>
| |
| <img alt="Site dangereux pour des mineurs"
| |
| HEIGHT="600"
| |
| src="data:image/png;base64,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
| |
| QmCC" />
| |
| </CENTER>
| |
| </BODY>
| |
| </HTML>
| |
| EOF
| |
|
| |
|
| fi
| | c'est possible avec la dernière les version 4.20.x sous debian testing/sid ,<br /> |
| ## GENERATION
| | il faudra au préalable s’assurer que son fournisseur d'accès accepte bien l'ipv6 , ce qui n'est malheureusement pas mon cas. |
|
| |
|
| ln -s $DIRHTML/index.html $DIRHTML/err404.html
| | l'ipv6 n'étant pas encore implémentée dans e2guardian , ctparental ne force pas le passage par celui-ci mais attaque directement privoxy. |
| USERHTTPD=$(cat /etc/passwd | grep /var/www | cut -d":" -f1)
| |
| GROUPHTTPD=$(cat /etc/group | grep $USERHTTPD | cut -d":" -f1)
| |
|
| |
|
| cat << EOF > $MAINCONFHTTPD
| | Une désinstallation avec purge est nécessaire en cas de mise à jour d'une version antérieure. |
| server.modules = (
| |
| "mod_access",
| |
| "mod_alias",
| |
| "mod_redirect",
| |
| "mod_auth", #pour insteface admin
| |
| "mod_fastcgi", #pour insteface admin (activation du php)
| |
| # "mod_rewrite",
| |
| )
| |
| auth.debug = 0
| |
| auth.backend = "htdigest"
| |
| auth.backend.htdigest.userfile = "$PASSWORDFILEHTTPD"
| |
|
| |
|
| server.document-root = "/var/www"
| | # apt-get remove --purge ctparental privoxy e2guardian dansguardian dnsmasq lighttpd |
| server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
| |
| server.errorlog = "/var/log/lighttpd/error.log"
| |
| server.pid-file = "/var/run/lighttpd.pid"
| |
| server.username = "$USERHTTPD"
| |
| server.groupname = "$GROUPHTTPD"
| |
| server.port = 80
| |
| server.bind = "127.0.0.1"
| |
|
| |
|
| | $ wget -c https://gitlab.com/marsat/CTparental/uploads/d5567eb1a43ffde679193bce87be5f69/ctparental_debian10_lighttpd_4.44.18-1.0_all.deb |
|
| |
|
| index-file.names = ( "index.php", "index.html" )
| | Pour tester le filtrage avec un utilisateur non filtré il suffit que celui-ci ajoute le proxy http et https suivant dans son navigateur.<br /> |
| url.access-deny = ( "~", ".inc" )
| | http et https '''::1''' port '''8888''' |
| static-file.exclude-extensions = (".php", ".pl", ".fcgi" )
| |
|
| |
|
| compress.cache-dir = "/var/cache/lighttpd/compress/"
| | Pour les utilisateurs filtrés c'est automatique, il n'y a rien à faire. |
| compress.filetype = ( "text/css", "text/html", "text/plain" )
| |
|
| |
|
| server.tag = ""
| | == Nettoyage des versions précédentes : == |
| | si vous utilisé l'instance dnscrypt-proxy du deb pour vos connexions système il faut installer celui-ci de manière autonome via la commande ci dessous: |
| | |
| | # apt-get install dnscrypt-proxy |
|
| |
|
| include_shell "/usr/share/lighttpd/create-mime.assign.pl"
| | cela éviteras la surpression de dnscrypt-proxy durant la procédure de dés-installation de ctparental, et ainsi une perte de connexion système. |
| include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
| |
| EOF
| |
|
| |
|
| mkdir -p /usr/share/lighttpd/
| | # apt-get autoremove --purge ctparental clamav-* privoxy lighttpd dansguardian dnsmasq nginx e2guardian |
|
| |
|
| if [ ! -f /usr/share/lighttpd/create-mime.assign.pl ];then
| | # rm -rf /etc/CTparental |
| cat << EOF > /usr/share/lighttpd/create-mime.assign.pl
| |
| #!/usr/bin/perl -w | |
| use strict;
| |
| open MIMETYPES, "/etc/mime.types" or exit;
| |
| print "mimetype.assign = (\n";
| |
| my %extensions;
| |
| while(<MIMETYPES>) {
| |
| chomp;
| |
| s/\#.*//;
| |
| next if /^\w*$/;
| |
| if(/^([a-z0-9\/+-.]+)\s+((?:[a-z0-9.+-]+[ ]?)+)$/) {
| |
| foreach(split / /, \$2) {
| |
| # mime.types can have same extension for different
| |
| # mime types
| |
| next if \$extensions{\$_};
| |
| \$extensions{\$_} = 1;
| |
| print "\".\$_\" => \"\$1\",\n";
| |
| }
| |
| }
| |
| }
| |
| print ")\n";
| |
| EOF
| |
| chmod +x /usr/share/lighttpd/create-mime.assign.pl
| |
| fi
| |
|
| |
|
| | == Installez le deb : == |
|
| |
|
| if [ ! -f /usr/share/lighttpd/include-conf-enabled.pl ];then
| | # gdebi ctparental_*_all.deb |
| cat << EOF > /usr/share/lighttpd/include-conf-enabled.pl
| |
| #!/usr/bin/perl -wl
| |
|
| |
|
| use strict;
| | (J'utilise gdebit car cela évite le téléchargement et l'installation manuelle des dépendances.) |
| use File::Glob ':glob';
| |
|
| |
|
| my \$confdir = shift || "/etc/lighttpd/";
| | Important : Depuis la version 3.92 les paramètres proxy changent automatiquement au premier démarrage de la session, ce qui fait que c'est transparent pour l'utilisateur.<br /> |
| my \$enabled = "conf-enabled/*.conf";
| | Si après avoir redémarré votre session vous avez encore des problèmes de connexion aux sites https tels que google.com, testez avant tout l'ajout du proxy suivant.<br /> |
| | proxy http 127.0.0.1 sur port 8080<br /> |
| | proxy https 127.0.0.1 sur port 8080<br /> |
|
| |
|
| chdir(\$confdir);
| | === Pour les versions avant la 3.95-3 === |
| my @files = bsd_glob(\$enabled);
| | Il est conseillé d'ajouter tous les domaines de vos dépôts dans les domaines réhabilités cela peut éviter certaines erreurs quand on utilise su au lieu de su - avant des commandes apt-get aptitude … |
|
| |
|
| for my \$file (@files)
| | Lancez cette ligne de commandes pour les connaître. |
| {
| | |
| print "include \"\$file\"";
| | $ cat /etc/apt/sources.list /etc/apt/sources.list.d/* 2>/dev/null | awk -F/ '/^deb/ {print $3}' | sort -u |
| }
| |
| EOF
| |
| chmod +x /usr/share/lighttpd/include-conf-enabled.pl
| |
|
| |
|
| fi
| | Pour la version 3.95-3 et supérieure, après l'ajout d'un nouveau dépôt, il faut juste penser à lancer la commande suivante : |
| | |
| mkdir -p $DIRCONFENABLEDHTTPD
| |
| mkdir -p $DIRadminHTML
| |
| cp -rf CTadmin/* $DIRadminHTML/
| |
| clear
| |
| echo "Entrer le login pour l'interface d'administration :"
| |
| while (true); do
| |
| read loginhttp
| |
| case $loginhttp in
| |
| * )
| |
| echo "login: $loginhttp" > /root/passwordCTadmin
| |
| break
| |
| ;;
| |
| esac
| |
| done
| |
| clear
| |
| echo "Entrer le mot de $loginhttp :"
| |
| while (true); do
| |
| read password
| |
| case $password in
| |
| * )
| |
| echo "password: $password" >> /root/passwordCTadmin
| |
| addadminhttpd "$loginhttp" "$password"
| |
| break
| |
| ;;
| |
| esac
| |
| done
| |
| chmod 700 /root/passwordCTadmin
| |
| chown root:root /root/passwordCTadmin
| |
| cat << EOF > $CTPARENTALCONFHTTPD
| |
| | |
| fastcgi.server = (
| |
| ".php" => (
| |
| "localhost" => (
| |
| "bin-path" => "/usr/bin/php-cgi",
| |
| "socket" => "/run/lighttpd/php-fastcgi.sock",
| |
| "max-procs" => 4, # default value
| |
| "bin-environment" => (
| |
| "PHP_FCGI_CHILDREN" => "1", # default value
| |
| ),
| |
| "broken-scriptfilename" => "enable"
| |
| ))
| |
| )
| |
| fastcgi.map-extensions = ( ".php3" => ".php",
| |
| ".php4" => ".php",
| |
| ".php5" => ".php",
| |
| ".phps" => ".php",
| |
| ".phtml" => ".php" )
| |
| | |
| \$HTTP["url"] =~ ".*CTadmin.*" {
| |
| auth.require = ( "" =>
| |
| (
| |
| "method" => "digest",
| |
| "realm" => "$REALMADMINHTTPD",
| |
| "require" => "user=$USERADMINHTTPD"
| |
| )
| |
| )
| |
| | |
| }
| |
| \$SERVER["socket"] == "$PRIVATE_IP:80" {
| |
| server.document-root = "$DIRHTML"
| |
| server.errorfile-prefix = "$DIRHTML/err"
| |
| #ssl.engine = "enable"
| |
| #ssl.pemfile = "/etc/lighttpd/ssl/$PRIVATE_IP.pem"
| |
| }
| |
| | |
| EOF
| |
| chown root:$GROUPHTTPD $DREAB
| |
| chmod 660 $DREAB
| |
| chown root:$GROUPHTTPD $DNS_FILTER_OSSI
| |
| chmod 660 $DNS_FILTER_OSSI
| |
| chown root:$GROUPHTTPD $CATEGORIES_ENABLED
| |
| chmod 660 $CATEGORIES_ENABLED
| |
| chmod 660 /etc/sudoers
| |
| is_sudo_ok=`grep $USERHTTPD /etc/sudoers |wc -l`
| |
| if [ $is_sudo_ok -ge "1" ] ; then
| |
| $SED "s?^$USERHTTPD.*?$USERHTTPD ALL=(ALL) NOPASSWD:/usr/local/bin/CTparental.sh -tlu,/usr/local/bin/CTparental.sh -trf,/usr/local/bin/CTparental.sh -dble,/usr/local/bin/CTparental.sh -ubl,/usr/local/bin/CTparental.sh -dl,/usr/local/bin/CTparental.sh -on,/usr/local/bin/CTparental.sh -off,/usr/local/bin/CTparental.sh -aupon,/usr/local/bin/CTparental.sh -aupoff?g" /etc/sudoers
| |
| else
| |
| echo "$USERHTTPD ALL=(ALL) NOPASSWD:/usr/local/bin/CTparental.sh -tlu,/usr/local/bin/CTparental.sh -trf,/usr/local/bin/CTparental.sh -dble,/usr/local/bin/CTparental.sh -ubl,/usr/local/bin/CTparental.sh -dl,/usr/local/bin/CTparental.sh -on,/usr/local/bin/CTparental.sh -off,/usr/local/bin/CTparental.sh -aupon,/usr/local/bin/CTparental.sh -aupoff" >> /etc/sudoers
| |
| fi
| |
| chmod 440 /etc/sudoers
| |
| if [ ! -f $FILE_HCONF ] ; then
| |
| echo > $FILE_HCONF
| |
| fi
| |
| chown root:$GROUPHTTPD $FILE_HCONF
| |
| chmod 660 $FILE_HCONF
| |
| $CMDSERVICE$namservicehttpd start
| |
| }
| |
| | |
| install () {
| |
| if [ $(netstat -anlp | grep -w LISTEN | grep ":80" | cut -d"/" -f2 | wc -l ) -gt 0 ] ; then
| |
| echo "le Serveur Web $(netstat -anlp | grep -w LISTEN | grep ":80" | cut -d"/" -f2 | sort -u ) tourne deja sur ce pc"
| |
| echo "veuiller le désinstaler avant d'installer le control parental."
| |
| exit 1
| |
| fi
| |
| mkdir $tempDIR
| |
| mkdir -p $DIR_CONF
| |
| initblenabled
| |
| cat /etc/resolv.conf > $DIR_CONF/resolv.conf.sav
| |
| $CMDINSTALL dnsmasq
| |
| $CMDINSTALL lighttpd
| |
| $CMDINSTALL php5-cgi
| |
| if [ ! -f blacklists.tar.gz ]
| |
| then
| |
| download
| |
| else
| |
| tar -xzf blacklists.tar.gz -C $tempDIR
| |
| if [ ! $? -eq 0 ]; then
| |
| echo "erreur d'extraction de l'archive processu interompu"
| |
| exit 1
| |
| fi
| |
| rm -rf $DIR_DNS_FILTER_AVAILABLE/
| |
| mkdir $DIR_DNS_FILTER_AVAILABLE
| |
| fi
| |
| adapt
| |
| catChoice
| |
| dnsmasqon
| |
| $SED "s?^LASTUPDATE.*?LASTUPDATE=$THISDAYS=`date +%d-%m-%Y\ %T`?g" $FILE_CONF
| |
| $CMDINSTALL $paquetresolv
| |
| confresolvconf
| |
| | |
| FoncHTTPDCONF
| |
| }
| |
| | |
| confresolvconf () {
| |
| echo "nameserver 127.0.0.1" > $RESOLVDNSMASQ
| |
| if [ ! -f $RESOLVCONFORDER ];then
| |
| cat << EOF > $RESOLVCONFORDER
| |
| # interface-order(5)
| |
| lo.inet*
| |
| lo.dnsmasq
| |
| lo.pdnsd
| |
| lo.!(pdns|pdns-recursor)
| |
| lo
| |
| tun*
| |
| tap*
| |
| hso*
| |
| em+([0-9])?[+([0-9]))*
| |
| p+([0-9]p+([0-9])?(_+([0-9]))*
| |
| eth*
| |
| ath*
| |
| wlan*
| |
| ppp*
| |
| *
| |
| EOF
| |
| fi
| |
| resolvconf -u
| |
| }
| |
| | |
| uninstall () {
| |
| rm -f /etc/cron.d/CTparental*
| |
| $CMDSERVICE$namservicecrond restart
| |
| $CMDSERVICE$namservicehttpd stop
| |
| rm -f /var/www/index.lighttpd.html
| |
| rm -rf $tempDIR
| |
| rm -rf $DIR_CONF
| |
| rm -rf $DIRHTML
| |
| | |
| if [ -f /etc/NetworkManager/NetworkManager.conf ];then
| |
| $SED "s/^#dns=dnsmasq/dns=dnsmasq/g" /etc/NetworkManager/NetworkManager.conf
| |
| $CMDSERVICE$namserviceNetworkManager restart
| |
| sleep 5
| |
| fi
| |
| rm -rf /usr/share/lighttpd/*
| |
| rm -f $CTPARENTALCONFHTTPD
| |
| rm -rf $DIRadminHTML
| |
| rm -f $RESOLVDNSMASQ
| |
| resolvconf -u
| |
| | |
| $CMDREMOVE lighttpd
| |
| $CMDREMOVE dnsmasq
| |
| $CMDREMOVE $paquetresolv
| |
| }
| |
| | |
| choiblenabled () {
| |
| echo -n > $CATEGORIES_ENABLED
| |
| clear
| |
| echo "Voulez Filtre par Blackliste ou Whiteliste :"
| |
| echo -n " B/W :"
| |
| while (true); do
| |
| read choi
| |
| case $choi in
| |
| B | b )
| |
| echo "Vous aller maintenant choisir les \"Black listes\" a appliquer."
| |
| for CATEGORIE in `cat $BL_CATEGORIES_AVAILABLE` # pour chaque catégorie
| |
| do
| |
| clear
| |
| echo "Voulez vous activer la categorie :"
| |
| echo -n "$CATEGORIE O/N :"
| |
| while (true); do
| |
| read choi
| |
| case $choi in
| |
| O | o )
| |
| echo $CATEGORIE >> $CATEGORIES_ENABLED
| |
| break
| |
| ;;
| |
| N | n )
| |
| break
| |
| ;;
| |
| esac
| |
| done
| |
| done
| |
| break
| |
| ;;
| |
| W | w )
| |
| echo "Vous aller maintenant choisir les \"White listes\" a appliquer."
| |
| for CATEGORIE in `cat $WL_CATEGORIES_AVAILABLE` # pour chaque catégorie
| |
| do
| |
| clear
| |
| echo "Voulez vous activer la categorie :"
| |
| echo -n "$CATEGORIE O/N :"
| |
| while (true); do
| |
| read choi
| |
| case $choi in
| |
| O | o )
| |
| echo $CATEGORIE >> $CATEGORIES_ENABLED
| |
| break
| |
| ;;
| |
| N | n )
| |
| break
| |
| ;;
| |
| esac
| |
| done
| |
| done
| |
| break
| |
| ;;
| |
| esac
| |
| done
| |
| }
| |
| | |
| | |
| errortime1 () {
| |
| clear
| |
| echo -e "L'heure de debut doit ètre strictement inférieur a l'heure de fin: $RougeD$input$Fcolor "
| |
| echo "exemple: 08h00 a 24h00 ou 08h00 a 12h00 et 14h00 a 24h00"
| |
| echo -e -n "$RougeD$PCUSER$Fcolor est autorisés à se connecter le $BleuD${DAYS[$NumDAY]}$Fcolor de:"
| |
| }
| |
| errortime2 () {
| |
| clear
| |
| echo -e "Mauvaise syntaxe: $RougeD$input$Fcolor "
| |
| echo "exemple: 08h00 a 24h00 ou 08h00 a 12h00 et 14h00 a 24h00"
| |
| echo -e -n "$RougeD$PCUSER$Fcolor est autorisés à se connecter le $BleuD${DAYS[$NumDAY]}$Fcolor de:"
| |
| }
| |
| | |
| pause () { # fonction pause pour debugage
| |
| choi=""
| |
| echo "pour continuer press Q :"
| |
| while (true); do
| |
| read choi
| |
| case $choi in
| |
| Q | q )
| |
| break
| |
| ;;
| |
| esac
| |
| done
| |
| }
| |
| activetimelogin () {
| |
| TESTGESTIONNAIRE=""
| |
| for FILE in `echo $GESTIONNAIREDESESSIONS`
| |
| do
| |
| if [ -f $DIRPAM$FILE ];then
| |
| if [ $(cat $DIRPAM$FILE | grep -c "account required pam_time.so") -eq 0 ] ; then
| |
| echo "account required pam_time.so" >> $DIRPAM$FILE
| |
| fi
| |
| TESTGESTIONNAIRE=$TESTGESTIONNAIRE\ $FILE
| |
| fi
| |
| done
| |
| if [ $( echo $TESTGESTIONNAIRE | wc -m ) -eq 1 ] ; then
| |
| echo "Aucun gestionner de session connu , n'a été détecté."
| |
| echo " il est donc impossible d'activer le controle horaires des connections"
| |
| desactivetimelogin
| |
| exit 1
| |
| fi
| |
|
| |
| if [ ! -f $FILEPAMTIMECONF.old ] ; then
| |
| cp $FILEPAMTIMECONF $FILEPAMTIMECONF.old
| |
| fi
| |
| echo "*;*;root;Al0000-2400" > $FILEPAMTIMECONF
| |
| for NumDAY in 0 1 2 3 4 5 6
| |
| do
| |
| echo > /etc/cron.d/CTparental${DAYS[$NumDAY]}
| |
| done
| |
| for PCUSER in `cat /etc/passwd | cut -d":" -f1,3| grep -E [1-9][0-9][0-9][0-9] | cut -d ":" -f1`
| |
| do
| |
| $SED "/^$PCUSER=/d" $FILE_HCONF
| |
| echo -e -n "$PCUSER est autoriser a ce connecter 7j/7 24h/24 O/N?"
| |
| choi=""
| |
| while (true); do
| |
| read choi
| |
| case $choi in
| |
| O | o )
| |
| alltime="O"
| |
| break
| |
| ;;
| |
| N| n )
| |
| alltime="N"
| |
| break
| |
| ;;
| |
| esac
| |
| done
| |
| HORAIRES=""
| |
| for NumDAY in 0 1 2 3 4 5 6
| |
| do
| |
| if [$alltime = "O"];then
| |
| echo "*;*;$PCUSER;Al0000-2400" >> $FILEPAMTIMECONF
| |
| echo "$PCUSER=admin=" >> $FILE_HCONF
| |
| break
| |
| else
| |
| echo "$PCUSER=user=" >> $FILE_HCONF
| |
| fi
| |
|
| |
| clear
| |
| echo "exemple: 00h00 a 23h59 ou 08h00 a 12h00 et 14h00 a 16h50"
| |
| echo -e -n "$RougeD$PCUSER$Fcolor est autorisés à se connecter le $BleuD${DAYS[$NumDAY]}$Fcolor de:"
| |
| while (true); do
| |
| read choi
| |
| input=$choi
| |
| choi=$(echo $choi | sed -e "s/h//g" | sed -e "s/ //g" | sed -e "s/a/-/g" | sed -e "s/et/:/g" ) # mise en forme de choi pour pam
| |
| if [ $( echo $choi | grep -E -c "^[0-2][0-9][0-5][0-9]-[0-2][0-9][0-5][0-9]$|^[0-2][0-9][0-5][0-9]-[0-2][0-9][0-5][0-9]:[0-2][0-9][0-5][0-9]-[0-2][0-9][0-5][0-9]$" ) -eq 1 ];then
| |
| int1=$(echo $choi | cut -d ":" -f1 | cut -d "-" -f1)
| |
| int2=$(echo $choi | cut -d ":" -f1 | cut -d "-" -f2)
| |
| int3=$(echo $choi | cut -d ":" -f2 | cut -d "-" -f1)
| |
| int4=$(echo $choi | cut -d ":" -f2 | cut -d "-" -f2)
| |
| if [ $int1 -lt $int2 ];then
| |
| if [ ! $(echo $choi | grep -E -c ":") -eq 1 ] ; then
| |
| if [ $NumDAY -eq 6 ] ; then
| |
| HORAIRESPAM="$HORAIRESPAM${DAYSPAM[$NumDAY]}$int1-$int2"
| |
| else
| |
| HORAIRESPAM="$HORAIRESPAM${DAYSPAM[$NumDAY]}$int1-$int2|"
| |
| fi
| |
| MINUTES1=$(echo $int1 | sed -e 's/.\{02\}//')
| |
| HEURES1=$(echo $int1 | sed -e 's/.\{02\}$//')
| |
| MINUTES2=$(echo $int2 | sed -e 's/.\{02\}//')
| |
| HEURES2=$(echo $int2 | sed -e 's/.\{02\}$//')
| |
| echo "$PCUSER=$NumDAY=$HEURES1\h$MINUTES1\:$HEURES2\h$MINUTES2" >> $FILE_HCONF
| |
| echo "$MINUTES2 $HEURES2 * * ${DAYSCRON[$NumDAY]} root /usr/bin/skill -KILL -u$PCUSER" >> /etc/cron.d/CTparental${DAYS[$NumDAY]}
| |
| break
| |
|
| |
| else
| |
| if [ $int2 -lt $int3 ];then
| |
| if [ $int3 -lt $int4 ];then
| |
| if [ $NumDAY -eq 6 ] ; then
| |
| HORAIRESPAM="$HORAIRESPAM${DAYSPAM[$NumDAY]}$int1-$int2|${DAYSPAM[$NumDAY]}$int3-$int4"
| |
| else
| |
| HORAIRESPAM="$HORAIRESPAM${DAYSPAM[$NumDAY]}$int1-$int2|${DAYSPAM[$NumDAY]}$int3-$int4|"
| |
| fi
| |
| MINUTES1=$(echo $int1 | sed -e 's/.\{02\}//')
| |
| HEURES1=$(echo $int1 | sed -e 's/.\{02\}$//')
| |
| MINUTES2=$(echo $int2 | sed -e 's/.\{02\}//')
| |
| HEURES2=$(echo $int2 | sed -e 's/.\{02\}$//')
| |
| MINUTES3=$(echo $int3 | sed -e 's/.\{02\}//')
| |
| HEURES3=$(echo $int3 | sed -e 's/.\{02\}$//')
| |
| MINUTES4=$(echo $int4 | sed -e 's/.\{02\}//')
| |
| HEURES4=$(echo $int4 | sed -e 's/.\{02\}$//')
| |
| ## minutes heures jourdumoi moi jourdelasemaine utilisateur commande
| |
| echo "$PCUSER=$NumDAY=$HEURES1\h$MINUTES1\:$HEURES2\h$MINUTES2:$HEURES3\h$MINUTES3\:$HEURES4\h$MINUTES4" >> $FILE_HCONF
| |
| echo "$MINUTES2 $HEURES2 * * ${DAYSCRON[$NumDAY]} root /usr/bin/skill -KILL -u$PCUSER" >> /etc/cron.d/CTparental${DAYS[$NumDAY]}
| |
| echo "$MINUTES4 $HEURES4 * * ${DAYSCRON[$NumDAY]} root /usr/bin/skill -KILL -u$PCUSER" >> /etc/cron.d/CTparental${DAYS[$NumDAY]}
| |
| break
| |
| else
| |
| errortime1
| |
| fi
| |
| else
| |
| errortime1
| |
| fi
| |
| fi
| |
| else
| |
| errortime1
| |
|
| |
| fi
| |
|
| |
| else
| |
| errortime2
| |
| fi
| |
|
| |
| done
| |
|
| |
| done
| |
|
| |
| echo "*;*;$PCUSER;$HORAIRESPAM" >> $FILEPAMTIMECONF
| |
| done
| |
| | | |
| for NumDAY in 0 1 2 3 4 5 6 | | # CTparental -ubl |
| do
| |
| echo >> /etc/cron.d/CTparental${DAYS[$NumDAY]}
| |
| done
| |
| echo >> $FILE_HCONF
| |
| $SED "s?^HOURSCONNECT.*?HOURSCONNECT=ON?g" $FILE_CONF
| |
| $CMDSERVICE$namservicecrond restart
| |
| }
| |
|
| |
|
| desactivetimelogin () {
| | Pour tester si ça fonctionne faire un ping à partir d'un compte filtré. |
| for FILE in `echo $GESTIONNAIREDESESSIONS`
| |
| do
| |
| $SED "/account required pam_time.so/d" $DIRPAM$FILE
| |
| done
| |
| cat $FILEPAMTIMECONF.old > $FILEPAMTIMECONF
| |
| for NumDAY in 0 1 2 3 4 5 6
| |
| do
| |
| rm -f /etc/cron.d/CTparental${DAYS[$NumDAY]}
| |
| done
| |
| $SED "s?^HOURSCONNECT.*?HOURSCONNECT=OFF?g" $FILE_CONF
| |
|
| |
|
| $CMDSERVICE$namservicecrond restart | | $ su child -c "ping youporn.com" |
| }
| |
|
| |
|
| | ''child'' est à remplacer par le compte pour lequel vous voulez tester. |
|
| |
|
| readTimeFILECONF () {
| | doit retourner quelque chose comme ça : |
| TESTGESTIONNAIRE=""
| |
| for FILE in `echo $GESTIONNAIREDESESSIONS`
| |
| do
| |
| if [ -f $DIRPAM$FILE ];then
| |
| if [ $(cat $DIRPAM$FILE | grep -c "account required pam_time.so") -eq 0 ] ; then
| |
| echo "account required pam_time.so" >> $DIRPAM$FILE
| |
| fi
| |
| TESTGESTIONNAIRE=$TESTGESTIONNAIRE\ $FILE
| |
| fi
| |
| done
| |
| if [ $( echo $TESTGESTIONNAIRE | wc -m ) -eq 1 ] ; then
| |
| echo "Aucun gestionner de session connu , n'a été détecté."
| |
| echo " il est donc impossible d'activer le controle horaires des connections"
| |
| desactivetimelogin
| |
| exit 1
| |
| fi
| |
|
| |
| if [ ! -f $FILEPAMTIMECONF.old ] ; then
| |
| cp $FILEPAMTIMECONF $FILEPAMTIMECONF.old
| |
| fi
| |
| echo "*;*;root;Al0000-2400" > $FILEPAMTIMECONF
| |
| for NumDAY in 0 1 2 3 4 5 6
| |
| do
| |
| echo > /etc/cron.d/CTparental${DAYS[$NumDAY]}
| |
| done
| |
|
| |
| for PCUSER in `cat /etc/passwd | cut -d":" -f1,3| grep -E [1-9][0-9][0-9][0-9] | cut -d ":" -f1`
| |
| do
| |
| HORAIRESPAM=""
| |
| userisconfigured="0"
| |
|
| |
|
| while read line
| | PING youporn.com (127.0.0.10) 56(84) bytes of data. |
| do
| |
|
| |
| if [ $( echo $line | grep -E -c "^$PCUSER=[0-6]=" ) -eq 1 ] ; then
| |
| echo "$line"
| |
| NumDAY=$(echo $line | cut -d"=" -f2)
| |
| h1=$(echo $line | cut -d"=" -f3 | cut -d":" -f1 | cut -d"h" -f1)
| |
| m1=$(echo $line | cut -d"=" -f3 | cut -d":" -f1 | cut -d"h" -f2)
| |
| h2=$(echo $line | cut -d"=" -f3 | cut -d":" -f2 | cut -d"h" -f1)
| |
| m2=$(echo $line | cut -d"=" -f3 | cut -d":" -f2 | cut -d"h" -f2)
| |
| h3=$(echo $line | cut -d"=" -f3 | cut -d":" -f3 | cut -d"h" -f1)
| |
| m3=$(echo $line | cut -d"=" -f3 | cut -d":" -f3 | cut -d"h" -f2)
| |
| h4=$(echo $line | cut -d"=" -f3 | cut -d":" -f4 | cut -d"h" -f1)
| |
| m4=$(echo $line | cut -d"=" -f3 | cut -d":" -f4 | cut -d"h" -f2)
| |
| if [ $(echo -n $h3$m3 | wc -c) -gt 2 ]; then
| |
| if [ $NumDAY -eq 6 ] ; then
| |
| HORAIRESPAM="$HORAIRESPAM${DAYSPAM[$NumDAY]}$h1$m1-$h2$m2|${DAYSPAM[$NumDAY]}$h3$m3-$h4$m4"
| |
|
| |
| else
| |
| HORAIRESPAM="$HORAIRESPAM${DAYSPAM[$NumDAY]}$h1$m1-$h2$m2|${DAYSPAM[$NumDAY]}$h3$m3-$h4$m4|"
| |
| fi
| |
| echo "$m2 $h2 * * ${DAYSCRON[$NumDAY]} root /usr/bin/skill -KILL -u$PCUSER" >> /etc/cron.d/CTparental${DAYS[$NumDAY]}
| |
| echo "$m4 $h4 * * ${DAYSCRON[$NumDAY]} root /usr/bin/skill -KILL -u$PCUSER" >> /etc/cron.d/CTparental${DAYS[$NumDAY]}
| |
| userisconfigured="1"
| |
|
| |
|
| else
| | bytes from 127.0.0.10: icmp_req=1 ttl=64 time=0.026 ms |
| if [ $NumDAY -eq 6 ] ; then
| |
| HORAIRESPAM="$HORAIRESPAM${DAYSPAM[$NumDAY]}$h1$m1-$h2$m2"
| |
| else
| |
| HORAIRESPAM="$HORAIRESPAM${DAYSPAM[$NumDAY]}$h1$m1-$h2$m2|"
| |
| fi
| |
| echo "$m2 $h2 * * ${DAYSCRON[$NumDAY]} root /usr/bin/skill -KILL -u$PCUSER" >> /etc/cron.d/CTparental${DAYS[$NumDAY]}
| |
| userisconfigured="1"
| |
| fi
| |
| fi
| |
|
| |
|
| |
| done < $FILE_HCONF
| |
| if [ $userisconfigured -eq 1 ] ; then
| |
| echo "*;*;$PCUSER;$HORAIRESPAM" >> $FILEPAMTIMECONF
| |
| else
| |
| echo "*;*;$PCUSER;Al0000-2400" >> $FILEPAMTIMECONF
| |
| fi
| |
| done
| |
|
| |
|
| $SED "s?^HOURSCONNECT.*?HOURSCONNECT=ON?g" $FILE_CONF
| | Si l'adresse IP est différente de 127.0.0.10 c'est que le filtrage ne fonctionne pas. |
| $CMDSERVICE$namservicecrond restart
| |
| }
| |
|
| |
|
| | Pour l'aide tapez : |
|
| |
|
| if [ ! -z ${2} ];then
| | # CTparental |
| DIRhtmlPersonaliser=${2}
| |
| if [ ! -d $DIRhtmlPersonaliser ];then
| |
| echo "Chemin de répertoir non valide!"
| |
| exit 0
| |
| fi
| |
| fi
| |
| usage="Usage: CTparental.sh {-i }|{ -u }|{ -dl }|{ -ubl }|{ -rl }|{ -on }|{ -off }|{ -cble }|{ -dble }
| |
| |{ -tlo }|{ -tlu }|{ -uhtml }|{ -aupon }|{ -aupoff }|{ -aup }
| |
| -i => Install le controll parental sur l'ordinateur (pc de bureau) peut ètre utiliser avec
| |
| un paramètre suplémentaire pour indiquer un chemin de sources pour la page web de redirection.
| |
| exemple : CTparental.sh -i /home/toto/html/
| |
| si pas d'option le \"sens interdit\" est utiliser par default.
| |
| -u => désinstall le controll parental de l'ordinateur (pc de bureau)
| |
| -dl => mais a jour le controll a partir de la black liste de l'université de toulouse
| |
| -ubl => A faire aprés chaque modification du fichier $DNS_FILTER_OSSI
| |
| -rl => A faire aprés chaque modification manuel du fichier $DREAB
| |
| -on => Active le controll parental
| |
| -off => Désactive le controll parental
| |
| -cble => Configure du mode de filtrage par liste blanche ou par liste noir(default) ainssi que les
| |
| catégories que l'on veux activer.
| |
| -dble => Remet les catégories activent par défaut et filtrage par liste noir.
| |
| -tlo => Active est paramètre les restrictions horaire de login pour les utilisateurs.
| |
| Compatible avec les gestionnaire de sessions suivant $GESTIONNAIREDESESSIONS .
| |
| -tlu => Desative les restrictions horaire de login pour les utilisateurs.
| |
| -uhtml => mait a jour la page de redirection a partir d'un repertoir source ou par defaut avec
| |
| le \"sens interdit\".
| |
| exemples:
| |
| - avec un repertoir source : CTparental.sh -uhtml /home/toto/html/
| |
| - par default : CTparental.sh -uhtml
| |
| -aupon => active la mise ajour automatique de la black liste de toulouse (tous les 7 jours).
| |
| -aupoff => desactve la mise ajour automatique de la black liste de toulouse.
| |
| -aup => comme -dl mais seulement si il n'y a pas eu de mise a jour depuis plus de 7 jours.
| |
| "
| |
| case $args in
| |
| -\? | -h* | --h*)
| |
| echo "$usage"
| |
| exit 0
| |
| ;;
| |
| -i | --install )
| |
| install
| |
| exit 0
| |
| ;;
| |
| -u | --uninstall )
| |
| autoupdateoff
| |
| dnsmasqoff
| |
| desactivetimelogin
| |
| uninstall
| |
| exit 0
| |
| ;;
| |
| -dl | --download )
| |
| download
| |
| adapt
| |
| catChoice
| |
| dnsmasqon
| |
| $SED "s?^LASTUPDATE.*?LASTUPDATE=$THISDAYS=`date +%d-%m-%Y\ %T`?g" $FILE_CONF
| |
| exit 0
| |
| ;;
| |
| -ubl | --updatebl )
| |
| adapt
| |
| catChoice
| |
| dnsmasqon
| |
| exit 0
| |
| ;;
| |
| -uhtml | --updatehtml )
| |
| FoncHTTPDCONF
| |
| exit 0
| |
| ;;
| |
| -rl | --reload )
| |
| catChoice
| |
| dnsmasqon
| |
| exit 0
| |
| ;;
| |
| -on | --on )
| |
| dnsmasqon
| |
| exit 0
| |
| ;;
| |
| -off | --off )
| |
| autoupdateoff
| |
| dnsmasqoff
| |
| exit 0
| |
| ;;
| |
| -wlo | --whitelistonly )
| |
| dnsmasqwhitelistonly
| |
| exit 0
| |
| ;;
| |
| -cble | --confblenable )
| |
| choiblenabled
| |
| catChoice
| |
| dnsmasqon
| |
| exit 0
| |
| ;;
| |
| -dble | --defaultblenable )
| |
| initblenabled
| |
| catChoice
| |
| dnsmasqon
| |
| ;;
| |
| -tlo | --timeloginon )
| |
| activetimelogin
| |
| ;;
| |
| -tlu | --timeloginon )
| |
| desactivetimelogin
| |
| ;;
| |
| -trf | --timeloginon )
| |
| readTimeFILECONF
| |
| ;;
| |
| -aupon | --autoupdateon )
| |
| autoupdateon
| |
| ;;
| |
| -aupoff | --autoupdateoff )
| |
| autoupdateoff
| |
| ;;
| |
| -aup | --autoupdate )
| |
| autoupdate
| |
| ;;
| |
|
| |
| *)
| |
| echo "Argument inconnu :$1";
| |
| echo "$usage";
| |
| exit 1
| |
| ;;
| |
| esac
| |
|
| |
|
| | sans aucun paramètre. |
|
| |
|
| </code>
| | == Configuration == |
| '''index.php'''
| | Pour les versions 4.20.27 et supérieures on accède à l'interface d'administration par le lien web suivant: https://admin.ct.local |
| <code php>
| |
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
| |
| <HTML><!-- written by Rexy -->
| |
| <HEAD>
| |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
| |
| <TITLE>ALCASAR DNS filtering</TITLE>
| |
| <link rel="stylesheet" href="/CTadmin/css/style.css" type="text/css">
| |
| </HEAD>
| |
| <body>
| |
| <?
| |
| function form_filter ($form_content)
| |
| {
| |
| // réencodage iso + format unix + rc fin de ligne (ouf...)
| |
| $list = str_replace("\r\n", "\n", utf8_decode($form_content));
| |
| if (strlen($list) != 0){
| |
| if ($list[strlen($list)-1] != "\n") { $list[strlen($list)]="\n";} ;} ;
| |
| return $list;
| |
| }
| |
| # Choice of language
| |
| $Language = 'en';
| |
| if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
| |
| $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
| |
| $Language = strtolower(substr(chop($Langue[0]),0,2)); }
| |
| if($Language == 'fr'){
| |
| $l_hours_error1="un mauvais format horaire a étais trouver:exemple 8h30 doit c'écrir 08h30";
| |
| $l_hours_error2="incoérance horaire: ";
| |
| $l_hours_on = "Les horaires de connection sont actuellement activés";
| |
| $l_hours_off = "Les horaires de connection sont actuellement désactivés";
| |
| $l_switch_hours_off = "Désactiver les horaires de connection";
| |
| $l_switch_hours_on = "Activer les horaires de connection";
| |
| $l_hours1 = "Heures de connections autorisées";
| |
| $l_switch_Init_bl = "Init Catégories";
| |
| $l_auto_update_on = "La mise a jour de la blackliste de Toulouse tout les 7 jour est activé";
| |
| $l_auto_update_off = "La mise a jour de la blackliste de Toulouse tout les 7 jour est désactivé";
| |
| $l_switch_auto_update_on = "Activer Maj Auto";
| |
| $l_switch_auto_update_off = "Désactiver Maj Auto";
| |
| $l_fmenu_black = "Firlrage par BlackListe";
| |
| $l_fmenu_white = "Firlrage par WhiteListe";
| |
| $l_title1 = "Filtrage de noms de domaine ";
| |
| $l_error_open_file="Erreur d'ouverture du fichier";
| |
| $l_dnsfilter_on="Le filtrage de noms de domaine est actuellement activé";
| |
| $l_dnsfilter_off="Le filtrage de noms de domaine est actuellement désactivé";
| |
| $l_switch_filtering_on="Activer le filtrage";
| |
| $l_switch_filtering_off="Désactiver le filtrage";
| |
| $l_main_bl="Liste noire/blanche";
| |
| $l_bl_version="Version actuelle :";
| |
| $l_bl_categories_bl="Choix des catégories à filtrer";
| |
| $l_bl_categories_wl="Choix des catégories à autoriser";
| |
| $l_download_bl="Télécharger la dernière version";
| |
| $l_fingerprint="L'empreinte numérique du fichier téléchargé est : ";
| |
| $l_fingerprint2="Vérifiez-là en suivant ce lien (ligne 'blacklists.tar.gz') : ";
| |
| $l_activate_bl="Activer la nouvelle version";
| |
| $l_reject_bl="Rejeter";
| |
| $l_warning="Temps estimé : une minute.";
| |
| $l_specific_filtering="Filtrage special";
| |
| $l_forbidden_dns="Noms de domaine filtrés";
| |
| $l_forbidden_dns_explain="Entrez un nom de domaine par ligne (exemple : domaine.org)";
| |
| $l_one_dns="Entrez un nom de domaine par ligne (exemple : domaine.org)";
| |
| $l_rehabilitated_dns="Noms de domaine réhabilités";
| |
| $l_rehabilitated_dns_explain_bl="1-Entrez ici des noms de domaine bloqués par la liste noire <BR> que vous souhaitez réhabiliter.";
| |
| $l_rehabilitated_dns_explain_wl="2-Entrez ici des noms de domaine autorisée en plus de ceux <BR> de la liste blanche de Toulouze.";
| |
| $l_add_to_bl="Noms de domaine ajoutés à la liste noire";
| |
| $l_record="Enregistrer les modifications";
| |
| $l_wait="Une fois validées, 30 secondes sont nécessaires pour traiter vos modifications";
| |
| }
| |
| else {
| |
| $l_hours_error1="un mauvais format horaire a étais trouver:exemple 8h30 doit c'écrir 08h30";
| |
| $l_hours_error2="incoérance horaire: ";
| |
| $l_hours_on = "Les horaires de connection sont actuellement activés";
| |
| $l_hours_off = "Les horaires de connection sont actuellement désactivés";
| |
| $l_switch_hours_off = "Désactiver les horaires de connection";
| |
| $l_switch_hours_on = "Activer les horaires de connection";
| |
| $l_hours1 = "Heures de connections autorisées";
| |
| $l_switch_Init_bl = "Init Catégories";
| |
| $l_auto_update_on = "La mise a jour de la blackliste de Toulouse tout les 7 jour est activé";
| |
| $l_auto_update_off = "La mise a jour de la blackliste de Toulouse tout les 7 jour est désactivé";
| |
| $l_switch_auto_update_on = "Activer Maj Auto";
| |
| $l_switch_auto_update_off = "Désactiver Maj Auto";
| |
| $l_fmenu_black = "Firlrage par BlackListe";
| |
| $l_fmenu_white = "Firlrage par WhiteListe";
| |
| $l_title1 = "Domain names filtering";
| |
| $l_error_open_file="Error opening the file";
| |
| $l_dnsfilter_on="Actually, the Domain name filter is on";
| |
| $l_dnsfilter_off="Actually, the Domain name filter is off";
| |
| $l_switch_filtering_on="Switch the Filter on";
| |
| $l_switch_filtering_off="Switch the Filter off";
| |
| $l_main_bl="Blacklist/Whiteliste";
| |
| $l_bl_version="Current version : ";
| |
| $l_bl_categories_bl="Choice of filtered categories";
| |
| $l_bl_categories_wl="Choice of autorised categories";
| |
| $l_download_bl="Download the last version";
| |
| $l_fingerprint="The digital fingerprint of the downloaded blacklist is : ";
| |
| $l_fingerprint2="Verify it with this link (line 'blacklists.tar.gz') : ";
| |
| $l_activate_bl="Activate the new version";
| |
| $l_reject_bl="Reject";
| |
| $l_warning="Estimated time : one minute.";
| |
| $l_specific_filtering="Specific filtering";
| |
| $l_forbidden_dns="Filtered domain names";
| |
| $l_forbidden_dns_explain="Enter one domain name per row (exemple : domain.org)";
| |
| $l_one_dns="Enter one domain name per row (example : domain.org)";
| |
| $l_rehabilitated_dns="Rehabilitated domain names";
| |
| $l_rehabilitated_dns_explain_bl="Enter here domain names that are blocked by the blacklist <BR> and you want to rehabilitate.";
| |
| $l_rehabilitated_dns_explain_wl="2-Entrez ici des noms de domaine autorisée en plus de ceux <BR> de la liste blanche de Toulouze.";
| |
| $l_add_to_bl="Domain names to add to blacklist";
| |
| $l_record="Save changes";
| |
| $l_wait="Once validated, 30 seconds is necessary to compute your modifications";
| |
| }
| |
| $weeknum = array( 0,1,2,3,4,5,6);
| |
| $bl_categories="/usr/local/etc/CTparental/bl-categories-available";
| |
| $bl_categories_enabled="/usr/local/etc/CTparental/categories-enabled";
| |
| $conf_file="/usr/local/etc/CTparental/CTparental.conf";
| |
| $hconf_file="/usr/local/etc/CTparental/CThours.conf";
| |
| $wl_domains="/usr/local/etc/CTparental/domaine-rehabiliter";
| |
| $bl_domains="/usr/local/etc/CTparental/blackliste-local";
| |
| # default values
| |
|
| |
|
| | Pour les versions 4.20.26 on accède à l'interface d'administration par le lien web suivant: https://admin.ct.localhost |
|
| |
|
| if (isset($_POST['choix'])){ $choix=$_POST['choix']; } else { $choix=""; }
| | Pour les versions inférieure à 4.20.26 on accède à l'interface d'administration par le lien web suivant: http://127.0.0.1/CTadmin |
| switch ($choix)
| |
| {
| |
| case 'BL_On' :
| |
| exec ("sudo -u root /usr/local/bin/CTparental.sh -on");
| |
| break;
| |
| case 'BL_Off' :
| |
| exec ("sudo -u root /usr/local/bin/CTparental.sh -off");
| |
| break;
| |
| case 'H_On' :
| |
| exec ("sudo -u root /usr/local/bin/CTparental.sh -trf");
| |
| break;
| |
| case 'H_Off' :
| |
| exec ("sudo -u root /usr/local/bin/CTparental.sh -tlu");
| |
| break;
| |
| case 'AUP_On' :
| |
| exec ("sudo -u root /usr/local/bin/CTparental.sh -aupon");
| |
| break;
| |
| case 'AUP_Off' :
| |
| exec ("sudo -u root /usr/local/bin/CTparental.sh -aupoff");
| |
| break;
| |
| case 'INIT_BL' :
| |
| exec ("sudo -u root /usr/local/bin/CTparental.sh -dble");
| |
| break;
| |
| case 'Download_bl' :
| |
| exec ("sudo -u root /usr/local/bin/CTparental.sh -dl");
| |
| break;
| |
| case 'MAJ_cat' :
| |
| $tab=file($bl_categories_enabled);
| |
| if ($tab)
| |
| {
| |
| $pointeur=fopen($bl_categories_enabled, "w+");
| |
| foreach ($_POST as $key => $value)
| |
| {
| |
| if (strstr($key,'chk-'))
| |
| {
| |
| $line=str_replace('chk-','',$key)."\n";
| |
| fwrite($pointeur,$line);
| |
| }
| |
| }
| |
| fclose($pointeur);
| |
| }
| |
| else {echo "$l_error_open_file $bl_categories_enabled";}
| |
| $fichier=fopen($bl_domains,"w+");
| |
| fputs($fichier, form_filter($_POST['OSSI_bl_domains']));
| |
| fclose($fichier);
| |
| unset($_POST['OSSI_bl_domains']);
| |
| $fichier=fopen($wl_domains,"w+");
| |
| fputs($fichier, form_filter($_POST['OSSI_wl_domains']));
| |
| fclose($fichier);
| |
| unset($_POST['OSSI_wl_domains']);
| |
| exec ("sudo -u root /usr/local/bin/CTparental.sh -ubl");
| |
| break;
| |
| case 'MAJ_H' :
| |
| $formatheuresok=1;
| |
| if (isset($_POST['selectuser'])){ $selectuser=$_POST['selectuser']; }
| |
| #echo "$selectuser";
| |
| $tab=file($hconf_file);
| |
| if ($tab)
| |
| {
| |
| $pointeur=fopen($hconf_file, "w+");
| |
| foreach ($tab as $line)
| |
| {
| |
| if (strstr($line,$selectuser) == false)
| |
| {
| |
| fwrite($pointeur,$line); # on reécrit toutes les lignes ne corepondent pas a l'utilisateur selectionner
| |
| }
| |
|
| |
| }
| |
| }
| |
| else {echo "$l_error_open_file $hconf_file";}
| |
| if (isset($_POST["isadmin"])){fwrite($pointeur,"$selectuser=admin="."\n"); }
| |
| else
| |
| {
| |
| fwrite($pointeur,"$selectuser=user="."\n");
| |
| foreach ($weeknum as $numday)
| |
| {
| |
| $formatheuresok=1;
| |
| if (isset($_POST["h1$numday"])){ $h1[$numday]=$_POST["h1$numday"]; } else { $h1[$numday]="00h00"; }
| |
| if (isset($_POST["h2$numday"])){ $h2[$numday]=$_POST["h2$numday"]; } else { $h2[$numday]="23h59"; }
| |
| if (isset($_POST["h3$numday"])){ $h3[$numday]=$_POST["h3$numday"]; } else { $h3[$numday]=""; }
| |
| if (isset($_POST["h4$numday"])){ $h4[$numday]=$_POST["h4$numday"]; } else { $h4[$numday]=""; }
| |
| if (preg_match("/^[0-1][0-9]h[0-5][0-9]$|^2[0-3]h[0-5][0-9]$/",$h1[$numday])!=1){$formatheuresok=0;}
| |
| if (preg_match("/^[0-1][0-9]h[0-5][0-9]$|^2[0-3]h[0-5][0-9]$/",$h2[$numday])!=1){$formatheuresok=0;}
| |
| if ($h3[$numday]=="")
| |
| {
| |
|
| |
| if ($formatheuresok == 1)
| |
| {
| |
| $t1=explode("h", $h1[$numday]);
| |
| $t2=explode("h", $h2[$numday]);
| |
| $v1="$t1[0]$t1[1]";
| |
| $v2="$t2[0]$t2[1]";
| |
| if ( $v1 < $v2)
| |
| {
| |
| fwrite($pointeur,"$selectuser=$numday=$h1[$numday]:$h2[$numday]"."\n");
| |
| }
| |
| else
| |
| {
| |
| fwrite($pointeur,"$selectuser=$numday=00h00:23h59"."\n");
| |
| echo "<H3>$l_hours_error2 $h1[$numday]>=$h2[$numday]</H3>";
| |
| }
| |
| }
| |
| else
| |
| {
| |
| fwrite($pointeur,"$selectuser=$numday=00h00:23h59"."\n");
| |
| echo "<H3>$l_hours_error1</H3>";
| |
| }
| |
| }
| |
| else
| |
| {
| |
| if (preg_match("/^[0-1][0-9]h[0-5][0-9]$|^2[0-3]h[0-5][0-9]$/",$h3[$numday])!=1){$formatheuresok=0;}
| |
| if (preg_match("/^[0-1][0-9]h[0-5][0-9]$|^2[0-3]h[0-5][0-9]$/",$h4[$numday])!=1){$formatheuresok=0;}
| |
| if ($formatheuresok == 1)
| |
| {
| |
| $t1=explode("h", $h1[$numday]);
| |
| $t2=explode("h", $h2[$numday]);
| |
| $t3=explode("h", $h3[$numday]);
| |
| $t4=explode("h", $h4[$numday]);
| |
| $v1="$t1[0]$t1[1]";
| |
| $v2="$t2[0]$t2[1]";
| |
| $v3="$t3[0]$t3[1]";
| |
| $v4="$t4[0]$t4[1]";
| |
| if ( $v1 < $v2 && $v2 < $v3 && $v3 < $v4)
| |
| {
| |
| fwrite($pointeur,"$selectuser=$numday=$h1[$numday]:$h2[$numday]:$h3[$numday]:$h4[$numday]"."\n");
| |
| }
| |
| else
| |
| {
| |
| fwrite($pointeur,"$selectuser=$numday=00h00:23h59"."\n");
| |
| echo "<H3>$l_hours_error2 $h1[$numday]>=$h2[$numday]>=$h3[$numday]>=$h4[$numday]</H3>";
| |
| }
| |
| }
| |
| else
| |
| {
| |
| fwrite($pointeur,"$selectuser=$numday=00h00:23h59"."\n");
| |
| echo "<H3>$l_hours_error1</H3>";
| |
|
| |
| }
| |
| }
| |
|
| |
|
| }
| | Pour les versions 4.20.9 et supérieures dans le Choix des catégories à filtrer ajouter la catégorie '''ctparental'''<br /> |
| }
| | Pour les versions inférieures ajouter la liste ci dessous dans les [https://github.com/marsat/CTparental/wiki/Noms-de-domaine-filtr%C3%A9s-%28ossi%29 Noms de domaine filtrés] |
|
| |
| fclose($pointeur);
| |
| exec ("sudo -u root /usr/local/bin/CTparental.sh -trf");
| |
| break;
| |
|
| |
|
| }
| | Pour les utilisateurs des applications winehq et playonelinux en ctparental versions 4.20.11 et inférieures,<br /> |
| | si le proxy système n'est pas pris en compte il faut le paramétrer via la base de registre de votre disque dur virtuel ou par le menu configuration de l’application qui a besoin d'accéder à internet.<br /> |
| | Les versions 4.20.12 et supérieures ne sont pas affectées par ce problème. |
|
| |
|
| echo "<TABLE width='100%' border=0 cellspacing=0 cellpadding=0>";
| | Par exemple, pour Internet Explorer : |
| echo "<tr><th>$l_title1</th></tr>";
| |
| echo "<tr bgcolor='#FFCC66'><td><img src='/images/pix.gif' width=1 height=2></td></tr>";
| |
| echo "</TABLE>";
| |
| echo "<TABLE width='100%' border=1 cellspacing=0 cellpadding=0>";
| |
| echo "<tr><td valign='middle' align='left'>";
| |
|
| |
|
| if (is_file ($conf_file))
| | <pre> |
| {
| | REGEDIT4 |
| $tab=file($conf_file);
| |
| if ($tab)
| |
| {
| |
| foreach ($tab as $line)
| |
| {
| |
| $field=explode("=", $line);
| |
| if ($field[0] == "LASTUPDATE") {$LASTUPDATE=trim($field[2]);}
| |
| if ($field[0] == "DNSMASQ") {$DNSMASQ=trim($field[1]);}
| |
| if ($field[0] == "AUTOUPDATE") {$AUTOUPDATE=trim($field[1]);}
| |
| if ($field[0] == "HOURSCONNECT") {$HOURSCONNECT=trim($field[1]);}
| |
|
| |
| }
| |
| }
| |
| }
| |
| else { echo "$l_error_open_file $conf_file";}
| |
| if ($DNSMASQ <> "OFF")
| |
| {
| |
| echo "<CENTER><H3>$l_dnsfilter_on</H3></CENTER>";
| |
| echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
| |
| echo "<input type=hidden name='choix' value=\"BL_Off\">";
| |
| echo "<input type=submit value=\"$l_switch_filtering_off\">";
| |
| }
| |
| else
| |
| {
| |
| echo "<CENTER><H3>$l_dnsfilter_off</H3></CENTER>";
| |
| echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
| |
| echo "<input type=hidden name='choix' value=\"BL_On\">";
| |
| echo "<input type=submit value=\"$l_switch_filtering_on\">";
| |
| }
| |
| echo "</FORM>";
| |
| if ( $DNSMASQ<>"OFF"){
| |
| include 'dns.php';
| |
| }
| |
| echo "</TABLE>";
| |
| echo "<TABLE width='100%' border=0 cellspacing=0 cellpadding=0>";
| |
| echo "<tr><th>$l_hours1</th></tr>";
| |
| echo "<tr bgcolor='#FFCC66'><td><img src='/images/pix.gif' width=1 height=2></td></tr>";
| |
| echo "</TABLE>";
| |
| echo "<TABLE width='100%' border=1 cellspacing=0 cellpadding=0>";
| |
| echo "<tr><td valign='middle' align='left'>";
| |
| if ($HOURSCONNECT == "ON")
| |
| {
| |
| echo "<CENTER><H3>$l_hours_on</H3></CENTER>";
| |
| echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
| |
| echo "<input type=hidden name='choix' value=\"H_Off\">";
| |
| echo "<input type=submit value=\"$l_switch_hours_off\">";
| |
| }
| |
| else
| |
| {
| |
| echo "<CENTER><H3>$l_hours_off</H3></CENTER>";
| |
| echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
| |
| echo "<input type=hidden name='choix' value=\"H_On\">";
| |
| echo "<input type=submit value=\"$l_switch_hours_on\">";
| |
| }
| |
| echo "</FORM>";
| |
|
| |
|
| if ($HOURSCONNECT == "ON")
| | [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings] |
| {
| |
| include 'hours.php';
| |
| }
| |
| echo "</td></tr>";
| |
| ?>
| |
| </BODY>
| |
| </HTML>
| |
| </code>
| |
| '''dns.php'''
| |
| <code php>
| |
| <?
| |
| if (isset($_GET['filtragemode'])){ $filtragemode=$_GET['filtragemode']; } else {$filtragemode=$DNSMASQ;}
| |
| if ($filtragemode == 'WHITE')
| |
| {
| |
| $bl_categories="/usr/local/etc/CTparental/wl-categories-available";
| |
| }
| |
| else { $bl_categories="/usr/local/etc/CTparental/bl-categories-available";}
| |
|
| |
|
| $filtragemode = urlencode($filtragemode);
| | "ProxyEnable"=dword:00000001 |
| echo "<table border=0 width=400 cellpadding=0 cellspacing=2>";
| |
| echo "<tr valign=top>";
| |
| echo "<td align=center"; if ( $filtragemode == "BLACK" ) { echo " bgcolor=\"#FFCC66\"";} echo ">";
| |
| echo "<a href=\"$_SERVER[PHP_SELF]?filtragemode=BLACK\" title=\"\"><font color=\"black\"><b>$l_fmenu_black</b></font></a></td>";
| |
| echo "<td align=center"; if ( $filtragemode == "WHITE" ) { echo " bgcolor=\"#FFCC66\"";} echo ">";
| |
| echo "<a href=\"$_SERVER[PHP_SELF]?filtragemode=WHITE\" title=\"\"><font color=\"black\"><b>$l_fmenu_white</b></font></a></td>";
| |
| echo "</tr>";
| |
| echo" </table>";
| |
| echo "</td></tr>";
| |
|
| |
|
| | "ProxyServer"="http=127.0.0.1:8080;https=127.0.0.1:8080" |
|
| |
|
| function echo_file ($filename)
| | [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap] |
| {
| |
| if (file_exists($filename))
| |
| {
| |
| if (filesize($filename) != 0)
| |
| {
| |
| $pointeur=fopen($filename,"r");
| |
| $tampon = fread($pointeur, filesize($filename));
| |
| fclose($pointeur);
| |
| echo $tampon;
| |
| }
| |
| }
| |
| else
| |
| {
| |
| echo "$l_error_openfile $filename";
| |
| }
| |
| }
| |
|
| |
|
| echo "<TABLE width='100%' border=1 cellspacing=0 cellpadding=1>";
| | "AutoDetect"=dword:00000000 |
| echo "<CENTER><H3>$l_main_bl</H3></CENTER>";
| |
| echo "<tr><td valign='middle' align='left' colspan=10>";
| |
| echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
| |
| echo "<center>$l_bl_version $LASTUPDATE";
| |
| echo "</center><BR>";
| |
| echo "<input type='hidden' name='choix' value='Download_bl'>";
| |
| echo "<input type='submit' value='$l_download_bl'>";
| |
| echo " ($l_warning)";
| |
|
| |
|
| echo "</FORM>";
| | "IntranetName"=dword:00000001 |
| echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
| |
| echo "<input type='hidden' name='choix' value='INIT_BL'>";
| |
| echo "<input type='submit' value='$l_switch_Init_bl'>";
| |
| echo "</FORM>";
| |
| if ($AUTOUPDATE == "ON")
| |
| {
| |
| echo "<CENTER><H3>$l_auto_update_on</H3></CENTER>";
| |
| echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
| |
| echo "<input type=hidden name='choix' value=\"AUP_Off\">";
| |
| echo "<input type=submit value=\"$l_switch_auto_update_off\">";
| |
| }
| |
| else
| |
| {
| |
| echo "<CENTER><H3>$l_auto_update_off</H3></CENTER>";
| |
| echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
| |
| echo "<input type=hidden name='choix' value=\"AUP_On\">";
| |
| echo "<input type=submit value=\"$l_switch_auto_update_on\">";
| |
| }
| |
| echo "</FORM>";
| |
| echo "</td></tr>";
| |
| echo "<tr><td valign=\"middle\" align=\"left\" colspan=10>";
| |
| echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
| |
| echo "<input type='hidden' name='choix' value='MAJ_cat'>";
| |
| if ($filtragemode == "BLACK"){echo "<center>$l_bl_categories_bl</center></td></tr>";}
| |
| else {echo "<center>$l_bl_categories_wl</center></td></tr>";}
| |
|
| |
|
| //on lit et on interprete le fichier de catégories
| | "ProxyByPass"=dword:00000001 |
| $cols=1;
| | |
| if (file_exists($bl_categories))
| | </pre> |
| {
| |
| $pointeur=fopen($bl_categories,"r");
| |
| while (!feof ($pointeur))
| |
| {
| |
| $ligne=fgets($pointeur, 4096);
| |
| if ($ligne)
| |
| {
| |
| if ($cols == 1) { echo "<tr>";}
| |
| $categorie=trim(basename($ligne));
| |
| echo "<td><a href='bl_categories_help.php?cat=$categorie' target='cat_help' onclick=window.open('bl_categories_help.php','cat_help','width=600,height=150,toolbar=no,scrollbars=no,resizable=yes') title='categories help page'>$categorie</a><br>";
| |
| echo "<input type='checkbox' name='chk-$categorie'";
| |
| // la categorie n'existe pas dans le fichier de categorie activer -> categorie non selectionnée
| |
| $str = file_get_contents($bl_categories_enabled);
| |
| if (strpos($str, $categorie)===false) { echo ">";}
| |
| else { echo "checked>"; }
| |
| echo "</td>";
| |
| $cols++;
| |
| if ($cols > 10) {
| |
| echo "</tr>";
| |
| $cols=1; }
| |
| }
| |
| }
| |
| fclose($pointeur);
| |
| }
| |
| else {
| |
| echo "$l_error_open_file $bl_categories";
| |
| }
| |
| echo "</td></tr>";
| |
| echo "<tr><td valign='middle' align='left' colspan=10></td></tr>";
| |
| echo "<tr><td colspan=5 align=center>";
| |
| if ($filtragemode == "BLACK"){echo "<H3>$l_rehabilitated_dns</H3>$l_rehabilitated_dns_explain_bl<BR>$l_one_dns<BR>";}
| |
| else {echo "<H3>$l_rehabilitated_dns</H3>$l_rehabilitated_dns_explain_wl<BR>$l_one_dns<BR>";}
| |
| echo "<textarea name='OSSI_wl_domains' rows=5 cols=40>";
| |
| echo_file ($wl_domains);
| |
| echo "</textarea></td>";
| |
| if ( $filtragemode == "BLACK" ) {
| |
| echo "<td colspan=5 align=center>";
| |
| echo "<H3>$l_forbidden_dns</H3>$l_forbidden_dns_explain<BR>";
| |
| echo "<textarea name='OSSI_bl_domains' rows=5 cols=40>";
| |
| echo_file ($bl_domains);
| |
| echo "</textarea></td>";
| |
| }
| |
| echo "</tr><tr><td colspan=10>";
| |
| | |
| echo "<input type='submit' value='$l_record'>";
| |
| echo "</form> ($l_wait)";
| |
| | |
| echo "</td></tr>";
| |
| echo "</TABLE>";
| |
| ?>
| |
| </code>
| |
| '''hours.php'''
| |
| <code php>
| |
| | |
| <?
| |
| # Choice of language
| |
| $Language = 'en';
| |
| if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
| |
| $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
| |
| $Language = strtolower(substr(chop($Langue[0]),0,2)); }
| |
| if($Language == 'fr'){
| |
| $l_selectuser="l'utilisateur selectionner est: ";
| |
| $l_userisnotselect="Veuillez selectionner un utilisateur.";
| |
| $l_isadmin = "7j/7 24h/24";
| |
| $l_valide = "Enregistrer";
| |
| $to = " a " ;
| |
| $and = " et " ;
| |
| $l_select = "Selectionner";
| |
| $l_info1 = "08h00 a 24h00 ou 08h00 a 12h00 et 14h00 a 24h00";
| |
| $week = array( "lundi","mardi","mercredi","jeudi","vendredi","samedi","dimanche");
| |
| }
| |
| else {
| |
| $l_userisnotselect="Veuillez selectionner un utilisateur.";
| |
| $l_selectuser="l'utilisateur selectionner est: ";
| |
| $l_isadmin = "7j/7 24h/24";
| |
| $l_valide = "Enregistrer";
| |
| $l_select = "Select";
| |
| $to = " to " ;
| |
| $and = " and " ;
| |
| $l_info1 = "08h00 a 24h00 ou 08h00 a 12h00 et 14h00 a 24h00";
| |
| $week = array( "lundi","mardi","mercredi","jeudi","vendredi","samedi","dimanche");
| |
| }
| |
| if (isset($_POST['selectuser'])){ $selectuser=$_POST['selectuser']; }
| |
| | |
| | |
| ### on lit est on interprète le fichier CTparental.conf
| |
| echo "<TABLE width='100%' border=0 cellspacing=0 cellpadding=0>";
| |
| exec ("cat /etc/passwd | cut -d\":\" -f1,3| grep -E [1-9][0-9][0-9][0-9] | cut -d \":\" -f1",$USERSPC); # récupération des utilisateurs du poste.(UID >= 1000)
| |
| echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
| |
| echo "<select name=\"selectuser\">";
| |
| if ($selectuser){echo "<option value=\"$selectuser\">$selectuser\n"; }
| |
| else {echo "<option value=\"\">\n"; }
| |
| foreach ($USERSPC as $USERSELECT){echo "<option value=\"$USERSELECT\">$USERSELECT\n";}
| |
| echo " </select>";
| |
| echo "<input type=\"submit\" value=\"$l_select\">";
| |
| echo "</FORM>";
| |
| if (isset($selectuser)) {
| |
| echo "</TABLE>";
| |
| echo "<TABLE width='400' border=0 cellspacing=0 cellpadding=0>";
| |
| echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
| |
| echo "<CENTER><H3>$l_selectuser $selectuser</H3></CENTER>";
| |
|
| |
| if (is_file ($hconf_file))
| |
| {
| |
| $tab=file($hconf_file);
| |
| if ($tab)
| |
| {
| |
| foreach ($tab as $line)
| |
| {
| |
| $field=explode("=", $line);
| |
| if ( $field[0] == $selectuser ){
| |
| $field2=explode(":", $field[2]);
| |
| $numday=$field[1];
| |
| $isconfigured=1;
| |
|
| |
| if ( $numday == "admin") { echo "<tr><td>$l_isadmin : </td><td><input type='checkbox' name='isadmin' checked></td></tr>";}
| |
| elseif ( $numday == "user") {echo "<tr><td>$l_isadmin : </td><td><input type='checkbox' name='isadmin' ></td></tr>";}
| |
| else {
| |
| echo"<tr><td>$week[$numday]:</td><td><INPUT type=\"text\" size=5 maxlength=5 value=\"$field2[0]\" name=\"h1$numday\"></td>";
| |
| echo" <td>$to <INPUT type=\"text\" size=5 maxlength=5 value=\"$field2[1]\" name=\"h2$numday\"></td>";
| |
| echo" <td>$and <INPUT type=\"text\" size=5 maxlength=5 value=\"$field2[2]\" name=\"h3$numday\"></td>";
| |
| echo" <td>$to <INPUT type=\"text\" size=5 maxlength=5 value=\"$field2[3]\" name=\"h4$numday\"></td></tr>";
| |
| }
| |
|
| |
| }
| |
|
| |
| }
| |
|
| |
| }
| |
|
| |
| }
| |
| else { echo "$l_error_open_file $hconf_file";}
| |
| | |
| if (isset($isconfigured)==0){
| |
| echo "<tr><td>$l_isadmin : </td><td><input type='checkbox' name='isadmin' checked=\"checked\"></td></tr>";
| |
| }
| |
| | |
| | |
| echo "</TABLE>";
| |
| echo "<input type=hidden name='selectuser' value=\"$selectuser\">";
| |
| echo "<input type=hidden name='choix' value=\"MAJ_H\">";
| |
| echo "<input type=\"submit\" value=\"$l_valide\">";
| |
| echo "</FORM>";
| |
| }
| |
| else { echo "<CENTER><H3>$l_userisnotselect</H3></CENTER>";}
| |
| ?>
| |
|
| |
|
| </code>
| | [[Catégorie:Logiciels Divers]] |
| '''bl_categories_help.php'''
| |
| <code php>
| |
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
| |
| <HTML><!-- written by Rexy -->
| |
| <HEAD>
| |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
| |
| <?
| |
| $bl_dir="/usr/local/etc/CTparental/dnsfilter-available/";
| |
| # Choice of language
| |
| $Language = 'en';
| |
| if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
| |
| $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
| |
| $Language = strtolower(substr(chop($Langue[0]),0,2)); }
| |
| if($Language == 'fr'){
| |
| $l_title = "Catégories de la liste noire";
| |
| $l_error_open_file="Erreur d'ouverture du fichier";
| |
| $l_close="Fermer";
| |
| $l_unknown_cat="Cette catégorie n'est pas décrite";
| |
| $l_nb_domains="Nombre de noms de domaine filtrés :";
| |
| $l_nb_urls="Nombre d'URL filtrés :";
| |
| $l_explain_adult="Sites relatifs à l'érotisme et à la pornographie";
| |
| $l_explain_agressif="Sites extrémistes, racistes, antisémites ou incitant à la haine";
| |
| $l_explain_arjel="Sites de pari en ligne certifies par l'ARJEL (Autorité de Régulation des Jeux En Ligne)";
| |
| $l_explain_astrology="Sites relatifs à l'astrologie";
| |
| $l_explain_bank="Sites de banques en ligne";
| |
| $l_explain_audio_video="Sites de téléchargement de fichiers audio et vidéo";
| |
| $l_explain_blog="Sites d'hébergement de blogs";
| |
| $l_explain_celebrity="Sites « people », stars, etc.";
| |
| $l_explain_chat="Sites de dialogue en ligne";
| |
| $l_explain_child="Sites pour enfants";
| |
| $l_explain_cleaning="Sites relatifs à la mise à jour logicielle ou antivirale";
| |
| $l_explain_dangerous_material="Sites relatifs à la création de produits dangereux (explosif, poison, etc.)";
| |
| $l_explain_dating="Sites de rencontres en ligne";
| |
| $l_explain_drogue="Sites relatifs aux produits stupéfiants";
| |
| $l_explain_filehosting="Entrepôts de fichiers (vidéo, images, son, logiciels, etc.)";
| |
| $l_explain_financial="Sites d'informations financières, bourses, etc.";
| |
| $l_explain_forums="Sites d'hébergement de forums de discussion";
| |
| $l_explain_gambling="Sites de jeux d'argent en ligne (casino, grattage virtuel, etc.)";
| |
| $l_explain_games="Sites de jeux en ligne";
| |
| $l_explain_hacking="Sites relatifs au piratage informatique";
| |
| $l_explain_jobsearch="Sites de recherche d'emplois";
| |
| $l_explain_liste_bu="Liste de sites éducatifs pour bibliothèque";
| |
| $l_explain_malware="Site relatifs au logiciels malveillants (virus, vers, trojans, etc.)";
| |
| $l_explain_manga="Site de Mangas";
| |
| $l_explain_marketingware="Sites marchands douteux (X, organes, enfants, etc.)";
| |
| $l_explain_mixed_adult="Sites pour adultes (image-choc, gore, guerre, etc.)";
| |
| $l_explain_mobile_phone="Sites relatifs aux mobiles GSM (sonneries, logos, etc.)";
| |
| $l_explain_ossi="Noms de domaine et URLs que vous ajoutez à la liste noire (voir ci-dessous)";
| |
| $l_explain_phishing="Sites relatifs à l'hammeçonnage (pièges bancaires, redirection, etc.)";
| |
| $l_explain_press="Sites de presse";
| |
| $l_explain_publicite="Sites ou bannières publicitaires";
| |
| $l_explain_radio="Sites de radios en ligne ou de podcast";
| |
| $l_explain_reaffected="Sites connus ayant changé de propriétaire (et donc de contenu)";
| |
| $l_explain_redirector="Sites de redirection, d'anonymisation ou de contournement";
| |
| $l_explain_remote_control="Sites permettant la prise de controle a distance";
| |
| $l_explain_sect="Sites sectaires";
| |
| $l_explain_social_networks="Sites de réseaux sociaux";
| |
| $l_explain_sexual_education="Sites relatifs à l'éducation sexuelle";
| |
| $l_explain_shopping="Sites de vente et d'achat en ligne";
| |
| $l_explain_sport="Sites de sport";
| |
| $l_explain_strict_redirector="URL intentionnellement mal formées";
| |
| $l_explain_strong_redirector="URL mal formées dans une requête « google »";
| |
| $l_explain_tricheur="Sites relatifs aux tricheries (examens, concours, etc.)";
| |
| $l_explain_webmail="Site WEB permettant de consultation son courrier électronique";
| |
| $l_explain_warez="Sites relatifs aux logiciels piratés (crackés), aux générateurs de clés, etc.";
| |
| }
| |
| else {
| |
| $l_title = "Blacklist categories";
| |
| $l_error_open_file="Error opening the file";
| |
| $l_close="Close";
| |
| $l_unknown_cat="This category isn't describe";
| |
| $l_nb_domains="Number of filtered domain names :";
| |
| $l_nb_urls="Number of filtered URL :";
| |
| $l_explain_adult="Sites related to eroticism and pornography";
| |
| $l_explain_agressif="Sites extremist, racist, anti-Semitic or hate";
| |
| $l_explain_arjel="Online gambling sites allowed by the french authority 'ARJEL' (Autorité de Régulation des Jeux En Ligne)";
| |
| $l_explain_astrology="Sites related to astrology";
| |
| $l_explain_audio_video="Sites for downloading audio and video";
| |
| $l_explain_bank="Online bank sites";
| |
| $l_explain_blog="Sites hosting blogs";
| |
| $l_explain_celebrity="Sites « people », stars, etc.";
| |
| $l_explain_chat="Online chat sites";
| |
| $l_explain_child="Sites for children";
| |
| $l_explain_cleaning="Sites related to software update or antiviral";
| |
| $l_explain_dangerous_material="Sites related to the creation of dangerous goods (explosives, poison, etc.)";
| |
| $l_explain_dating="Online dating sites";
| |
| $l_explain_drogue="Sites related to narcotic";
| |
| $l_explain_filehosting="Warehouses of files (video, images, sound, software, etc.)";
| |
| $l_explain_financial="Sites of financial information";
| |
| $l_explain_forums="Sites hosting discussion forums";
| |
| $l_explain_gambling="Online gambling sites (casino, virtual scratching, etc.)";
| |
| $l_explain_games="Online games sites";
| |
| $l_explain_hacking="Sites related to hacking";
| |
| $l_explain_jobsearch="Job search sites";
| |
| $l_explain_liste_bu="List of educational sites for library";
| |
| $l_explain_malware="Malware sites (viruses, worms, trojans, etc.).";
| |
| $l_explain_manga="Manga site";
| |
| $l_explain_marketingware="doubtful commercial sites";
| |
| $l_explain_mixed_adult="Adult sites (shock, gore, war, etc.).";
| |
| $l_explain_mobile_phone="Sites related to GSM mobile (ringtones, logos, etc.)";
| |
| $l_explain_ossi="Domain names and URLs you add to the blacklist (see below)";
| |
| $l_explain_phishing="Phishing sites (traps banking, redirect, etc..)";
| |
| $l_explain_press="News sites";
| |
| $l_explain_publicite="Advertising sites";
| |
| $l_explain_radio="Online radio podcast sites";
| |
| $l_explain_reaffected="Sites that have changed ownership (and therefore content)";
| |
| $l_explain_redirector="redirects, anonymization or bypass sites";
| |
| $l_explain_remote_control="Sites for making remote control";
| |
| $l_explain_sect="Sectarian sites";
| |
| $l_explain_social_networks="Social networks sites";
| |
| $l_explain_sexual_education="Sites related to sex education";
| |
| $l_explain_shopping="Shopping sites and online shopping";
| |
| $l_explain_sport="Sport sites";
| |
| $l_explain_strict_redirector="Intentionally malformed URL";
| |
| $l_explain_strong_redirector="Malformed URL in a 'google' query";
| |
| $l_explain_tricheur="Sites related to cheating (tests, examinations, etc.)";
| |
| $l_explain_webmail="Web sites for e-mail consultation";
| |
| $l_explain_warez="Sites related to cracked softwares";
| |
| }
| |
| if (isset($_GET['cat'])){$categorie=$_GET['cat'];}
| |
| $bl_categorie_domain_file=$bl_dir.$categorie.".conf";
| |
| if (file_exists($bl_categorie_domain_file))
| |
| $nb_domains=exec ("wc -w $bl_categorie_domain_file|cut -d' ' -f1");
| |
| else
| |
| $nb_domains=$l_error_openfilei." ".$bl_categorie_domain_file;
| |
| if (file_exists($bl_categorie_url_file))
| |
| $nb_urls=exec ("wc -w $bl_categorie_url_file|cut -d' ' -f1");
| |
| else
| |
| $nb_urls=$l_error_openfile." ".$bl_categorie_url_file;
| |
| echo "<TITLE>$l_title</TITLE>";
| |
| ?>
| |
| <link rel="stylesheet" href="/CTadmin/css/style.css" type="text/css">
| |
| </HEAD>
| |
| <body>
| |
| <TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
| |
| <tr><th><?php echo $categorie ;?></th></tr>
| |
| <tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
| |
| </TABLE>
| |
| <TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
| |
| <tr><td valign="middle" align="left">
| |
| <?php
| |
| $compat_categorie=strtr($categorie,"-","_");
| |
| if (!empty(${'l_explain_'.$compat_categorie}))
| |
| echo "<center><b>${'l_explain_'.$compat_categorie}</b></center>";
| |
| else echo "$l_unknown_cat";
| |
| echo "<br>$l_nb_domains <b>$nb_domains</b><br>";
| |
| ?>
| |
| </td></tr>
| |
| </TABLE>
| |
| <br>
| |
| <center><a href="javascript:window.close();"><b><?php echo "$l_close"; ?></b></a></center>
| |
| </BODY>
| |
| </HTML>
| |
| </code>
| |
| [[Catégorie:Scripts]] | |