zz_deprecated:securing_phpmyadmin
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revisionLast revision | |||
— | zz_deprecated:securing_phpmyadmin [2018/05/17 07:12] – ↷ Page moved from deprecated:securing_phpmyadmin to zz_deprecated:securing_phpmyadmin dodger | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== [HOWTO] phpmyadmin security ====== | ||
+ | |||
+ | <WRAP center round alert 60%> | ||
+ | La única manera de securizar el phpmyadmin es NOUSARLO | ||
+ | |||
+ | </ | ||
+ | |||
+ | ====== Descripcion ====== | ||
+ | De todos es sabido que phpmyadmin no es precisamente seguro... para ello he decidido crear este minidoc de como intentar " | ||
+ | |||
+ | ====== Instalación ====== | ||
+ | Simplemente hace falta descargar la ultima version y descomprimir: | ||
+ | http:// | ||
+ | |||
+ | o por svn | ||
+ | |||
+ | < | ||
+ | |||
+ | |||
+ | ====== Configuracion ====== | ||
+ | |||
+ | ===== Configuracion en el apache ===== | ||
+ | |||
+ | Según mi punto de vista, lo más seguro será que se use únicamente HTTPS para el acceso al programa. | ||
+ | |||
+ | Para ello, podemos generar un certificado ssl propio con openssl en el server, aquí pongo un ejemplo de como hacerlo; | ||
+ | |||
+ | < | ||
+ | mkdir CA | ||
+ | cd CA | ||
+ | openssl genrsa -des3 -out ca.key 2048 | ||
+ | openssl req -new -x509 -days 3650 -key ca.key -out ca.crt | ||
+ | openssl genrsa -out `hostname`.key 2048 | ||
+ | openssl req -new -key `hostname`.key -out `hostname`.csr | ||
+ | openssl ca -keyfile ca.key -cert ca.crt -out `hostname`.crt -infiles `hostname`.csr | ||
+ | openssl x509 -req -in `hostname`.csr -out `hostname`.crt -sha1 -CA ca.crt -CAkey ca.key -CAcreateserial -days 3650 | ||
+ | mv `hostname`.crt ../ssl.crt/ | ||
+ | mv `hostname`.csr ../ssl.csr/ | ||
+ | mv `hostname`.key ../ssl.key/ | ||
+ | </ | ||
+ | |||
+ | Ya digo que es un **EJEMPLO**. | ||
+ | |||
+ | Con esto se genera un certificado de CA propio en el servidor (logicamente, | ||
+ | |||
+ | |||
+ | Ahora hace falta configurar un vhost para usarlo, como ultimamente se suele hacer, podemos usar el vhost por defecto: | ||
+ | < | ||
+ | |||
+ | Pongo también un ejemplo de configuración: | ||
+ | < | ||
+ | < | ||
+ | ServerAdmin webmaster@servername | ||
+ | DocumentRoot / | ||
+ | ServerName servername | ||
+ | ServerAlias www.servername | ||
+ | < | ||
+ | Order deny,allow | ||
+ | Deny from all | ||
+ | </ | ||
+ | RewriteEngine On | ||
+ | RewriteRule ^phpMyAdmin | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ServerAdmin webmaster@servername | ||
+ | DocumentRoot / | ||
+ | ServerName servername | ||
+ | ServerAlias www.servername | ||
+ | |||
+ | ErrorLog " | ||
+ | CustomLog " | ||
+ | |||
+ | SSLEngine On | ||
+ | SSLCipherSuite HIGH:MEDIUM | ||
+ | SSLProtocol all | ||
+ | SSLCertificateFile | ||
+ | SSLCertificateKeyFile | ||
+ | SSLCACertificateFile | ||
+ | |||
+ | Alias /phpMyAdmin / | ||
+ | |||
+ | < | ||
+ | Order deny,allow | ||
+ | Deny from all | ||
+ | # IPs del cliente | ||
+ | Allow From ip1 | ||
+ | Allow From ip2 | ||
+ | Allow From ipN | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Order deny,allow | ||
+ | Deny from all | ||
+ | #localhost files | ||
+ | Allow from localhost 127.0.0.1 ip_server_01 ip_server_02 ip_server_0N | ||
+ | </ | ||
+ | |||
+ | RewriteEngine On | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Lo más destacable es prohibir el acceso sin https en el vhost *:80 y el *Location* con las ip's permitidas del cliente (y las nuestras para probar). | ||
+ | También se recomienda denegar el acceso a la localización: | ||
+ | < | ||
+ | Que contiene rutinas peligrosas | ||
+ | |||
+ | |||
+ | ===== Configuracion en el phpMyAdmin ===== | ||
+ | |||
+ | La configuración del phpmyadmin se puede hacer via web o directamente en el fichero de configuración del mismo, yo pongo directamente la del fichero. | ||
+ | |||
+ | < | ||
+ | vi config.inc.php </ | ||
+ | |||
+ | |||
+ | < | ||
+ | $cfg[[' | ||
+ | /* YOU MUST FILL IN THIS FOR SECURINGAUTH! */ | ||
+ | |||
+ | $i = 0; | ||
+ | $i++; | ||
+ | /* Authentication type */ | ||
+ | $cfg[[' | ||
+ | /* Server parameters */ | ||
+ | $cfg[[' | ||
+ | $cfg[[' | ||
+ | $cfg[[' | ||
+ | $cfg[[' | ||
+ | $cfg[[' | ||
+ | /* User for advanced features */ | ||
+ | // $cfg[[' | ||
+ | // $cfg[[' | ||
+ | /* Advanced phpMyAdmin features */ | ||
+ | // $cfg[[' | ||
+ | // $cfg[[' | ||
+ | // $cfg[[' | ||
+ | // $cfg[[' | ||
+ | // $cfg[[' | ||
+ | // $cfg[[' | ||
+ | // $cfg[[' | ||
+ | // $cfg[[' | ||
+ | // $cfg[[' | ||
+ | |||
+ | // dodger SPECIAL CONFIG | ||
+ | $cfg[[' | ||
+ | $cfg[[' | ||
+ | $cfg[[' | ||
+ | |||
+ | |||
+ | /* | ||
+ | * Directories for saving/ | ||
+ | */ | ||
+ | $cfg[[' | ||
+ | $cfg[[' | ||
+ | |||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | A destacar de este fichero: | ||
+ | ^ Parametro ^ valores ^ Descripcion | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | | < | ||
+ | |||
+ | Para más información acerca de la configuración de phpMyAdmin, está la [[http:// |
zz_deprecated/securing_phpmyadmin.txt · Last modified: 2022/02/11 11:36 by 127.0.0.1