User Tools

Site Tools


doc:appunti:linux:sa:cacti_122

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
doc:appunti:linux:sa:cacti_122 [2019/09/05 12:49] – [Riferimenti Web] niccolodoc:appunti:linux:sa:cacti_122 [2019/09/06 16:06] – [VirtualHost con SSL] niccolo
Line 580: Line 580:
 Per evitare questa situazione si deve sostituire **hostalive** con **hostalive4** nel template //generic-host//. Per evitare questa situazione si deve sostituire **hostalive** con **hostalive4** nel template //generic-host//.
  
 +===== Porta TCP alternativa per servizio standard =====
 +
 +Il servizio predefinito **ssh** viene applicato a tutti gli host che anno **vars.os = Linux** e si basa ovviamente sulla **porta 22 TCP**. Per fare il test su una porta alternativa si deve definire un servizio personalizzato:
 +
 +<file>
 +apply Service "ssh_alt" {
 +  import "generic-service"
 +  check_command = "ssh"
 +  vars.ssh_port = 2222
 +  assign where (host.address || host.address6) && host.vars.os == "LinuxAlt"
 +}
 +</file>
 +
 +===== VirtualHost con SSL =====
 +
 +Per monitorare il funzionamento basico di un server web è sufficiente definire una variabile **vars.http_vhosts** in una sezione **object Host**:
 +
 +<file>
 +object Host "ServerName" {
 +  import "generic-host"
 +  address = "servername.rigacci.org"
 +  vars.http_vhosts["www.rigacci.org"] = { }
 +}
 +</file>
 +
 +Il nome tra parentesi quadre è solo una label utilizzata per identificare il servizio nell'interfaccia web, non viene utilizzata né per ottenere l'indirizzo IP del server (a quello serve la variabile **address**) né tantomeno per identificare un //NamedVirtualHost//.
 +
 +Per un moderno server web tuttavia è necessario verificare la scadenza del certificato SSL ed eventualmente verificare diversi **VirtualHost** che condividono lo stesso indirizzo IP, ma hanno **ServerName** e **certificati SSL** diversi.
 +
 +In teoria non sarebbe possibile **verificare il certificato SSL di un VirtualHost basato su nome**, perché nella fase iniziale della negoziazione SSL il nome dell'host richiesto non è ancora noto e quindi il server non può sapere quale certificato presentare al client. Tuttavia l'estensione SNI è stata sviluppata apposta per ovviare a questo problema. Vedere in proposito **[[https://cwiki.apache.org/confluence/display/httpd/NameBasedSSLVHostsWithSNI|Name Based SSL VHosts With SNI]]**.
 +
 +Ammettendo che il server web sia configurato opportunamente, ecco un modo per verificare due diversi VirtualHost ospitati sullo stesso server:
 +
 +<file>
 +object Host "ServerName" {
 +  import "generic-host"
 +  address = "servername.rigacci.org"
 +  vars.http_vhosts["www.first_domain.tld"] = {
 +    http_address = "$address$"
 +    http_vhost = "www.first_domain.tld"
 +    http_ssl = true
 +    http_sni = true
 +    http_certificate = "24,14"
 +  }
 +  vars.http_vhosts["www.second_domain.tld"] = {
 +    http_address = "$address$"
 +    http_vhost = "www.second_domain.tld"
 +    http_ssl = true
 +    http_sni = true
 +    http_certificate = "24,14"
 +  }
 +}
 +</file>
 +
 +Each **vars.http_vhosts** section correspond to one command invokation, of this type:
 +
 +<code>
 +check_http -H "www.first_domain.tld" -I "servername.rigacci.org" -S --sni -C "24,14"
 +</code>
  
 ===== Riferimenti Web ===== ===== Riferimenti Web =====
doc/appunti/linux/sa/cacti_122.txt · Last modified: 2022/10/10 16:27 by niccolo