elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a Git (Primera Parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web (Moderador: #!drvy)
| | |-+  Seguridad y Hardening en Apache
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Seguridad y Hardening en Apache  (Leído 3,116 veces)
el-brujo
ehn
***
Desconectado Desconectado

Mensajes: 21.586


La libertad no se suplica, se conquista


Ver Perfil WWW
Seguridad y Hardening en Apache
« en: 11 Febrero 2015, 13:03 pm »

Fortificando Apache

HTTP Request Methods

Default apache configuration support OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT method in HTTP 1.1 protocol.

Código
  1. <LimitExcept GET POST HEAD>
  2. deny from all
  3. </LimitExcept>
  4.  


Web Application Security

Disable Trace HTTP Request

Código
  1. TraceEnable off
  2.  


Set cookie with HttpOnly and Secure flag

Requiere mod_headers

Código
  1. Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
  2.  


Clickjacking Attack

https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options

<iframe> <object>

Opciones:

X-Frame-Options

DENY, SAMEORIGIN, ALLOW-URL url



Código
  1. Header always append X-Frame-Options SAMEORIGIN
  2.  

Cross Site Scripting (XSS)

Código
  1. Header set X-XSS-Protection "1; mode=block"
  2.  


HTTP Strict Transport Security

https://www.owasp.org/index.php/HTTP_Strict_Transport_Security

Código
  1. Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
  2.  

Todo junto fichero confgiuración httpd.conf

Código
  1.  
  2. CoreDumpDirectory /tmp
  3.  
  4. # bajar timeout, por defecto 300
  5. Timeout 80
  6.  
  7. # Maximum size of the request body.
  8. #LimitRequestBody 10000
  9. # Maximum number of request headers in a request.
  10. LimitRequestFields 40
  11. # Maximum size of request header lines.
  12. LimitRequestFieldSize 4094
  13. # Maximum size of the request line.
  14. #request failed: URI too long (longer than 500)
  15. #LimitRequestLine 500
  16.  
  17. #nuevo antidos
  18. #RLimitCPU 10 20
  19. #RLimitCPU 100 100
  20. #RLimitMEM 10000000 10000000
  21. #RLimitNPROC 25 25
  22.  
  23. # esconder versión Apache, aka  version banner
  24. ServerTokens Prod
  25.  
  26. #seguridad
  27. # http://httpd.apache.org/docs/2.2/mod/core.html#traceenable
  28. TraceEnable off
  29.  
  30. #seguridad
  31.  
  32. <ifModule mod_headers.c>
  33. Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
  34. #https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options
  35. Header always append X-Frame-Options SAMEORIGIN
  36. Header set X-XSS-Protection "1; mode=block"
  37. Header set X-Content-Type-Options: "nosniff"
  38. </ifModule>
  39.  
  40. # https ssl
  41.  
  42. SSLRandomSeed startup file:/dev/urandom 1024
  43.  
  44. <IfDefine SSL>
  45.  
  46. # enable SSLv3 and TLSv1, but not SSLv2
  47. #SSLProtocol all -SSLv2
  48. #SSLProtocol -ALL +SSLv3 +TLSv1
  49. # https://community.qualys.com/blogs/securitylabs/2013/08/05/configuring-apache-nginx-and-openssl-for-forward-#secrecy
  50. # new 2014
  51. # https://www.ssllabs.com/ssltest/analyze.html?d=foro.elhacker.net
  52. # Grade A, antes Grade F
  53. SSLProtocol all -SSLv2 -SSLv3
  54. SSLHonorCipherOrder on
  55. SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 \
  56. EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 \
  57. EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
  58. #SSLCipherSuite ALL:!ADH:!NULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+TLSv1 SLv2:+EXP:+eNULL
  59.  
  60. # mozilla
  61. # https://wiki.mozilla.org/Security/Server_Side_TLS
  62. # SSLCipherSuite AES256+EECDH:AES256+EDH:!aNULL:!eNULL
  63.  
  64. # noviembre 2014
  65. SSLProtocol All -SSLv2 -SSLv3
  66. SSLHonorCipherOrder on
  67. SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+AESGCM EECDH EDH+AESGCM EDH+aRSA HIGH !MEDIUM !LOW !aNULL !eNULL !LOW !RC4 !MD5 !EXP !PSK !SRP !DSS"
  68.  
  69. </IfDefine>
  70.  


« Última modificación: 4 Marzo 2015, 11:28 am por el-brujo » En línea

_Enko


Desconectado Desconectado

Mensajes: 538



Ver Perfil WWW
Re: Seguridad y Hardering en Apache
« Respuesta #1 en: 11 Febrero 2015, 15:18 pm »

Excelentes tips.

Va archivado a mis favoritos por si un dia necesito toquetear apache para algo serio  :D

Saludos y Gracias.


En línea

Gh057


Desconectado Desconectado

Mensajes: 1.190



Ver Perfil
Re: Seguridad y Hardening en Apache
« Respuesta #2 en: 11 Febrero 2015, 18:05 pm »

Muchísimas gracias el-brujo, sobre todo por lo referido al HSTS. Un cordial saludo.
En línea

4 d0nd3 1r4 3l gh057? l4 r3d 3s 74n v4s74 3 1nf1n1t4...
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Actualización de seguridad para Apache Struts
Noticias
wolfbcn 0 1,276 Último mensaje 27 Abril 2014, 01:39 am
por wolfbcn
Sugerencias aprendizaje hardening
Seguridad
SCU 2 2,162 Último mensaje 7 Junio 2014, 18:18 pm
por SCU
seguridad apache
Hacking
user-marcos 1 3,459 Último mensaje 10 Julio 2017, 15:37 pm
por xDie
Material hardening y seguridad
Seguridad
DarkAedi 0 2,029 Último mensaje 25 Marzo 2019, 16:02 pm
por DarkAedi
Linux Hardening - Máxima seguridad en Linux
Tutoriales - Documentación
r32 0 1,996 Último mensaje 29 Noviembre 2020, 02:10 am
por r32
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines