erreur 500 site [Réglé]
maj vers 5.0.11
Support Général
janus57 Membre non connecté
-
Booster Fusée
- Voir le profil du membre janus57
- Inscrit le : 07/12/2007
- Groupes :
-
Equipe Assistance
Reprise du message précédent
Bonjour,Manque de chance avec une erreur 500 y a de forte chance (+90%) qu'il n'y est rien dans /cache/error.log vu que c'est apache qui affiche ce message et donc il faudrait les logs apache (ce que free ne donne pas).
Cordialement, janus57
xela Membre non connecté
-
Modérateur
- Voir le profil du membre xela
- Inscrit le : 26/12/2015
- Groupes :
-
Equipe Rédaction
Avez vous eu le temps de tester linstall sur free? Il me semble que janus57 a un compte chez eux.
Et effectivement il n'y a pas d'accès aux les logs apache chez free
.Merci davance.
Cordialement,
Xela
janus57 Membre non connecté
-
Booster Fusée
- Voir le profil du membre janus57
- Inscrit le : 07/12/2007
- Groupes :
-
Equipe Assistance
non, comme dit je le ferais dès que j'aurais un moment (on va dire que débug chez free c'est casse tête et je suis en examen blanc donc pas le moment du tout).
Cordialement, janus57
xela Membre non connecté
-
Modérateur
- Voir le profil du membre xela
- Inscrit le : 26/12/2015
- Groupes :
-
Equipe Rédaction
donc concernant mon pb, j'ai uploadé dossier par dossier (vidage du cache à chaque fois) et actualisé mon site test.
Après un petit moment.... j'ai trouvé d'où vient le pb, il s'agit du HtaccessFileCache.php
J'ai modifié :
Code PHP :
private function add_hide_directory_listings() { $this->add_section('Hide directory listings'); $this->add_line('Options -Indexes'); $this->add_line('Options +FollowSymLinks'); $this->add_line('Options -Multiviews'); $this->add_section('Prevent viewing of .htaccess file'); $this->add_line('<Files .htaccess>'); $this->add_line(' # Apache ??? 2.3'); $this->add_line(' <IfModule mod_authz_core.c>'); $this->add_line(' Require all denied'); $this->add_line(' </IfModule>'); $this->add_line(' # Apache 2.2'); $this->add_line(' <IfModule !mod_authz_core.c>'); $this->add_line(' Order Allow,Deny'); $this->add_line(' Deny from all'); $this->add_line(' </IfModule>'); $this->add_line('</Files>'); }
en
Code PHP :
private function add_hide_directory_listings() { $this->add_section('Hide directory listings'); $this->add_line('Options -Indexes'); $this->add_line('Options +FollowSymLinks'); $this->add_line('Options -Multiviews'); $this->add_section('Prevent viewing of .htaccess file'); $this->add_line('<Files .htaccess>'); $this->add_line(' order allow,deny'); $this->add_line(' deny from all'); $this->add_line('</Files>'); }
J'ai remis tout simplement le code de la v5.0.10.
Soit le serveur n'arrive pas à lire et interpréter ces instructions soit il interdit ces instructions "IfModule mod_authz_core.c".
Peut etre que je me trompe, mais il me semble que "Require all denied" est utilisable chez Free sur les serveur apache 2.3 mais la condition ne fonctionne pas.
Et comment connaitre la version d'apache chez Free? Dans l'espace abonné peut etre ? J'ai pas encore fouillé lol
J'attends vos retours qui vont un peu plus m'éclairer
.Cordialement,
Xela
EDIT : Autre petite question,que signifie le point d'exclamation ici : "<IfModule !mod_authz_core.c>" ?
Édité par xela Le 08/12/2016 à 17h10
olivierb Membre non connecté
-
Modérateur
- Voir le profil du membre olivierb
- Inscrit le : 07/02/2014
- Site internet
- Groupes :
-
Equipe Assistance
Pour connaitre la version Apache, la commande
Code PHP :
inclut cette réponse au niveau de la ligne Serveur API ou le paragraphe SAPI Modules (selon la version PHP utilisée).<?php phpinfo(); ?>
Olivier.
Edit : Correction du code selon indications de Janus ci-dessous
Édité par olivierb Le 08/12/2016 à 17h54
Olivier


janus57 Membre non connecté
-
Booster Fusée
- Voir le profil du membre janus57
- Inscrit le : 07/12/2007
- Groupes :
-
Equipe Assistance
cela ne fonctionnera pas si PHP n'est pas en module apache (par exemple chez moi j'ai : "Server API FPM/FastCGI" ).
De plus la balise pour commencer le PHP c'est <?php car les nouvelles version de PHP refuse les short tag ou l'on carrément supprimé.
Cf : <a href="http://php.net/manual/fr/language.basic-syntax.phptags.php">http://php.net/manual/fr/language.basic-syntax.phptags.php</a>
<span class="formatter-blockquote">Citation:</span><div class="blockquote">EDIT : Autre petite question,que signifie le point d'exclamation ici : "<IfModule !mod_authz_core.c>" ? </div>
cela permet de détecter si le module apache est présent ou non, et donc de savoir quel instructions utiliser (la version 2.2- ou 2.3+)
Cordialement, janus57
xela Membre non connecté
-
Modérateur
- Voir le profil du membre xela
- Inscrit le : 26/12/2015
- Groupes :
-
Equipe Rédaction
Édité par xela Le 08/12/2016 à 17h54
janus57 Membre non connecté
-
Booster Fusée
- Voir le profil du membre janus57
- Inscrit le : 07/12/2007
- Groupes :
-
Equipe Assistance
il suffit de retirer les lignes qui posent problèmes, mais à court terme je pense que free est à abandonner à cause des nombreuses restrictions et des modules manquant (niveau de apache) et de certains autres point qui font mal (par exemple si on souhaite mettre en place une authentification via .htaccess il faut obligatoirement mettre les mots de passe en clair, sauf si cela a changé, ce qui en 2016/2017 est impensable).
De plus il existe bien d'autres alternatives à free beaucoup plus sérieux (pas obligé d'attendre 10ans pour voir la version de PHP évoluer).
Cordialement, janus57
xela Membre non connecté
-
Modérateur
- Voir le profil du membre xela
- Inscrit le : 26/12/2015
- Groupes :
-
Equipe Rédaction
Oui tu as raison. Le cryptage md5 n'est toujours pas possible chez free, j'avais essayé
.Bon pour la suite, car je ne suis pas le seul à utilisé notre phpboost chez cet hébergeur ( j'ose plus dire le nom
), je vais vérifier le PHP info puis selon le module, tester " require all denied".Si le résultat est positif, l'idéal serait de mettre un if ...(détection domaine free.fr) ' mettre require etc dans le fichier htaccess else les autres conditions. Ou peut être (je pense que c mieux ) utiliser case. De cette façon le serveur interprétera que l'instruction valide et les autres ne devraient pas poser de pb si free est placé en cas 1. Bon, je suis une bille en php mais c'est en essayant qu' on apprend non ?
.DSL j'écris de mon tel en marchant lol
janus57 Membre non connecté
-
Booster Fusée
- Voir le profil du membre janus57
- Inscrit le : 07/12/2007
- Groupes :
-
Equipe Assistance
Citation:
Le cryptage md5 n'est toujours pas possible chez free
même le MD5 et SHA1 c'est finit à cause de le puissance de calcul des GPU qui permet de les casser en quelques seconds voir minutes.
Free sont normalement en apache 2.2 (vu qu'il mettent toujours 10 ans a évoluer…), donc il faut le order,deny en directives.
Pour ma part je suis contre le fait de rajouter des exception pour free dans tous les modules (car on a de plus en plus d'exception lié à free à prendre en compte et c’est plus de la perte de temps que de l'amélioration).
Cependant si vous voulez vraiment voici le fichier à mettre "HtaccessFileCache.class.php" (je le donne à titre indicatif et ne le maintiendrai pas pour les futur MàJ, incluant la futur 5.1 et plus car comme dit il y a d'autres hébergeurs gratuit qui eux ne cassent pas les pieds) :
Code PHP :
<?php class HtaccessFileCache implements CacheData { private $htaccess_file_content=''; private $general_config; public function synchronize() { $this->htaccess_file_content=''; $this->general_config=GeneralConfig::load(); $this->add_free_php56(); $this->add_disable_signatures_protection(); $this->add_hide_directory_listings(); $this->add_server_protections(); $this->add_http_headers(); if(ServerEnvironmentConfig::load()->is_url_rewriting_enabled()) { $this->enable_rewrite_rules(); $this->add_core_rules(); $this->add_modules_rules(); $this->add_php_and_http_protections(); $this->add_file_and_sql_injections_protections(); $this->force_https_if_available(); $this->add_bandwidth_protection(); $this->add_robots_protection(); } $this->add_error_redirection(); $this->add_gzip_compression(); $this->add_expires_headers(); $this->disable_file_etags(); $this->add_manual_content(); $this->clean_file_content(); } private function add_line($line) { $this->htaccess_file_content.="\n".$line; } private function add_empty_line() { $this->add_line(''); } private function add_section($name) { $this->add_empty_line(); $this->add_line('# '.$name.' #'); } private function get_domain($hostname) { preg_match("/[a-z0-9\-]{1,63}\.[a-z\.]{2,6}$/",parse_url($hostname,PHP_URL_HOST),$_domain_tld); return isset($_domain_tld[0])?$_domain_tld[0]:''; } private function add_free_php56() { if($this->get_domain($this->general_config->get_site_url())=='free.fr') { $this->add_section('Enable PHP5.6 on '.$this->get_domain($this->general_config->get_site_url()).' hosting'); $this->add_line('php56 1'); } } private function add_disable_signatures_protection() { $this->add_section('Disable signatures protection'); $this->add_line('# Disable your Apache version number from showing up in HTTP headers for added security'); $this->add_line('<IfDefine !Free>'); $this->add_line(' <IfModule ModSecurity.c>'); $this->add_line(' ServerSignature Off'); $this->add_line(' SecServerSignature \'\''); $this->add_line(' </IfModule>'); $this->add_line('</IfDefine>'); } private function add_hide_directory_listings() { $this->add_section('Hide directory listings'); $this->add_line('Options -Indexes'); $this->add_line('Options +FollowSymLinks'); $this->add_line('Options -Multiviews'); $this->add_section('Prevent viewing of .htaccess file'); if($this->get_domain($this->general_config->get_site_url())=='free.fr') { $this->add_line('<Files .htaccess>'); $this->add_line(' Order Allow,Deny'); $this->add_line(' Deny from all'); $this->add_line('</Files>'); } else{ $this->add_line('<Files .htaccess>'); $this->add_line(' # Apache ??? 2.3'); $this->add_line(' <IfModule mod_authz_core.c>'); $this->add_line(' Require all denied'); $this->add_line(' </IfModule>'); $this->add_line(' # Apache 2.2'); $this->add_line(' <IfModule !mod_authz_core.c>'); $this->add_line(' Order Allow,Deny'); $this->add_line(' Deny from all'); $this->add_line(' </IfModule>'); $this->add_line('</Files>'); } } private function add_server_protections() { $this->add_section('Server protection'); $this->add_line('<IfDefine !Free>'); $this->add_line(' <IfModule mod_access.c>'); $this->add_line(' # Do Not Track: Universal Third-Party Web Tracking Opt Out'); $this->add_line(' # http://datatracker.ietf.org/doc/draft-mayer-do-not-track/'); $this->add_line(' SetEnvIfNoCase DNT 1 DO_NOT_TRACK'); $this->add_empty_line(); $this->add_line(' # Protect against Apache HTTP Server Denial Of Service Vulnerability. CVE-2011-3192'); $this->add_line(' SetEnvIf Range (,.*?){5,} bad-range=1'); $this->add_line(' RequestHeader unset Range env=bad-range'); $this->add_line(' </IfModule>'); $this->add_line('</IfDefine>'); } private function add_http_headers() { $this->add_section('HTTP Headers'); $this->add_line('<IfDefine !Free>'); $this->add_line(' <IfModule mod_headers.c>'); $this->add_line(' # Enable keep-alive'); $this->add_line(' Header set Connection keep-alive'); $this->add_line(' # Disable your PHP version number from showing up in HTTP headers for added security.'); $this->add_line(' Header unset X-Powered-By'); if($this->general_config->is_site_url_https()) { $this->add_line(' # Tell the browser to attempt the HTTPS version first'); $this->add_line(' Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"'); } $this->add_line(' # Don\'t allow any pages to be framed externally - Defends against CSRF'); $this->add_line(' Header set X-Frame-Options SAMEORIGIN'); $this->add_line(' # Control Cross-Domain Policies'); $this->add_line(' Header set X-Permitted-Cross-Domain-Policies "master-only"'); $this->add_line(' # Turn on IE8-IE9 XSS prevention tools'); $this->add_line(' Header set X-XSS-Protection "1; mode=block"'); $this->add_line(' # Prevent mime based attacks'); $this->add_line(' Header set X-Content-Type-Options "nosniff"'); $this->add_line(' # Use this to force IE to hide that annoying browser compatibility button in the address bar.'); $this->add_line(' # IE=edge means IE should use the latest (edge) version of its rendering engine.'); $this->add_line(' # chrome=1 means IE should use the Chrome rendering engine if installed.'); $this->add_line(' BrowserMatch MSIE ie'); $this->add_line(' Header set X-UA-Compatible "IE=Edge"'); $this->add_line(' # Disable server signature'); $this->add_line(' Header set ServerSignature "Off"'); $this->add_line(' Header set ServerTokens "Prod"'); $this->add_line(' </IfModule>'); $this->add_line('</IfDefine>'); } private function enable_rewrite_rules() { $this->add_section('Rewrite rules'); $this->add_line('RewriteEngine on'); $this->add_line('RewriteBase /'); } private function add_core_rules() { $this->add_section('Core'); $this->add_rewrite_rule('^user/pm-?([0-9]+)-?([0-9]{0,})-?([0-9]{0,})-?([0-9]{0,})-?([a-z_]{0,})\.php$','user/pm.php?pm=$1&id=$2&p=$3"e=$4'); $eps=AppContext::get_extension_provider_service(); $mappings=$eps->get_extension_point(UrlMappingsExtensionPoint::EXTENSION_POINT); $authorized_extension_point=array('kernel','user'); foreach($mappings as $id=>$mapping_list) { if(in_array($id,$authorized_extension_point)) { $this->add_url_mapping($mapping_list); } } } private function add_modules_rules() { $this->add_section('Modules rules'); $modules=ModulesManager::get_activated_modules_map(); $eps=AppContext::get_extension_provider_service(); foreach($modules as $module) { $id=$module->get_id(); $configuration=$module->get_configuration(); $rules=$configuration->get_url_rewrite_rules(); if(!empty($rules)) { $this->add_section($id); } foreach($rules as $rule) { $this->add_line(str_replace('DIR',$this->general_config->get_site_path(),$rule)); } if($eps->provider_exists($id,UrlMappingsExtensionPoint::EXTENSION_POINT)) { $this->add_section($id); $provider=$eps->get_provider($id); $url_mappings=$provider->get_extension_point(UrlMappingsExtensionPoint::EXTENSION_POINT); $this->add_url_mapping($url_mappings); } } } private function add_rewrite_rule($match,$path,$options='L,QSA') { $this->add_line('RewriteRule '.$match.' '.$this->general_config->get_site_path().'/'.ltrim($path,'/').' ['.$options.']'); } private function add_url_mapping(UrlMappingsExtensionPoint $mapping_list) { foreach($mapping_list->list_mappings()as $mapping) { $this->add_rewrite_rule($mapping->from(),$mapping->to(),$mapping->options()); } } private function add_php_and_http_protections() { $this->add_section('PHP and HTTP protections'); $this->add_line('# Disable the HTTP TRACE Method'); $this->add_line('RewriteCond %{REQUEST_METHOD} ^TRACE'); $this->add_line('RewriteRule .* - [F]'); $this->add_empty_line(); $this->add_line('# Block out use of illegal or unsafe characters in the HTTP Request'); $this->add_line('RewriteCond %{THE_REQUEST} ^.*(\\r|\\n|%0A|%0D).* [NC,OR]'); $this->add_line('# Block out use of illegal or unsafe characters in the Referer Variable of the HTTP Request'); $this->add_line('RewriteCond %{HTTP_REFERER} ^(.*)(<|>|\'|%0A|%0D|%27|%3C|%3E|%00).* [NC]'); $this->add_line('RewriteRule .* - [F,L]'); $this->add_empty_line(); $this->add_line('# Protect against PHP-CGI Remote Code Execution Bug. CVE-2012-1823'); $this->add_line('RewriteCond %{QUERY_STRING} ^(%2d|\-)[^=]+$ [NC]'); $this->add_line('RewriteRule .* - [F,L]'); $this->add_empty_line(); $this->add_line('# Stop \'PHP Easter Eggs\' from working, http://perishablepress.com/expose-php/'); $this->add_line('RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC,OR]'); $this->add_line('# Stop proc/self/environ?'); $this->add_line('RewriteCond %{QUERY_STRING} proc/self/environ [OR]'); $this->add_line('# Block out any script trying to set a mosConfig value through the URL'); $this->add_line('RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]'); $this->add_line('# Block out any script trying to base64_encode/decode content via URL'); $this->add_line('RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]'); $this->add_line('# Block out any script that includes a <script> tag in URL'); $this->add_line('RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]'); $this->add_line('# Block out any script trying to set a PHP GLOBALS variable via URL'); $this->add_line('RewriteCond %{QUERY_STRING} GLOBALS(=|[|\%[0-9A-Z]{0,2}) [OR]'); $this->add_line('# Block out any script trying to modify a _REQUEST variable via URL'); $this->add_line('RewriteCond %{QUERY_STRING} _REQUEST(=|[|\%[0-9A-Z]{0,2})'); $this->add_line('RewriteRule .* - [F,L]'); } private function add_file_and_sql_injections_protections() { $this->add_section('File and SQL injections protections'); $this->add_line('RewriteCond %{REQUEST_METHOD} GET'); $this->add_line('RewriteCond %{QUERY_STRING} (;|<|>|\'|"|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]'); $this->add_line('RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]'); $this->add_line('RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http%3A%2F%2F [OR]'); $this->add_line('RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]'); $this->add_line('RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]'); $this->add_line('RewriteCond %{QUERY_STRING} (<|>|\'|%0A|%0D|%27|%3C|%3E|%00) [NC]'); $this->add_line('RewriteRule .* - [F,L]'); } private function force_https_if_available() { } private function add_bandwidth_protection() { if(FileUploadConfig::load()->get_enable_bandwidth_protect()) { $this->add_section('Bandwith protection'); $this->add_line('RewriteCond %{HTTP_REFERER} !^$'); $this->add_line('RewriteCond %{HTTP_REFERER} !^'.$this->general_config->get_site_url()); $this->add_line('RewriteRule .*upload/.*$ - [F]'); $this->add_section('Stop hotlinking'); $this->add_line('RewriteCond %{HTTP_REFERER} !^$'); $this->add_line('RewriteCond %{HTTP_REFERER} !^'.$this->general_config->get_site_url()); $this->add_line('RewriteRule \.(bmp|gif|jpe?g|png|swf)$ - [F,L,NC]'); } } private function add_robots_protection() { $this->add_section('Bots blocking protection'); $this->add_line('# URL encoded HTML, see http://www.w3schools.com/tags/ref_urlencode.asp'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} (<|>|\'|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]'); $this->add_line('# Address harvesters'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(autoemailspider|ExtractorPro) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^E?Mail.?(Collect|Harvest|Magnet|Reaper|Siphon|Sweeper|Wolf) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} (DTS.?Agent|Email.?Extrac) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_REFERER} iaea\.org [NC,OR]'); $this->add_line('# Download managers'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Alligator|DA.?[0-9]|DC\-Sakura|Download.?(Demon|Express|Master|Wonder)|FileHound) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Flash|Leech)Get [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Fresh|Lightning|Mass|Real|Smart|Speed|Star).?Download(er)? [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Gamespy|Go!Zilla|iGetter|JetCar|Net(Ants|Pumper)|SiteSnagger|Teleport.?Pro|WebReaper) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(My)?GetRight [NC,OR]'); $this->add_line('# Image-grabbers'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(AcoiRobot|FlickBot|webcollage) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Express|Mister|Web).?(Web|Pix|Image).?(Pictures|Collector)? [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^Image.?(fetch|Stripper|Sucker) [NC,OR]'); $this->add_line('# "Gray-hats"'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Atomz|BlackWidow|BlogBot|EasyDL|Marketwave|Sqworm|SurveyBot|Webclipping\.com) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} (girafa\.com|gossamer\-threads\.com|grub\-client|Netcraft|Nutch) [NC,OR]'); $this->add_line('# Site-grabbers'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(eCatch|(Get|Super)Bot|Kapere|HTTrack|JOC|Offline|UtilMind|Xaldon) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^Web.?(Auto|Cop|dup|Fetch|Filter|Gather|Go|Leach|Mine|Mirror|Pix|QL|RACE|Sauger) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^Web.?(site.?(eXtractor|Quester)|Snake|ster|Strip|Suck|vac|walk|Whacker|ZIP) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} WebCapture [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^DISCo\ Pump [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^NetZIP [NC,OR]'); $this->add_line('# Tools'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Dart.?Communications|Enfish|htdig|Java|larbin) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} (FrontPage|Indy.?Library|RPT\-HTTPClient) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(libwww|lwp|libwww-perl.*|PHP|Python|www\.thatrobotsite\.com|webbandit|Zeus) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Microsoft|MFC).(Data|Internet|URL|WebDAV|Foundation).(Access|Explorer|Control|MiniRedir|Class) [NC,OR]'); $this->add_line('# Unknown'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Crawl_Application|Lachesis|Nutscrape) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^[CDEFPRS](Browse|Eval|Surf) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Demo|Full.?Web|Lite|Production|Franklin|Missauga|Missigua).?(Bot|Locat) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} (efp@gmx\.net|hhjhj@yahoo\.com|lerly\.net|mapfeatures\.net|metacarta\.com) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Industry|Internet|IUFW|Lincoln|Missouri|Program).?(Program|Explore|Web|State|College|Shareware) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Mac|Ram|Educate|WEP).?(Finder|Search) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Moz+illa|MSIE).?[0-9]?.?[0-9]?[0-9]?$ [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^Mozilla/[0-9]\.[0-9][0-9]?.\(compatible[\)\ ] [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} NaverRobot [NC]'); $this->add_line('RewriteRule .* - [F,L]'); } private function add_error_redirection() { $this->add_section('Error pages'); $this->add_line('ErrorDocument 403 '.$this->general_config->get_site_path().UserUrlBuilder::error_403()->relative()); $this->add_line('ErrorDocument 404 '.$this->general_config->get_site_path().UserUrlBuilder::error_404()->relative()); } private function add_gzip_compression() { $this->add_section('Gzip compression'); $this->add_line('<IfDefine !Free>'); $this->add_line(' <IfModule mod_filter.c>'); $this->add_line(' <IfModule mod_deflate.c>'); $this->add_line(' # Compress HTML, CSS, JavaScript, Text, XML and fonts'); $this->add_line(' AddOutputFilterByType DEFLATE application/javascript'); $this->add_line(' AddOutputFilterByType DEFLATE application/rss+xml'); $this->add_line(' AddOutputFilterByType DEFLATE application/vnd.ms-fontobject'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-font'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-font-opentype'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-font-otf'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-font-truetype'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-font-ttf'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-javascript'); $this->add_line(' AddOutputFilterByType DEFLATE application/xhtml+xml'); $this->add_line(' AddOutputFilterByType DEFLATE application/xml'); $this->add_line(' AddOutputFilterByType DEFLATE font/opentype'); $this->add_line(' AddOutputFilterByType DEFLATE font/otf'); $this->add_line(' AddOutputFilterByType DEFLATE font/ttf'); $this->add_line(' AddOutputFilterByType DEFLATE image/svg+xml'); $this->add_line(' AddOutputFilterByType DEFLATE image/x-icon'); $this->add_line(' AddOutputFilterByType DEFLATE text/css'); $this->add_line(' AddOutputFilterByType DEFLATE text/html'); $this->add_line(' AddOutputFilterByType DEFLATE text/javascript'); $this->add_line(' AddOutputFilterByType DEFLATE text/plain'); $this->add_line(' AddOutputFilterByType DEFLATE text/xml'); $this->add_empty_line(); $this->add_line(' # Remove browser bugs (only needed for really old browsers)'); $this->add_line(' BrowserMatch ^Mozilla/4 gzip-only-text/html'); $this->add_line(' BrowserMatch ^Mozilla/4\.0[678] no-gzip'); $this->add_line(' BrowserMatch \bMSIE !no-gzip !gzip-only-text/html'); $this->add_line(' <IfModule mod_headers.c>'); $this->add_line(' Header append Vary User-Agent'); $this->add_line(' </IfModule>'); $this->add_line(' </IfModule>'); $this->add_line(' </IfModule>'); $this->add_line('</IfDefine>'); } private function add_expires_headers() { $this->add_section('Expires Headers'); $this->add_line('<IfDefine !Free>'); $this->add_line(' <IfModule mod_expires.c>'); $this->add_line(' ExpiresActive On'); $this->add_empty_line(); $this->add_line(' # Default expiration: 1 week after request'); $this->add_line(' ExpiresDefault "access plus 1 week"'); $this->add_empty_line(); $this->add_line(' # CSS and JS expiration: 1 week after request'); $this->add_line(' ExpiresByType text/css "access plus 1 week"'); $this->add_line(' ExpiresByType text/javascript "access plus 1 week"'); $this->add_line(' ExpiresByType text/x-javascript "access plus 1 week"'); $this->add_line(' ExpiresByType application/javascript "access plus 1 week"'); $this->add_line(' ExpiresByType application/x-javascript "access plus 1 week"'); $this->add_empty_line(); $this->add_line(' # Image files expiration: 1 month after request'); $this->add_line(' ExpiresByType image/bmp "access plus 1 month"'); $this->add_line(' ExpiresByType image/gif "access plus 1 month"'); $this->add_line(' ExpiresByType image/jpeg "access plus 1 month"'); $this->add_line(' ExpiresByType image/jp2 "access plus 1 month"'); $this->add_line(' ExpiresByType image/pipeg "access plus 1 month"'); $this->add_line(' ExpiresByType image/png "access plus 1 month"'); $this->add_line(' ExpiresByType image/svg+xml "access plus 1 month"'); $this->add_line(' ExpiresByType image/tiff "access plus 1 month"'); $this->add_line(' ExpiresByType image/vnd.microsoft.icon "access plus 1 month"'); $this->add_line(' ExpiresByType image/x-icon "access plus 1 month"'); $this->add_line(' ExpiresByType image/ico "access plus 1 month"'); $this->add_line(' ExpiresByType image/icon "access plus 1 month"'); $this->add_line(' ExpiresByType text/ico "access plus 1 month"'); $this->add_line(' ExpiresByType application/ico "access plus 1 month"'); $this->add_line(' ExpiresByType image/vnd.wap.wbmp "access plus 1 month"'); $this->add_line(' ExpiresByType application/vnd.wap.wbxml "access plus 1 month"'); $this->add_line(' ExpiresByType application/smil "access plus 1 month"'); $this->add_empty_line(); $this->add_line(' # Audio files expiration: 1 month after request'); $this->add_line(' ExpiresByType audio/basic "access plus 1 month"'); $this->add_line(' ExpiresByType audio/mid "access plus 1 month"'); $this->add_line(' ExpiresByType audio/midi "access plus 1 month"'); $this->add_line(' ExpiresByType audio/mpeg "access plus 1 month"'); $this->add_line(' ExpiresByType audio/x-aiff "access plus 1 month"'); $this->add_line(' ExpiresByType audio/x-mpegurl "access plus 1 month"'); $this->add_line(' ExpiresByType audio/x-pn-realaudio "access plus 1 month"'); $this->add_line(' ExpiresByType audio/x-wav "access plus 1 month"'); $this->add_empty_line(); $this->add_line(' # Movie files expiration: 1 month after request'); $this->add_line(' ExpiresByType application/x-shockwave-flash "access plus 1 month"'); $this->add_line(' ExpiresByType x-world/x-vrml "access plus 1 month"'); $this->add_line(' ExpiresByType video/x-msvideo "access plus 1 month"'); $this->add_line(' ExpiresByType video/mpeg "access plus 1 month"'); $this->add_line(' ExpiresByType video/mp4 "access plus 1 month"'); $this->add_line(' ExpiresByType video/quicktime "access plus 1 month"'); $this->add_line(' ExpiresByType video/x-la-asf "access plus 1 month"'); $this->add_line(' ExpiresByType video/x-ms-asf "access plus 1 month"'); $this->add_line(' </IfModule>'); $this->add_line('</IfDefine>'); } private function disable_file_etags() { $this->add_section('Disable file etags'); $this->add_line('<IfDefine !Free>'); $this->add_line(' FileETag none'); $this->add_line('</IfDefine>'); } private function add_manual_content() { $manual_content=ServerEnvironmentConfig::load()->get_htaccess_manual_content(); if(!empty($manual_content)) { $this->add_section('Manual content'); $this->add_line($manual_content); } } private function clean_file_content() { $this->htaccess_file_content=trim($this->htaccess_file_content); } public function get_htaccess_file_content() { return $this->htaccess_file_content; } public static function load() { return CacheManager::load(__CLASS__,'kernel','htaccess-file'); } public static function invalidate() { CacheManager::invalidate('kernel','htaccess-file'); } public static function regenerate() { self::invalidate(); self::update_htaccess_file(); } private static function update_htaccess_file() { $file=new File(PATH_TO_ROOT.'/.htaccess'); try { $file->write(self::get_file_content()); $file->close(); } catch(IOException $ex) { ErrorHandler::add_error_in_log('Couldn\'t write the .htaccess file. Please check the site root read authorizations.',''); } } private static function get_file_content() { return self::load()->get_htaccess_file_content(); } } ?>
Cordialement, janus57
xela Membre non connecté
-
Modérateur
- Voir le profil du membre xela
- Inscrit le : 26/12/2015
- Groupes :
-
Equipe Rédaction
je vais tester! Et c'est exactement ça que je souhaitais faire 
Cependant, j'ai plusieurs remarques:
1. même si Free pose quelques problèmes, d'autres hébergeurs aussi! Vous avez d'ailleurs fait quelques patchs pour aider certains d'entre nous.
2. J'avais essayé un autre hébergeur gratuit et j'avais eu des soucis d'envois mail, vous vous en souvenez peut-être, car on avez vu ça ensemble.
3. Même si Free a ses gros défauts, je l'entends, il reste gratuit et s'avère fonctionner pour moi parfaitement.
4. La page d'accueil du CMS ne mentionne aucunement que les utilisateurs d'un espace perso chez Free ne peuvent pas l'utiliser. Hors, si un de ces utilisateurs télécharge la dernière version pour essayer, il va vite se rendre compte de l'erreur 500. Et il va surement passer son chemin et chercher un autre CMS compatible au lieu de changer d'hébergeur, enfin c'est ce que je ferai... Donc, ce n'est pas dans l’intérêt de Phpboost et de ses développeurs de rejeter les utilisateurs de Free car, comme moi, ils veulent le faire avancer et évoluer, et font de la pub pour le faire connaitre.
Donc je remercie l'ensemble de l'équipe pour son travail épatant et j'espère janus57 que l'on va enfin tomber d'accord sur l'évolution de phpboost vis à vis de free
. Bien-sûr, n'y voyez aucune animosité, on discute tout simplement.Cordialement,
Xela.
janus57 Membre non connecté
-
Booster Fusée
- Voir le profil du membre janus57
- Inscrit le : 07/12/2007
- Groupes :
-
Equipe Assistance
<span class="formatter-blockquote">Citation:</span><div class="blockquote">même si Free pose quelques problèmes, d'autres hébergeurs aussi! Vous avez d'ailleurs fait quelques patchs pour aider certains d'entre nous.</div>
cela n'a rien à voir avec les fonctions "basic", ici free plante visiblement à cause du "IfModule" ce que tout les hébergeur supporte (au devrais sinon ce sont pas des hébergeurs).
<span class="formatter-blockquote">Citation:</span><div class="blockquote">J'avais essayé un autre hébergeur gratuit et j'avais eu des soucis d'envois mail, vous vous en souvenez peut-être, car on avez vu ça ensemble.</div>
faut pas non plus prendre le plus "pourri" des gratuits, il y en a pas mal : <a href="http://lescigales.org/">http://lescigales.org/</a> + <a href="https://www.hostinger.fr/">https://www.hostinger.fr/</a> + <a href="http://hebfree.org/">http://hebfree.org/</a> + <a href="https://shost.ca/">https://shost.ca/</a> + <a href="https://www.000webhost.com/">https://www.000webhost.com/</a> (seul lescigales et hebfree n'ont pas de mentions légales).
<span class="formatter-blockquote">Citation:</span><div class="blockquote">Même si Free a ses gros défauts, je l'entends, il reste gratuit et s'avère fonctionner pour moi parfaitement.</div>
pour le moment jusqu'au jour où (et pour moi c'est pas fonctionnel à partir du moment ou on bloque des fonctions comme curl car du coup impossible d'utiliser des ressources externes).
<span class="formatter-blockquote">Citation:</span><div class="blockquote">La page d'accueil du CMS ne mentionne aucunement que les utilisateurs d'un espace perso chez Free ne peuvent pas l'utiliser</div>
comme pour tous les CMS, mais je doute que drupal dernière version fonctionne chez Free vu les pré-requis, idem pour WordPress (qui nécessite aussi certaines adaptations) etc…
Pour moi seul les fous et/ou ceux qui n'ont pas envie de faire de recherche et/ou ceux qui ne veulent pas dépenser 2€/mois (ce qui n'est pas grand chose même pour ceux qui ont des petits moyens) se tournent vers free.fr c'est la seule explication "rationnel" compte tenu de leur infrastructure, de leur très nombreuses restrictions (apache/php/mysql).
Cordialement, janus57
xela Membre non connecté
-
Modérateur
- Voir le profil du membre xela
- Inscrit le : 26/12/2015
- Groupes :
-
Equipe Rédaction
J'ai modifié le fichier en mettant "Require all denied" et il n'y a pas de message d'erreur, cela semble fonctionner.
@janus57
Citation:
Pour moi seul les fous et/ou ceux qui n'ont pas envie de faire de recherche et/ou ceux qui ne veulent pas dépenser 2€/mois (ce qui n'est pas grand chose même pour ceux qui ont des petits moyens) se tournent vers free.fr c'est la seule explication "rationnel"
Donc je ne suis ni fou, ni paresseux ( j'ai quand même fait 95% du boulot sur ce problème), et ni radin! Et je préfère vous répondre en mettant une petite bannière amusante en clin d'oeil
.Modification du HtaccessFileCache.php :
Caché:
Code PHP :
<?php class HtaccessFileCache implements CacheData { private $htaccess_file_content=''; private $general_config; public function synchronize() { $this->htaccess_file_content=''; $this->general_config=GeneralConfig::load(); $this->add_free_php56(); $this->add_disable_signatures_protection(); $this->add_hide_directory_listings(); $this->add_server_protections(); $this->add_http_headers(); if(ServerEnvironmentConfig::load()->is_url_rewriting_enabled()) { $this->enable_rewrite_rules(); $this->add_core_rules(); $this->add_modules_rules(); $this->add_php_and_http_protections(); $this->add_file_and_sql_injections_protections(); $this->force_https_if_available(); $this->add_bandwidth_protection(); $this->add_robots_protection(); } $this->add_error_redirection(); $this->add_gzip_compression(); $this->add_expires_headers(); $this->disable_file_etags(); $this->add_manual_content(); $this->clean_file_content(); } private function add_line($line) { $this->htaccess_file_content.="\n".$line; } private function add_empty_line() { $this->add_line(''); } private function add_section($name) { $this->add_empty_line(); $this->add_line('# '.$name.' #'); } private function get_domain($hostname) { preg_match("/[a-z0-9\-]{1,63}\.[a-z\.]{2,6}$/",parse_url($hostname,PHP_URL_HOST),$_domain_tld); return isset($_domain_tld[0])?$_domain_tld[0]:''; } private function add_free_php56() { if($this->get_domain($this->general_config->get_site_url())=='free.fr') { $this->add_section('Enable PHP5.6 on '.$this->get_domain($this->general_config->get_site_url()).' hosting'); $this->add_line('php56 1'); } } private function add_disable_signatures_protection() { $this->add_section('Disable signatures protection'); $this->add_line('# Disable your Apache version number from showing up in HTTP headers for added security'); $this->add_line('<IfDefine !Free>'); $this->add_line(' <IfModule ModSecurity.c>'); $this->add_line(' ServerSignature Off'); $this->add_line(' SecServerSignature \'\''); $this->add_line(' </IfModule>'); $this->add_line('</IfDefine>'); } private function add_hide_directory_listings() { $this->add_section('Hide directory listings'); $this->add_line('Options -Indexes'); $this->add_line('Options +FollowSymLinks'); $this->add_line('Options -Multiviews'); $this->add_section('Prevent viewing of .htaccess file'); if($this->get_domain($this->general_config->get_site_url())=='free.fr') { $this->add_line('<Files .htaccess>'); $this->add_line(' Require all denied'); $this->add_line('</Files>'); } else{ $this->add_line('<Files .htaccess>'); $this->add_line(' # Apache ??? 2.3'); $this->add_line(' <IfModule mod_authz_core.c>'); $this->add_line(' Require all denied'); $this->add_line(' </IfModule>'); $this->add_line(' # Apache 2.2'); $this->add_line(' <IfModule !mod_authz_core.c>'); $this->add_line(' Order Allow,Deny'); $this->add_line(' Deny from all'); $this->add_line(' </IfModule>'); $this->add_line('</Files>'); } } private function add_server_protections() { $this->add_section('Server protection'); $this->add_line('<IfDefine !Free>'); $this->add_line(' <IfModule mod_access.c>'); $this->add_line(' # Do Not Track: Universal Third-Party Web Tracking Opt Out'); $this->add_line(' # http://datatracker.ietf.org/doc/draft-mayer-do-not-track/'); $this->add_line(' SetEnvIfNoCase DNT 1 DO_NOT_TRACK'); $this->add_empty_line(); $this->add_line(' # Protect against Apache HTTP Server Denial Of Service Vulnerability. CVE-2011-3192'); $this->add_line(' SetEnvIf Range (,.*?){5,} bad-range=1'); $this->add_line(' RequestHeader unset Range env=bad-range'); $this->add_line(' </IfModule>'); $this->add_line('</IfDefine>'); } private function add_http_headers() { $this->add_section('HTTP Headers'); $this->add_line('<IfDefine !Free>'); $this->add_line(' <IfModule mod_headers.c>'); $this->add_line(' # Enable keep-alive'); $this->add_line(' Header set Connection keep-alive'); $this->add_line(' # Disable your PHP version number from showing up in HTTP headers for added security.'); $this->add_line(' Header unset X-Powered-By'); if($this->general_config->is_site_url_https()) { $this->add_line(' # Tell the browser to attempt the HTTPS version first'); $this->add_line(' Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"'); } $this->add_line(' # Don\'t allow any pages to be framed externally - Defends against CSRF'); $this->add_line(' Header set X-Frame-Options SAMEORIGIN'); $this->add_line(' # Control Cross-Domain Policies'); $this->add_line(' Header set X-Permitted-Cross-Domain-Policies "master-only"'); $this->add_line(' # Turn on IE8-IE9 XSS prevention tools'); $this->add_line(' Header set X-XSS-Protection "1; mode=block"'); $this->add_line(' # Prevent mime based attacks'); $this->add_line(' Header set X-Content-Type-Options "nosniff"'); $this->add_line(' # Use this to force IE to hide that annoying browser compatibility button in the address bar.'); $this->add_line(' # IE=edge means IE should use the latest (edge) version of its rendering engine.'); $this->add_line(' # chrome=1 means IE should use the Chrome rendering engine if installed.'); $this->add_line(' BrowserMatch MSIE ie'); $this->add_line(' Header set X-UA-Compatible "IE=Edge"'); $this->add_line(' # Disable server signature'); $this->add_line(' Header set ServerSignature "Off"'); $this->add_line(' Header set ServerTokens "Prod"'); $this->add_line(' </IfModule>'); $this->add_line('</IfDefine>'); } private function enable_rewrite_rules() { $this->add_section('Rewrite rules'); $this->add_line('RewriteEngine on'); $this->add_line('RewriteBase /'); } private function add_core_rules() { $this->add_section('Core'); $this->add_rewrite_rule('^user/pm-?([0-9]+)-?([0-9]{0,})-?([0-9]{0,})-?([0-9]{0,})-?([a-z_]{0,})\.php$','user/pm.php?pm=$1&id=$2&p=$3"e=$4'); $eps=AppContext::get_extension_provider_service(); $mappings=$eps->get_extension_point(UrlMappingsExtensionPoint::EXTENSION_POINT); $authorized_extension_point=array('kernel','user'); foreach($mappings as $id=>$mapping_list) { if(in_array($id,$authorized_extension_point)) { $this->add_url_mapping($mapping_list); } } } private function add_modules_rules() { $this->add_section('Modules rules'); $modules=ModulesManager::get_activated_modules_map(); $eps=AppContext::get_extension_provider_service(); foreach($modules as $module) { $id=$module->get_id(); $configuration=$module->get_configuration(); $rules=$configuration->get_url_rewrite_rules(); if(!empty($rules)) { $this->add_section($id); } foreach($rules as $rule) { $this->add_line(str_replace('DIR',$this->general_config->get_site_path(),$rule)); } if($eps->provider_exists($id,UrlMappingsExtensionPoint::EXTENSION_POINT)) { $this->add_section($id); $provider=$eps->get_provider($id); $url_mappings=$provider->get_extension_point(UrlMappingsExtensionPoint::EXTENSION_POINT); $this->add_url_mapping($url_mappings); } } } private function add_rewrite_rule($match,$path,$options='L,QSA') { $this->add_line('RewriteRule '.$match.' '.$this->general_config->get_site_path().'/'.ltrim($path,'/').' ['.$options.']'); } private function add_url_mapping(UrlMappingsExtensionPoint $mapping_list) { foreach($mapping_list->list_mappings()as $mapping) { $this->add_rewrite_rule($mapping->from(),$mapping->to(),$mapping->options()); } } private function add_php_and_http_protections() { $this->add_section('PHP and HTTP protections'); $this->add_line('# Disable the HTTP TRACE Method'); $this->add_line('RewriteCond %{REQUEST_METHOD} ^TRACE'); $this->add_line('RewriteRule .* - [F]'); $this->add_empty_line(); $this->add_line('# Block out use of illegal or unsafe characters in the HTTP Request'); $this->add_line('RewriteCond %{THE_REQUEST} ^.*(\\r|\\n|%0A|%0D).* [NC,OR]'); $this->add_line('# Block out use of illegal or unsafe characters in the Referer Variable of the HTTP Request'); $this->add_line('RewriteCond %{HTTP_REFERER} ^(.*)(<|>|\'|%0A|%0D|%27|%3C|%3E|%00).* [NC]'); $this->add_line('RewriteRule .* - [F,L]'); $this->add_empty_line(); $this->add_line('# Protect against PHP-CGI Remote Code Execution Bug. CVE-2012-1823'); $this->add_line('RewriteCond %{QUERY_STRING} ^(%2d|\-)[^=]+$ [NC]'); $this->add_line('RewriteRule .* - [F,L]'); $this->add_empty_line(); $this->add_line('# Stop \'PHP Easter Eggs\' from working, http://perishablepress.com/expose-php/'); $this->add_line('RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC,OR]'); $this->add_line('# Stop proc/self/environ?'); $this->add_line('RewriteCond %{QUERY_STRING} proc/self/environ [OR]'); $this->add_line('# Block out any script trying to set a mosConfig value through the URL'); $this->add_line('RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]'); $this->add_line('# Block out any script trying to base64_encode/decode content via URL'); $this->add_line('RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]'); $this->add_line('# Block out any script that includes a <script> tag in URL'); $this->add_line('RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]'); $this->add_line('# Block out any script trying to set a PHP GLOBALS variable via URL'); $this->add_line('RewriteCond %{QUERY_STRING} GLOBALS(=|[|\%[0-9A-Z]{0,2}) [OR]'); $this->add_line('# Block out any script trying to modify a _REQUEST variable via URL'); $this->add_line('RewriteCond %{QUERY_STRING} _REQUEST(=|[|\%[0-9A-Z]{0,2})'); $this->add_line('RewriteRule .* - [F,L]'); } private function add_file_and_sql_injections_protections() { $this->add_section('File and SQL injections protections'); $this->add_line('RewriteCond %{REQUEST_METHOD} GET'); $this->add_line('RewriteCond %{QUERY_STRING} (;|<|>|\'|"|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]'); $this->add_line('RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]'); $this->add_line('RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http%3A%2F%2F [OR]'); $this->add_line('RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]'); $this->add_line('RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]'); $this->add_line('RewriteCond %{QUERY_STRING} (<|>|\'|%0A|%0D|%27|%3C|%3E|%00) [NC]'); $this->add_line('RewriteRule .* - [F,L]'); } private function force_https_if_available() { } private function add_bandwidth_protection() { if(FileUploadConfig::load()->get_enable_bandwidth_protect()) { $this->add_section('Bandwith protection'); $this->add_line('RewriteCond %{HTTP_REFERER} !^$'); $this->add_line('RewriteCond %{HTTP_REFERER} !^'.$this->general_config->get_site_url()); $this->add_line('RewriteRule .*upload/.*$ - [F]'); $this->add_section('Stop hotlinking'); $this->add_line('RewriteCond %{HTTP_REFERER} !^$'); $this->add_line('RewriteCond %{HTTP_REFERER} !^'.$this->general_config->get_site_url()); $this->add_line('RewriteRule \.(bmp|gif|jpe?g|png|swf)$ - [F,L,NC]'); } } private function add_robots_protection() { $this->add_section('Bots blocking protection'); $this->add_line('# URL encoded HTML, see http://www.w3schools.com/tags/ref_urlencode.asp'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} (<|>|\'|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]'); $this->add_line('# Address harvesters'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(autoemailspider|ExtractorPro) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^E?Mail.?(Collect|Harvest|Magnet|Reaper|Siphon|Sweeper|Wolf) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} (DTS.?Agent|Email.?Extrac) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_REFERER} iaea\.org [NC,OR]'); $this->add_line('# Download managers'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Alligator|DA.?[0-9]|DC\-Sakura|Download.?(Demon|Express|Master|Wonder)|FileHound) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Flash|Leech)Get [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Fresh|Lightning|Mass|Real|Smart|Speed|Star).?Download(er)? [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Gamespy|Go!Zilla|iGetter|JetCar|Net(Ants|Pumper)|SiteSnagger|Teleport.?Pro|WebReaper) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(My)?GetRight [NC,OR]'); $this->add_line('# Image-grabbers'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(AcoiRobot|FlickBot|webcollage) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Express|Mister|Web).?(Web|Pix|Image).?(Pictures|Collector)? [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^Image.?(fetch|Stripper|Sucker) [NC,OR]'); $this->add_line('# "Gray-hats"'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Atomz|BlackWidow|BlogBot|EasyDL|Marketwave|Sqworm|SurveyBot|Webclipping\.com) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} (girafa\.com|gossamer\-threads\.com|grub\-client|Netcraft|Nutch) [NC,OR]'); $this->add_line('# Site-grabbers'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(eCatch|(Get|Super)Bot|Kapere|HTTrack|JOC|Offline|UtilMind|Xaldon) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^Web.?(Auto|Cop|dup|Fetch|Filter|Gather|Go|Leach|Mine|Mirror|Pix|QL|RACE|Sauger) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^Web.?(site.?(eXtractor|Quester)|Snake|ster|Strip|Suck|vac|walk|Whacker|ZIP) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} WebCapture [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^DISCo\ Pump [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^NetZIP [NC,OR]'); $this->add_line('# Tools'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Dart.?Communications|Enfish|htdig|Java|larbin) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} (FrontPage|Indy.?Library|RPT\-HTTPClient) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(libwww|lwp|libwww-perl.*|PHP|Python|www\.thatrobotsite\.com|webbandit|Zeus) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Microsoft|MFC).(Data|Internet|URL|WebDAV|Foundation).(Access|Explorer|Control|MiniRedir|Class) [NC,OR]'); $this->add_line('# Unknown'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Crawl_Application|Lachesis|Nutscrape) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^[CDEFPRS](Browse|Eval|Surf) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Demo|Full.?Web|Lite|Production|Franklin|Missauga|Missigua).?(Bot|Locat) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} (efp@gmx\.net|hhjhj@yahoo\.com|lerly\.net|mapfeatures\.net|metacarta\.com) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Industry|Internet|IUFW|Lincoln|Missouri|Program).?(Program|Explore|Web|State|College|Shareware) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Mac|Ram|Educate|WEP).?(Finder|Search) [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^(Moz+illa|MSIE).?[0-9]?.?[0-9]?[0-9]?$ [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} ^Mozilla/[0-9]\.[0-9][0-9]?.\(compatible[\)\ ] [NC,OR]'); $this->add_line('RewriteCond %{HTTP_USER_AGENT} NaverRobot [NC]'); $this->add_line('RewriteRule .* - [F,L]'); } private function add_error_redirection() { $this->add_section('Error pages'); $this->add_line('ErrorDocument 403 '.$this->general_config->get_site_path().UserUrlBuilder::error_403()->relative()); $this->add_line('ErrorDocument 404 '.$this->general_config->get_site_path().UserUrlBuilder::error_404()->relative()); } private function add_gzip_compression() { $this->add_section('Gzip compression'); $this->add_line('<IfDefine !Free>'); $this->add_line(' <IfModule mod_filter.c>'); $this->add_line(' <IfModule mod_deflate.c>'); $this->add_line(' # Compress HTML, CSS, JavaScript, Text, XML and fonts'); $this->add_line(' AddOutputFilterByType DEFLATE application/javascript'); $this->add_line(' AddOutputFilterByType DEFLATE application/rss+xml'); $this->add_line(' AddOutputFilterByType DEFLATE application/vnd.ms-fontobject'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-font'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-font-opentype'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-font-otf'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-font-truetype'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-font-ttf'); $this->add_line(' AddOutputFilterByType DEFLATE application/x-javascript'); $this->add_line(' AddOutputFilterByType DEFLATE application/xhtml+xml'); $this->add_line(' AddOutputFilterByType DEFLATE application/xml'); $this->add_line(' AddOutputFilterByType DEFLATE font/opentype'); $this->add_line(' AddOutputFilterByType DEFLATE font/otf'); $this->add_line(' AddOutputFilterByType DEFLATE font/ttf'); $this->add_line(' AddOutputFilterByType DEFLATE image/svg+xml'); $this->add_line(' AddOutputFilterByType DEFLATE image/x-icon'); $this->add_line(' AddOutputFilterByType DEFLATE text/css'); $this->add_line(' AddOutputFilterByType DEFLATE text/html'); $this->add_line(' AddOutputFilterByType DEFLATE text/javascript'); $this->add_line(' AddOutputFilterByType DEFLATE text/plain'); $this->add_line(' AddOutputFilterByType DEFLATE text/xml'); $this->add_empty_line(); $this->add_line(' # Remove browser bugs (only needed for really old browsers)'); $this->add_line(' BrowserMatch ^Mozilla/4 gzip-only-text/html'); $this->add_line(' BrowserMatch ^Mozilla/4\.0[678] no-gzip'); $this->add_line(' BrowserMatch \bMSIE !no-gzip !gzip-only-text/html'); $this->add_line(' <IfModule mod_headers.c>'); $this->add_line(' Header append Vary User-Agent'); $this->add_line(' </IfModule>'); $this->add_line(' </IfModule>'); $this->add_line(' </IfModule>'); $this->add_line('</IfDefine>'); } private function add_expires_headers() { $this->add_section('Expires Headers'); $this->add_line('<IfDefine !Free>'); $this->add_line(' <IfModule mod_expires.c>'); $this->add_line(' ExpiresActive On'); $this->add_empty_line(); $this->add_line(' # Default expiration: 1 week after request'); $this->add_line(' ExpiresDefault "access plus 1 week"'); $this->add_empty_line(); $this->add_line(' # CSS and JS expiration: 1 week after request'); $this->add_line(' ExpiresByType text/css "access plus 1 week"'); $this->add_line(' ExpiresByType text/javascript "access plus 1 week"'); $this->add_line(' ExpiresByType text/x-javascript "access plus 1 week"'); $this->add_line(' ExpiresByType application/javascript "access plus 1 week"'); $this->add_line(' ExpiresByType application/x-javascript "access plus 1 week"'); $this->add_empty_line(); $this->add_line(' # Image files expiration: 1 month after request'); $this->add_line(' ExpiresByType image/bmp "access plus 1 month"'); $this->add_line(' ExpiresByType image/gif "access plus 1 month"'); $this->add_line(' ExpiresByType image/jpeg "access plus 1 month"'); $this->add_line(' ExpiresByType image/jp2 "access plus 1 month"'); $this->add_line(' ExpiresByType image/pipeg "access plus 1 month"'); $this->add_line(' ExpiresByType image/png "access plus 1 month"'); $this->add_line(' ExpiresByType image/svg+xml "access plus 1 month"'); $this->add_line(' ExpiresByType image/tiff "access plus 1 month"'); $this->add_line(' ExpiresByType image/vnd.microsoft.icon "access plus 1 month"'); $this->add_line(' ExpiresByType image/x-icon "access plus 1 month"'); $this->add_line(' ExpiresByType image/ico "access plus 1 month"'); $this->add_line(' ExpiresByType image/icon "access plus 1 month"'); $this->add_line(' ExpiresByType text/ico "access plus 1 month"'); $this->add_line(' ExpiresByType application/ico "access plus 1 month"'); $this->add_line(' ExpiresByType image/vnd.wap.wbmp "access plus 1 month"'); $this->add_line(' ExpiresByType application/vnd.wap.wbxml "access plus 1 month"'); $this->add_line(' ExpiresByType application/smil "access plus 1 month"'); $this->add_empty_line(); $this->add_line(' # Audio files expiration: 1 month after request'); $this->add_line(' ExpiresByType audio/basic "access plus 1 month"'); $this->add_line(' ExpiresByType audio/mid "access plus 1 month"'); $this->add_line(' ExpiresByType audio/midi "access plus 1 month"'); $this->add_line(' ExpiresByType audio/mpeg "access plus 1 month"'); $this->add_line(' ExpiresByType audio/x-aiff "access plus 1 month"'); $this->add_line(' ExpiresByType audio/x-mpegurl "access plus 1 month"'); $this->add_line(' ExpiresByType audio/x-pn-realaudio "access plus 1 month"'); $this->add_line(' ExpiresByType audio/x-wav "access plus 1 month"'); $this->add_empty_line(); $this->add_line(' # Movie files expiration: 1 month after request'); $this->add_line(' ExpiresByType application/x-shockwave-flash "access plus 1 month"'); $this->add_line(' ExpiresByType x-world/x-vrml "access plus 1 month"'); $this->add_line(' ExpiresByType video/x-msvideo "access plus 1 month"'); $this->add_line(' ExpiresByType video/mpeg "access plus 1 month"'); $this->add_line(' ExpiresByType video/mp4 "access plus 1 month"'); $this->add_line(' ExpiresByType video/quicktime "access plus 1 month"'); $this->add_line(' ExpiresByType video/x-la-asf "access plus 1 month"'); $this->add_line(' ExpiresByType video/x-ms-asf "access plus 1 month"'); $this->add_line(' </IfModule>'); $this->add_line('</IfDefine>'); } private function disable_file_etags() { $this->add_section('Disable file etags'); $this->add_line('<IfDefine !Free>'); $this->add_line(' FileETag none'); $this->add_line('</IfDefine>'); } private function add_manual_content() { $manual_content=ServerEnvironmentConfig::load()->get_htaccess_manual_content(); if(!empty($manual_content)) { $this->add_section('Manual content'); $this->add_line($manual_content); } } private function clean_file_content() { $this->htaccess_file_content=trim($this->htaccess_file_content); } public function get_htaccess_file_content() { return $this->htaccess_file_content; } public static function load() { return CacheManager::load(__CLASS__,'kernel','htaccess-file'); } public static function invalidate() { CacheManager::invalidate('kernel','htaccess-file'); } public static function regenerate() { self::invalidate(); self::update_htaccess_file(); } private static function update_htaccess_file() { $file=new File(PATH_TO_ROOT.'/.htaccess'); try { $file->write(self::get_file_content()); $file->close(); } catch(IOException $ex) { ErrorHandler::add_error_in_log('Couldn\'t write the .htaccess file. Please check the site root read authorizations.',''); } } private static function get_file_content() { return self::load()->get_htaccess_file_content(); } } ?>
Cordialement,
Xela
janus57 Membre non connecté
-
Booster Fusée
- Voir le profil du membre janus57
- Inscrit le : 07/12/2007
- Groupes :
-
Equipe Assistance
juste une dernière question et après j'arrête : pourquoi s'amuser à re-donner une version de HtaccessFileCache.php sachant que celle que j'ai donné fonctionne ?
Cordialement, janus57
xela Membre non connecté
-
Modérateur
- Voir le profil du membre xela
- Inscrit le : 26/12/2015
- Groupes :
-
Equipe Rédaction
cf explications trouvées en autre ICI
EDIT :
Et franchement, à part ma petite bannière, ça ne m'amuse pas vraiment...
Édité par xela Le 10/12/2016 à 01h21
janus57 Membre non connecté
-
Booster Fusée
- Voir le profil du membre janus57
- Inscrit le : 07/12/2007
- Groupes :
-
Equipe Assistance
sauf que free utilise une V2.2 "custom", donc peut être qu'il n'y a pas d'erreur mais rien n'indique que le code n'est pris en compte, donc par mesure de sécurité j'ai laissé l'instruction qui passe (même en V2.3/2.4).
Cordialement, janus57
Répondre
Sujet verrouillé, vous ne pouvez pas poster de message