Impedisci l'accesso o elimina automaticamente readme.html, license.txt, wp-config-sample.php
3 risposta
- voti
-
- 2011-05-15
Non è davveronecessario rimuovere questifile.Èmoltopiùfacilebloccarne l'accesso.Se stai utilizzando URL carini,haigià unfile .htaccess.Usare .htaccessperbloccarei file è sicuroe devi solo aggiungere una direttiva una volta.
Ilblocco deifile vieneeffettuato aggiungendo una direttiva a .htaccessin questomodo:
& lt;filesnomefile.file-extension > ordine consentire,negare negato datutti & lt;/files > Quindi,perbloccare readme.html,fai questo:
& lt;files readme.html > ordine consentire,negare negato datutti & lt;/files >
Fai lo stesso conilfile di licenza o qualsiasi altrofile a cui desideriimpedire l'accesso a chiunque.Basta aprire .htaccessin Blocconote oin qualsiasi altroeditor ditesto dibase,aggiungere le direttivee salvare,assicurandosi che l'editor ditestomantengaesattamenteilnome delfile,senza alcun .txt allafine.
You don't really need to remove these files. It's much easier to just block access to them. If you are using pretty URL's you already have an .htaccess file. Using .htaccess to block the files is secure and you only have to add a directive once.
Blocking files is done by adding a directive to .htaccess like this:
<files filename.file-extension> order allow,deny deny from all </files>
So, to block readme.html you do this:
<files readme.html> order allow,deny deny from all </files>
Do the same with the license file or any other file you want to prevent anyone from accessing. Just open .htaccess in Notepad or any other basic text editor, add the directives and save, making sure that the text editor keeps the file name exactly - without any .txt on the end.
-
Questa èin realtà l'opzione che ho scelto.Funzionaperfettamente.This is actually the option I ended up going with. It works perfectly.
- 1
- 2011-05-16
- Sahas Katta
-
** Attenzione **,che la sintassi sopra è valida solofino ad Apache 2.2!Successivamente usa "Require all denied" (sostituendo quelle 2 lineeinterne)per Apache 2.4e superiori.[Maggiori dettagli qui] (https://httpd.apache.org/docs/2.4/upgrading.html#authz)**Beware**, that the above Syntax is only valid up to Apache 2.2! Afterwards use `Require all denied` (replacing those inner 2 lines) for Apache 2.4 and above. [More Details here](https://httpd.apache.org/docs/2.4/upgrading.html#authz)
- 2
- 2017-03-07
- Frank Nocke
-
- 2015-09-06
Ecco lamia opinione:
RewriteRule (?:readme|license|changelog|-config|-sample)\.(?:php|md|txt|html?) - [R=404,NC,L]
- 404 (nonesistente) anziché 403 (vietato)perevitare qualsiasiindizio sull'esistenza.
- anchenelle sottocartelle (adesempiotemi eplug-in,chepotrebbero offrire opportunità di attacco)
- non distinguetramaiuscolee minuscole,flessibileper leestensioni,cattura anche README.html o license.html (sentiti libero di aggiungerei tipici sospetti comei log dellemodifiche| faq| contributi)
Personalmente,bloccherei anche:
RewriteRule \.(?:psd|log|cmd|exe|bat|c?sh)$ - [NC,F]
nb:
- '?:' dichiara semplicemente che laparentesinon corrisponde (nessunaimportanza).
- richiede che RewriteEngine sia
on
(moltoprobabilmente lo è. sarebbe raro,usare wordpress senza ... (bruttipermalink,ecc ...)). - inserisci prima la sezione
# BEGIN WordPress
neltuo .htaccess
Here is my take:
RewriteRule (?:readme|license|changelog|-config|-sample)\.(?:php|md|txt|html?) - [R=404,NC,L]
- 404 (not existing) rather than 403 (forbidden) to avoid any clue about existence.
- also in subfolders (i.e. themes and plugins, which might offer attack opportunities)
- case-insensitive, extension-flexible, also catches README.html, or license.html (feel free to add typical suspects like changelogs|faq|contributing)
Personally, I would also block:
RewriteRule \.(?:psd|log|cmd|exe|bat|c?sh)$ - [NC,F]
nb:
- '?:' just declares the bracket to be non-matching (no importance).
- requires RewriteEngine to be
on
(it most likely is. it would be rare, to use wordpress without... (ugly permalinks, etc...)). - insert before the
# BEGIN WordPress
section in your .htaccess
-
- 2010-12-15
add_action('core_upgrade_preamble','my_function_to_delete_files');
Modifica:puoi ancheprovare questi
add_action('upgrader_pre_install','my_function_to_delete_files'); add_action('upgrader_post_install','my_function_to_delete_files');
add_action('core_upgrade_preamble','my_function_to_delete_files');
Edit : you can also try these
add_action('upgrader_pre_install','my_function_to_delete_files'); add_action('upgrader_post_install','my_function_to_delete_files');
-
Grazie,ho capito lafunzione di scollegamentophpe funziona,ma unproblema.L'hook che haifornito sembraessereeseguito semplicemente visitando la sezione Aggiornamentiin Dashboard.C'è un altro hookper dopo che è avvenuto l'aggiornamento?Thanks, I figured out the php unlink feature and it works, but one issue. The hook you provided seems to execute by simply visiting the Updates section under Dashboard. Is there another hook for after the upgrade has occured?
- 0
- 2010-12-15
- Sahas Katta
-
Dai un'occhiatae tifaccio sapereill take a look and let you know
- 1
- 2010-12-16
- Atif Mohammed Ameenuddin
-
@Sahas @ atif089 Sei riuscito afarlofunzionare?@Sahas @atif089 Did you manage to get this to work?
- 0
- 2011-05-12
- INT
-
Invece di cancellare (nel casoin cuitu vogliaeffettivamente leggereil readme!) Puoi usarlonellatuafunzione `chmod ("/path/to/readme.txt ",0640);`Instead of delete (in case you want to actually read the readme!) you can use this in your function `chmod("/path/to/readme.txt", 0640);`
- 0
- 2016-10-10
- Bysander
Solo una domanda veloce chepotrebbe aiutare unpo 'con la sicurezza.Honotato cheilfile readme.html hailnumero di versioneelencato.Riappare dopo ogni aggiornamento,così come licence.txte wp-config-sample.php.
Esiste unmodo sempliceperfarein modo che WordPress rimuova automaticamente questifile dopo un aggiornamento?
Hogiàbloccato la visualizzazione delnumero di versionenei metatag,feed RSS,atom,ecc.
So che questotipo di sicurezzanon èesattamente così molto utile,ma ho solopensato chepotesseessere unpiccoloinizio.Ho sentito che lepersonepossono semplicemente controllare la versione dijQueryinclusain WP-includese fare un riferimentoincrociato a quale versione di WP è statafornita.