217 | | 6. Guardar los cambios en el archivo server.xml y se procede a reinicie Tomcat. Para verificar el funcionamiento del certificado ssl se procede a levantar un navegador de su preferencia y vuelva a levantar el servidor pero agregando el protocolo '''https''' (https://localhost:8443/) (ver figura 7) |
218 | | [[Image(servidor-tomcat-certificado-ssl.png, 800px, align=center, nolink)]] |
219 | | {{{ |
220 | | #!html |
221 | | <h1 style="text-align: center; font-size: 100%">Figura 7. Servidor Tomcat usando el protocolo https </h1> |
222 | | }}} |
| 217 | 6. Guardar los cambios en el archivo server.xml y se procede a reinicie Tomcat. Para verificar el funcionamiento del certificado ssl se procede a levantar un navegador de su preferencia y vuelva a levantar el servidor pero agregando el protocolo '''https''' (https://localhost:8443/). En este manual el certificado es auto-firmado se debe ejecutar los siguientes pasos: |
| 218 | * Aceptar el certificado auto-firmado: |
| 219 | [[Image(aceptar el cerificado autofirmado.png, 800px, align=center, nolink)]] |
| 220 | {{{ |
| 221 | #!html |
| 222 | <h1 style="text-align: center; font-size: 100%">Figura 7. Aceptar el certificado auto-firmado </h1> |
| 223 | }}} |
| 224 | * Añadir agregar excepción de seguridad: |
| 225 | [[Image(agregar excepcion.png, 800px, align=center, nolink)]] |
| 226 | {{{ |
| 227 | #!html |
| 228 | <h1 style="text-align: center; font-size: 100%">Figura 8. Confirmar excepción de seguridad </h1> |
| 229 | }}} |
| 230 | |
| 231 | * Finalmente se puede observar la interfaz de configuración de Tomcat: |
| 232 | [[Image(localhost 8443.png, 800px, align=center, nolink)]] |
| 233 | {{{ |
| 234 | #!html |
| 235 | <h1 style="text-align: center; font-size: 100%">Figura 9. Interfaz de Tomcat con SSL </h1> |
| 236 | }}} |
| 237 | |
| 238 | 7. Para cambiar los puertos de los protocolos HTTP y HTTPS que el servicio Tomcat trae, se debe ejecutar los siguientes pasos: |
| 239 | * Activar la opción de AUTHBIND en el archivo /etc/default/tomcat8 |
| 240 | {{{ |
| 241 | # vim /etc/default/tomcat8 |
| 242 | |
| 243 | AUTHBIND=yes |
| 244 | }}} |
| 245 | * Editar los puertos en el archivo server.xml |
| 246 | {{{ |
| 247 | # vim /etc/tomcat8/server.xml |
| 248 | |
| 249 | <!-- A "Connector" represents an endpoint by which requests are received |
| 250 | and responses are returned. Documentation at : |
| 251 | Java HTTP Connector: /docs/config/http.html |
| 252 | Java AJP Connector: /docs/config/ajp.html |
| 253 | APR (HTTP/AJP) Connector: /docs/apr.html |
| 254 | Define a non-SSL/TLS HTTP/1.1 Connector on port 8080 |
| 255 | --> |
| 256 | <Connector port="80" protocol="HTTP/1.1" |
| 257 | connectionTimeout="20000" |
| 258 | redirectPort="443" /> |
| 259 | . |
| 260 | . |
| 261 | . |
| 262 | |
| 263 | <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 |
| 264 | This connector uses the NIO implementation. The default |
| 265 | SSLImplementation will depend on the presence of the APR/native |
| 266 | library and the useOpenSSL attribute of the |
| 267 | AprLifecycleListener. |
| 268 | Either JSSE or OpenSSL style configuration may be used regardless of |
| 269 | the SSLImplementation selected. JSSE style configuration is used below. |
| 270 | --> |
| 271 | <Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol" |
| 272 | maxThreads="150" SSLEnabled="true" scheme="https" secure="true" |
| 273 | clientAuth="false" sslProtocol="TLS" |
| 274 | keystoreFile="/var/lib/tomcat8/keystore.jks" keystorePass="123456" /> |
| 275 | }}} |
| 276 | |
| 277 | * Reiniciar el servicio |
| 278 | {{{ |
| 279 | systemctl restart tomcat8 |
| 280 | }}} |
| 281 | |
| 282 | * Acceder a https://localhost:443/ o https://localhost/ |