Está en la página 1de 5

Ingresar|Registrarse|EnviarNota

Twitter

Google+ Buscar... Buscar

Descargas

Servicios

Portada

Foros

Manuales

Servicios

Cursos Linux

Marzoyabril,CursoGlobaldeServidoresconCentOS6. DisponibleALDOS1.4.4.Nuestrosistemaoperativoparaescritorio.
Sondeo
SiyaprobasteGNOME3...

Configuracin de Apache con soporte SSL/TLS.


Autor:JoelBarriosDueas Correoelectrnico:darkshramengmailpuntocom SitiodeRed:http://www.alcancelibre.org/ JabberID:darkshram@jabber.org
CreativeCommonsReconocimientoNoComercialCompartirIgual2.1
19992012JoelBarriosDueas.Ustedeslibredecopiar,distribuirycomunicarpblicamentelaobrayhacerobrasderivadasbajolascondicionessiguientes:a) Debereconocerycitaralautororiginal.b)Nopuedeutilizarestaobraparafinescomerciales(incluyendosupublicacin,atravsdecualquier

TegustGNOME3?
Si No
Estesondeotiene5preguntasms.

IniciarSondeo Resultados
Mssondeos|16,620votos|9 comentarios

medio,porentidadesconfinesdelucro). c)Sialteraotransformaestaobraogeneraunaobraderivada,slopuededistribuirlaobrageneradabajouna
licenciaidnticaasta.Alreutilizarodistribuirlaobra,tienequedejarbienclarolostrminosdelalicenciadeestaobra.Algunadeestascondicionespuedeno aplicarsesiseobtieneelpermisodeltitulardelosderechosdeautor.Losderechosderivadosdeusoslegtimosuotraslimitacionesnosevenafectadosporlo anterior.Licenciacompletaencastellano.Lainformacincontenidaenestedocumentoylosderivadosdesteseproporcionantalcualsonylosautoresno asumirnresponsabilidadalgunasielusuarioolector,hacemalusodestos.

Introduccin.
Acerca de HTTPS.
HTTPS eslaversinseguradelprotocoloHTTP ,inventadaen1996porNetscapeCommunicationsCorporation.Esesun

protocolodependientedeHTTP ,consistiendodeunacombinacindesteconunmecanismodetransporteSSLoTLS , garantizandoasunaproteccinrazonabledurantelacomunicacinclienteservidor.Esampliamenteutilizadoenlared mundial(WWWoWorldWideWeb)paracomunicacionescomotransaccionesbancariasypagodebienesyservicios. Elservicioutilizaelpuerto443porTCPpararealizarlascomunicaciones(lacomunicacinnormalparaHTTPutilizael80por TCP).ElesquemaURI (UniformResourceI dentifieroIdentificadorUniformedeRecursos)es,comparandosintaxis,idntico aldeHTTP (http:),utilizndosecomohttps:seguidodelsubconjuntodenominadoURL(UniformResourceLocatoro LocalizadorUniformedeRecursos).Ejemplo:https://www.dominio.tld/ URL:http://es.wikipedia.org/wiki/HTTPSyhttp://wp.netscape.com/eng/ssl3/draft302.txt

Acerca de RSA.
RSA,acrnimodelosapellidosdesusautores,RonRivest,AdiS hamiryLenAdleman,esunalgoritmoparaelciframientode

clavespblicasquefuepublicadoen1977,patentadoenEE.UU.en1983porelelInstitutoTecnolgicodeMichigan(MIT).
RSAesutilizadoampliamenteentodoelmundoparalosprotocolosdestinadosparaelcomercioelectrnico.

URL:http://es.wikipedia.org/wiki/RSA

Acerca de Triple DES.


TripleDES oTDES ,esunalgoritmoquerealizauntriplecifradoDES,desarrolladoporIBMen1978.Suorigentuvocomo

finalidadelagrandarlalongituddeunaclavesinnecesidaddecambiarelalgoritmodeciframiento,locuallohacemsseguro queelalgoritmoDES ,obligandoaunatacanteeltenerquetriplicarelnmerodeoperacionesparapoderhacerdao.Apesar dequeactualmenteestsiendoreemplazadoporelalgoritmoAES (AdvancedE ncryptionS tandard,tambinconocidocomo


Rijndael ),siguesiendoestndarparalastarjetasdecrditoyoperacionesdecomercioelectrnico.

URL:http://es.wikipedia.org/wiki/Triple_DES

Acerca de X.509.
X.509esunestndarITUT(estandarizacindeTelecomunicacionesdelaI nternationalTelecommunicationUnion)para

infraestructuradeclavespblicas(PKI oP ublicKeyI nfrastructure).Entreotrascosas,establecelosestndarespara certificadosdeclavespblicasyunalgoritmoparavalidacinderutadecertificacin.Esteltimoseencargadeverificarque larutadeuncertificadoseavlidabajounainfraestructuradeclavepblicadeterminada.Esdecir,desdeelcertificadoinicial, pasandoporcertificadosintermedios,hastaelcertificadodeconfianzaemitidoporunaAutoridadCertificadora(CAo


CertificationAuthority).

URL:http://es.wikipedia.org/wiki/X.509

Acerca de OpenSSL.
OpenSSLesunaimplementacinlibre,decdigoabierto,delosprotocolosSSL(S ecureS ocketsLayeroNiveldeZcalo

Seguro)yTLS (TransportLayerS ecurityoSeguridadparaNiveldeTransporte).Estbasadosobreelextintoproyecto


SSLeay,iniciadoporEricYoungyTimHudson,hastaquestoscomenzaronatrabajarparaladivisindeseguridaddeEMC

Corporation. URL:http://www.openssl.org/

Acerca de mod_ssl.
Mod_ssl esunmduloparaelservidorHTTPApache,elcualproveesoporteparaSSLversiones2y3yTLSversin1.Es

unacontribucindeRalfS.Engeschall,derivadodeltrabajodeBenLaurie. URL:http://www.apachessl.org/yhttp://httpd.apache.org/docs/2.2/mod/mod_ssl.html

Requisitos.
EsnecesariodisponerdeunadireccinIPpblicaparacadasitioderedvirtualquesequieraconfigurarconsoporte
SSL/TLS .DebidoalanaturalezadelosprotocolosSSLyTLS ,esimposibleutilizarmltiplesanfitrionesvirtualesconsoporte SSL/TLS utilizandounamismadireccinIP.CadacertificadoutilizadorequerirunadireccinIPindependienteenelanfitrin

virtual. Elpaquetemod_ssl instalaelarchivo/etc/httpd/conf.d/ssl.conf,mismoqueesinnecesariomodificarsiseutilizanarchivos deinclusin,conextensin*.conf,dentrodeldirectorio/etc/httpd/conf.d/ .stoserecomiendaafindepreservarla configuracinpredeterminadaypoderdisponerdesta,brindandounpuntoderetornoenelcasodequealgunaconfiguracin dieseproblemas,limitndosesoloamodificarlosparmetrosdelarchivossl.confparaconfigurarlasrutasdelcertificadoy firmadigital.

Equipamiento lgico necesario.


Instalacin a travs de yum.
SiseutilizadeCentOS obienRedHatEnterpriseLinux,ejecutelosiguiente:
y u m y i n s t a l l m o d _ s s l

Procedimientos.
Generando firma digital y certificado.
Accedaalsistemacomoelusuarioroot. Accedaaldirectorio/etc/pki/tls/ .
c d / e t c / p k i / t l s

Encasodequeexistieranpreviamente,debeeliminarlosarchivoscerts/dominio.tld.crt,certs/dominio.tld.crs,
private/dominio.tld.keyyprivate/dominio.tld.pem. r m f c e r t s / d o m i n i o . t l d . c r t p r i v a t e / d o m i n i o . t l d . k e y r m f c e r t s / d o m i n i o . t l d . c s r p r i v a t e / d o m i n i o . t l d . p e m

SedebecrearunaclaveconalgoritmoRSAde2048octetosyestructurax509,lacualsecifrautilizadoTripleDES (Data
E ncryptionS tandard),almacenadoenformatoPEMdemodoqueseainterpretablecomotextoASCII.sesolicitarunaclave

deaccesoparaasignaralafirmadigital,porloqueserecomiendautilizarunamuybuenaclavedeacceso,lacual, mientrasmscomplicadaydifcilsea,mejor.
o p e n s s l g e n r s a d e s 3 o u t p r i v a t e / d o m i n i o . t l d . k e y 2 0 4 8

Siseutilizaestearchivo(dominio.tld.key)paralaconfiguracindelanfitrinvirtual,serequerirdeinteraccindel administradorcadavezquesetengaqueiniciaroreiniciar,elserviciohttpd,ingresandolaclavedeaccesodelafirmadigital. Esteeselprocedimientomsseguro,sinembargo,debidoaqueresultarapocoprcticotenerqueingresarunaclavede accesocadavezqueseinicieelserviciohttpd,resultamsconvenientegenerarunafirmadigitalRSA,lacualpermitainiciar normalmenteysininteraccinalguna,alserviciohttpd.


o p e n s s l r s a i n p r i v a t e / d o m i n i o . t l d . k e y o u t p r i v a t e / d o m i n i o . t l d . p e m

Elarchivodominio.tld.pemserelqueseespecifiquemsadelantecomovalordelparmetroSSLCertificateKeyFileenla configuracindeApache. Acontinuacin,genereelarchivoCSR(CertificateS igningRequest),elcualeselarchivodesolicitudquesehacellegarauna


RA(RegistrationAuthorityoAutoridaddeRegistro),comoVerisign,quienes,traselcorrespondientepago,envandevuelta

uncertificado(paraserutilizadocomoelarchivodominio.tld.crt)firmadopordichaautoridadcertificadora.
o p e n s s l r e q n e w k e y p r i v a t e / d o m i n i o . t l d . k e y o u t c e r t s / d o m i n i o . t l d . c s r

o p e n s s l r e q n e w k e y p r i v a t e / d o m i n i o . t l d . k e y o u t c e r t s / d o m i n i o . t l d . c s r

Loanteriorsolicitarseingresenvariosdatos: Cdigodedosletrasparaelpas. Estadooprovincia. Ciudad. Nombredelaempresaoraznsocial. Unidadoseccin. Nombredelanfitrin.Debeserelnombreconelqueseaccederhaciaelservidorydichonombredeberestarresuelto enunDNS.SIlodesea,puedeutilizartambin*.dominio.tld. Direccindecorreoelectrnicovlidadeladministradordelsistema. Demaneraopcionalsepuedeaadirotraclavedeaccesoynuevamenteelnombredelaempresa.Pocorecomendado, amenosquequieraingresarstacadavezqueseinicieoreinicieelserviciohttpd. Lasalidadevueltaserasimilaralasiguiente:
Y o u a r e a b o u t t o b e a s k e d t o e n t e r i n f o r m a t i o n t h a t w i l l b e i n c o r p o r a t e d i n t o y o u r c e r t i f i c a t e r e q u e s t . W h a t y o u a r e a b o u t t o e n t e r i s w h a t i s c a l l e d a D i s t i n g u i s h e d N a m e o r a D N . T h e r e a r e q u i t e a f e w f i e l d s b u t y o u c a n l e a v e s o m e b l a n k F o r s o m e f i e l d s t h e r e w i l l b e a d e f a u l t v a l u e , I f y o u e n t e r ' . ' , t h e f i e l d w i l l b e l e f t b l a n k . C o u n t r y N a m e ( 2 l e t t e r c o d e ) [ G B ] : M X S t a t e o r P r o v i n c e N a m e ( f u l l n a m e ) [ B e r k s h i r e ] : D i s t r i t o F e d e r a l L o c a l i t y N a m e ( e g , c i t y ) [ N e w b u r y ] : M e x i c o O r g a n i z a t i o n N a m e ( e g , c o m p a n y ) [ M y C o m p a n y L t d ] : E m p r e s a , S . A . d e C . V . O r g a n i z a t i o n a l U n i t N a m e ( e g , s e c t i o n ) [ ] : D i r e c c i o n C o m e r c i a l C o m m o n N a m e ( e g , y o u r n a m e o r y o u r s e r v e r ' s h o s t n a m e ) [ ] : * . d o m i n i o . t l d E m a i l A d d r e s s [ ] : w e b m a s t e r @ d o m i n i o . t l d P l e a s e e n t e r t h e f o l l o w i n g ' e x t r a ' a t t r i b u t e s t o b e s e n t w i t h y o u r c e r t i f i c a t e r e q u e s t A c h a l l e n g e p a s s w o r d [ ] : A n o p t i o n a l c o m p a n y n a m e [ ] :

Sirequiereuncertificadoautofirmado,enlugardeuncertificadofirmadoporunRA,puedegenerarsesteutilizandoel archivodepeticinCSR(dominio.tld.csr).Enelejemploacontinuacin,secreauncertificadoconestructuraX.509enelque seestableceunavalidezpor730das(dosaos).


o p e n s s l x 5 0 9 r e q d a y s 7 3 0 i n c e r t s / d o m i n i o . t l d . c s r s i g n k e y p r i v a t e / d o m i n i o . t l d . k e y o u t c e r t s / d o m i n i o . t l d . c r t

Conlafinalidaddequesloelusuariorootpuedaaccederalosarchivoscreados,sedebencambiarlospermisosdestosa slolecturapararoot.
c h m o d 4 0 0 p r i v a t e / d o m i n i o . t l d . k e y p r i v a t e / d o m i n i o . t l d . p e m c h m o d 4 0 0 c e r t s / d o m i n i o . t l d . c s r c e r t s / d o m i n i o . t l d . c r t

Configuracin simple de Apache para un solo dominio.


Editeelarchivo/etc/httpd/conf.d/ssl.conf:
v i m / e t c / h t t p d / c o n f . d / s s l . c o n f

Localicelosiguiente:

# S e r v e r C e r t i f i c a t e : # P o i n t S S L C e r t i f i c a t e F i l e a t a P E M e n c o d e d c e r t i f i c a t e . I f # t h e c e r t i f i c a t e i s e n c r y p t e d , t h e n y o u w i l l b e p r o m p t e d f o r a # p a s s p h r a s e . N o t e t h a t a k i l l H U P w i l l p r o m p t a g a i n . A n e w # c e r t i f i c a t e c a n b e g e n e r a t e d u s i n g t h e g e n k e y ( 1 ) c o m m a n d . S S L C e r t i f i c a t e F i l e / e t c / p k i / t l s / c e r t s / l o c a l h o s t . c r t # S e r v e r P r i v a t e K e y : # I f t h e k e y i s n o t c o m b i n e d w i t h t h e c e r t i f i c a t e , u s e t h i s # d i r e c t i v e t o p o i n t a t t h e k e y f i l e . K e e p i n m i n d t h a t i f # y o u ' v e b o t h a R S A a n d a D S A p r i v a t e k e y y o u c a n c o n f i g u r e # b o t h i n p a r a l l e l ( t o a l s o a l l o w t h e u s e o f D S A c i p h e r s , e t c . ) S S L C e r t i f i c a t e K e y F i l e / e t c / p k i / t l s / p r i v a t e / l o c a l h o s t . k e y

Cambielocalhost.crtylocalhost.key,pordominio.tld.crtydominio.tld.pem:
# S e r v e r C e r t i f i c a t e : # P o i n t S S L C e r t i f i c a t e F i l e a t a P E M e n c o d e d c e r t i f i c a t e . I f # t h e c e r t i f i c a t e i s e n c r y p t e d , t h e n y o u w i l l b e p r o m p t e d f o r a # p a s s p h r a s e . N o t e t h a t a k i l l H U P w i l l p r o m p t a g a i n . A n e w # c e r t i f i c a t e c a n b e g e n e r a t e d u s i n g t h e g e n k e y ( 1 ) c o m m a n d . S S L C e r t i f i c a t e F i l e / e t c / p k i / t l s / c e r t s / d o m i n i o . t l d . c r t # S e r v e r P r i v a t e K e y : # I f t h e k e y i s n o t c o m b i n e d w i t h t h e c e r t i f i c a t e , u s e t h i s # d i r e c t i v e t o p o i n t a t t h e k e y f i l e . K e e p i n m i n d t h a t i f # y o u ' v e b o t h a R S A a n d a D S A p r i v a t e k e y y o u c a n c o n f i g u r e # b o t h i n p a r a l l e l ( t o a l s o a l l o w t h e u s e o f D S A c i p h e r s , e t c . ) S S L C e r t i f i c a t e K e y F i l e / e t c / p k i / t l s / p r i v a t e / d o m i n i o . t l d . p e m

Afindequesurtanefectoloscambios,esnecesarioreiniciarelserviciohttpd.
s e r v i c e h t t p d r e s t a r t

s e r v i c e h t t p d r e s t a r t

Loanteriordeberdeprocedersinsolicitarlaclavedeaccesodelafirmadigital(laqueasigncuandosecreo
dominio.tld.key).Encasocontrario,significaqueestablecidominio.tld.keycomovalordelparmetro SSLCertificateKeyFileenlaconfiguracindeApache.

Configuracin de Apache para mltiples dominios.


Omitaelprocedimientoanterior. EsimportanteresaltarquecadadominiodebercontarconsupropiadireccinIP,pueselprotocoloHTTPSimpedirutilizar msdeuncertificadopordireccinIP. Elprimerpasoconsisteencrearlaestructuradedirectoriosparaelanfitrinvirtual.
m k d i r p / v a r / w w w / d o m i n i o . t l d / { c g i b i n , h t m l , l o g s , e t c }

Detodosdirectorioscreados,slo/var/www/dominio.tld/html ,/var/www/dominio.tld/etcy/var/www/dominio.tld/cgibin puedenperteneceraunusuariosinprivilegios,quienadministraresteanfitrinvirtual. Crearelarchivo/etc/httpd/conf.d/dominio.conf:


v i m / e t c / h t t p d / c o n f . d / d o m i n i o . c o n f

Adaptarlasiguienteplantillacomocontenidodeestearchivo,dondea.b.c.dcorrespondeaunadireccinIPydominio.tld correspondealnombrededominioaconfigurarparaelanfitrinvirtual:

# # # d o m i n i o . t l d # # # N a m e V i r t u a l H o s t a . b . c . d : 8 0 < V i r t u a l H o s t a . b . c . d : 8 0 > S e r v e r A d m i n w e b m a s t e r @ d o m i n i o . t l d D o c u m e n t R o o t / v a r / w w w / d o m i n i o . t l d / h t m l S e r v e r N a m e w w w . d o m i n i o . t l d S e r v e r A l i a s d o m i n i o . t l d R e d i r e c t 3 0 1 / h t t p s : / / w w w . d o m i n i o . t l d / C u s t o m L o g l o g s / d o m i n i o . t l d a c c e s s _ l o g c o m b i n e d E r r o r l o g l o g s / d o m i n i o . t l d e r r o r _ l o g < / V i r t u a l H o s t > N a m e V i r t u a l H o s t a . b . c . d : 4 4 3 < V i r t u a l H o s t a . b . c . d : 4 4 3 > S e r v e r A d m i n w e b m a s t e r @ d o m i n i o . t l d D o c u m e n t R o o t / v a r / w w w / d o m i n i o . t l d / h t m l S e r v e r N a m e w w w . d o m i n i o . t l d S c r i p t A l i a s / c g i b i n / / v a r / w w w / d o m i n i o . t l d / c g i b i n / < D i r e c t o r y " / v a r / w w w / d o m i n i o . t l d / c g i b i n " > S S L O p t i o n s + S t d E n v V a r s < / D i r e c t o r y > S S L E n g i n e o n S S L P r o t o c o l a l l S S L v 2 S S L C i p h e r S u i t e A L L : ! A D H : ! E X P O R T : ! S S L v 2 : R C 4 + R S A : + H I G H : + M E D I U M : + L O W S S L C e r t i f i c a t e F i l e / e t c / p k i / t l s / c e r t s / d o m i n i o . t l d . c r t S S L C e r t i f i c a t e K e y F i l e / e t c / p k i / t l s / p r i v a t e / d o m i n i o . t l d . p e m S e t E n v I f U s e r A g e n t " . * M S I E . * " \ n o k e e p a l i v e s s l u n c l e a n s h u t d o w n \ d o w n g r a d e 1 . 0 f o r c e r e s p o n s e 1 . 0 C u s t o m L o g l o g s / d o m i n i o . t l d s s l _ r e q u e s t _ l o g \ " % t % h % { S S L _ P R O T O C O L } x % { S S L _ C I P H E R } x \ " % r \ " % b " E r r o r l o g l o g s / d o m i n i o . t l d s s l _ e r r o r _ l o g T r a n s f e r L o g l o g s / d o m i n i o . t l d s s l _ a c c e s s _ l o g L o g L e v e l w a r n < / V i r t u a l H o s t >

Afindequesurtanefectoloscambios,esnecesarioreiniciarelserviciohttpd.
s e r v i c e h t t p d r e s t a r t

Loanteriordeberdeprocedersinsolicitarlaclavedeaccesodelafirmadigital(laqueasigncuandosecreo
dominio.tld.key).Encasocontrario,significaqueestablecidominio.tld.keycomovalordelparmetro SSLCertificateKeyFileenlaconfiguracindeApache.

Comprobacin.
SlobastadirigircualquiernavegadorHTTPhaciahttps://www.dominio.tld/ afindeverificarquetodoesttrabajando correctamente.Trasaceptarelcertificado,enelcasodequestenohayasidofirmadoporunRA,deberpoderseobservar unsignoenlabarradeestadodelnavegador,elcualindicaquesetratadeunaconexinsegura.

Modificaciones necesarias en el muro cortafuegos.


Siseutilizauncortafuegos,esnecesarioabrir,ademsdelpuerto80porTCP(HTTP ),elpuerto443porTCP(HTTPS ). SiutilizaShorewall ,editeelarchivo/etc/shorewall/rules:
v i m / e t c / s h o r e w a l l / r u l e s

Lasreglascorresponderanaalgosimilaralosiguiente:
# A C T I O N S O U R C E D E S T P R O T O D E S T S O U R C E # P O R T P O R T ( S ) 1 A C C E P T a l l f w t c p 8 0 , 4 4 3 # L A S T L I N E A D D Y O U R E N T R I E S B E F O R E T H I S O N E D O N O T R E M O V E

AlterminardeconfigurarlasreglasparaShorewall ,reinicieelmurocortafuegos,ejecutandoelsiguientemandato:
s e r v i c e s h o r e w a l l r e s t a r t

ltimaEdicin08/06/2012,11:23 | 25,819Accesos

ltimaEdicin08/06/2012,11:23 | 25,819Accesos

Noticias Recientes
RedHatpresenteenla3ra.... AndroidMiniPC's Evitaelapocalipsisdelos... MATE.deArgentinaparael... NuevaspolticasenSELInux... InfografaLinux CursoGlobaldeServidores... DisponibleCentOS6.4

Comentarios Recientes
AndroidMiniPC's >[+2] VulnerabilidadenelKern... >[+2] >>[+188]

Enlaces Recientes
*OpenERP *Adempiere Geeklog ComunidaddeSoftwareLibre Dezoft.comSolucionesTI ElRincndeTux BitcoraPersonalde.::K... Gomezbjesus.Desarrollo,...

Derechosdeautor2013AlcanceLibre TodaslasmarcasylogotiposmencionadosenestesitiodeInternetsonpropiedaddesusrespectivosdueos.. 19992011JoelBarriosDueas.Salvoqueseindiquelocontrario,todoelcontenidoestdisponiblebajolostrminosdela licenciaCreativeCommonsReconocimiento2.5. VisitenuestroDirectoriodenoticiasyDelti.com.mx.

También podría gustarte