doc:appunti:linux:sa:ipsec
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:sa:ipsec [2015/09/21 18:36] – [Client con IP statico e LAN associata, PSK (es. router DrayTek Vigor 2500/2600)] niccolo | doc:appunti:linux:sa:ipsec [2018/01/08 12:24] (current) – [Configurazione Debian 8 Jessie] niccolo | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== IPSEC con Debian GNU/Linux ====== | ====== IPSEC con Debian GNU/Linux ====== | ||
| + | ===== Configurazione Debian 8 Jessie ===== | ||
| + | |||
| + | IPSEC - su una distribuzione Debian moderna - si basa sui servizi **Setkey** e **Racoon**, questi servizi si avviano con **systemd**. | ||
| + | |||
| + | Configuriamo ad esempio | ||
| + | |||
| + | (LAN 192.168.10.0/ | ||
| + | |||
| + | In generale i file di configurazione sono questi (si esamina il firewall 5.10.168.170): | ||
| + | |||
| + | **/ | ||
| + | |||
| + | < | ||
| + | spdadd 192.168.10.0/ | ||
| + | spdadd 192.168.20.0/ | ||
| + | </ | ||
| + | |||
| + | **/ | ||
| + | |||
| + | < | ||
| + | include "/ | ||
| + | </ | ||
| + | |||
| + | **/ | ||
| + | |||
| + | < | ||
| + | remote 5.20.195.220 { | ||
| + | exchange_mode main; | ||
| + | proposal { | ||
| + | encryption_algorithm 3des; | ||
| + | hash_algorithm md5; | ||
| + | authentication_method pre_shared_key; | ||
| + | dh_group modp1024; | ||
| + | } | ||
| + | # Verifica l' | ||
| + | peers_identifier address " | ||
| + | verify_identifier on; | ||
| + | initial_contact on; | ||
| + | lifetime time 86400 seconds; | ||
| + | # | ||
| + | # | ||
| + | } | ||
| + | |||
| + | sainfo address 192.168.10.0/ | ||
| + | encryption_algorithm 3des; | ||
| + | authentication_algorithm hmac_md5, | ||
| + | compression_algorithm deflate; | ||
| + | lifetime time 43200 seconds; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | **NOTA**: Se non si usa l' | ||
| + | |||
| + | **/ | ||
| + | |||
| + | < | ||
| + | 5.20.195.220 | ||
| + | </ | ||
| + | |||
| + | Per fermare e riavviare il servizio: | ||
| + | |||
| + | < | ||
| + | systemctl stop racoon | ||
| + | systemctl stop setkey | ||
| + | |||
| + | systemctl start setkey | ||
| + | systemctl start racoon | ||
| + | </ | ||
| + | |||
| + | Il traffico IPSEC va ovviamente gestito in maniera opportuna poiché non corrisponde al criterio standard MASQUERADE di iptables. Ad esempio [[# | ||
| + | |||
| + | In generale si potrà testare la VPN con un ping, a patto di usare gli indirizzi IP sul lato LAN: | ||
| + | |||
| + | < | ||
| + | ping -I 192.168.10.254 192.168.20.1 | ||
| + | </ | ||
| ===== Pezzi di IPSEC per Linux ===== | ===== Pezzi di IPSEC per Linux ===== | ||
| Line 442: | Line 518: | ||
| </ | </ | ||
| + | ==== Initiator dietro NAT verso server passivo ==== | ||
| + | |||
| + | Se il cliente/ | ||
| + | |||
| + | L' | ||
| + | |||
| + | < | ||
| + | listen { | ||
| + | isakmp 10.0.1.2; | ||
| + | isakmp_natt 10.0.1.2 [4500]; | ||
| + | strict_address; | ||
| + | } | ||
| + | |||
| + | remote 82.63.172.2 { | ||
| + | nat_traversal on; | ||
| + | exchange_mode aggressive; | ||
| + | my_identifier fqdn " | ||
| + | # Verifica l' | ||
| + | peers_identifier address " | ||
| + | lifetime time 21600 sec; | ||
| + | proposal_check strict; | ||
| + | proposal { | ||
| + | encryption_algorithm 3des; | ||
| + | hash_algorithm md5; | ||
| + | authentication_method pre_shared_key; | ||
| + | # For aggressive mode, it must be the same on both ends. | ||
| + | dh_group modp1024; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | sainfo address 10.0.1.0/24 any address 192.168.100.0/ | ||
| + | pfs_group modp1024; | ||
| + | lifetime time 12 hour; | ||
| + | encryption_algorithm 3des, blowfish, des, rijndael; | ||
| + | authentication_algorithm hmac_sha1, hmac_md5; | ||
| + | compression_algorithm deflate; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Nel file **''/ | ||
| + | |||
| + | < | ||
| + | spdadd 10.0.1.0/ | ||
| + | spdadd 192.168.100.0/ | ||
| + | </ | ||
| ===== Configurazione firewall Shorewall ===== | ===== Configurazione firewall Shorewall ===== | ||
doc/appunti/linux/sa/ipsec.1442853409.txt.gz · Last modified: by niccolo
