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 [2013/08/26 18:37] – [Configurazione lecacy] 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 289: | Line 365: | ||
viene ripetuta finché il remoto non si accorge. | viene ripetuta finché il remoto non si accorge. | ||
- | ==== Client con IP dinamico, network remota, PSK ==== | + | ==== Client con IP dinamico |
- | Usando un IP dinamico e la PSK è obbligatorio usare l' | + | Usando un IP dinamico e la PSK è obbligatorio usare l' |
- | L' | + | Il file di configurazione **''/ |
< | < | ||
- | # Generated on Wed Jun 18 09:50:31 2008 by racoon-tool | ||
- | # | ||
- | |||
# | # | ||
# Global items | # Global items | ||
Line 348: | Line 421: | ||
* Local ID: vigor.domain.net | * Local ID: vigor.domain.net | ||
- | ==== Client | + | :!: **ATTENZIONE**: |
- | ==== Client con IP statico, network remota, chiavi RSA ==== | ||
- | ==== Client Router DrayTek Vigor 2500/2600 ==== | ||
- | Risulta un **[[ipsec_draytek|problema]]** con i router DrayTek. | ||
- | Utilizzando '' | + | ==== Client con IP statico e LAN associata, PSK (es. router DrayTek Vigor 2500/2600) ==== |
- | Il file di configurazione | + | :!: **ATTENZIONE**: |
+ | |||
+ | Il file di configurazione è: | ||
< | < | ||
- | # | ||
- | # Racoon configuration for firewall | ||
- | |||
- | # Generated on Thu Oct 6 16:21:57 2005 by racoon-tool | ||
- | # | ||
- | |||
# | # | ||
# Global items | # Global items | ||
Line 378: | Line 444: | ||
} | } | ||
- | # | ||
- | # Connection mariabarbara | ||
- | # | ||
remote 217.19.150.165 { | remote 217.19.150.165 { | ||
proposal { | proposal { | ||
Line 405: | Line 468: | ||
</ | </ | ||
+ | Le SPD (Security Policy Database) devono essere generate da opportune righe di configurazione in un file salvato in **''/ | ||
==== Initiator per server passivo ==== | ==== Initiator per server passivo ==== | ||
Line 454: | 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 ===== | ||
Line 487: | Line 596: | ||
</ | </ | ||
- | Infine nel file **''/ | + | Se l' |
+ | |||
+ | < | ||
+ | ipsec net 0.0.0.0/ | ||
+ | </ | ||
+ | |||
+ | Infine nel file **''/ | ||
< | < |
doc/appunti/linux/sa/ipsec.1377535032.txt.gz · Last modified: 2013/08/26 18:37 by niccolo