Pular para o conteúdo

VPN com FreeS/WAN

O FreeS/WAN é uma das várias implementações do IPSec (Internet Protocol Security) e IKE (Internet Key Exchange) para GNU/Linux. Com ele você pode fazer uma VPN entre redes fisicamente distantes usando uma rede insegura como a internet.
Pedro Pereira pogo
Hits: 89.269 Categoria: Linux Subcategoria: Segurança
  • Indicar
  • Impressora
  • Denunciar
O Viva o Linux depende da receita de anúncios para se manter. Ative os cookies aqui para nos patrocinar.
Não conseguimos carregar os anúncios. Se usa bloqueador, considere liberar o Viva o Linux para nos patrocinar.

Introdução

O FreeS/WAN é uma das várias implementações do IPSec (Internet Protocol Security) e IKE (Internet Key Exchange) para GNU/Linux.

Utilizando estes dois serviços, você pode fazer um túnel seguro entre duas redes distantes com seus dados passando por redes inseguras (como a Internet). O IPSec consegue fazer com que os dados trafeguem de modo seguro através de uma rede insegura, pois tudo o que passará por este túnel é criptografado pelo gateway com IPSec instalado e só é descriptografado na outra ponta. No gateway que conhece a chave para realizar a descriptografia. Assim, você consegue estabelecer uma VPN (Virtual Private Network) entre vários locais diferentes, utilizando a Internet, de forma bastante segura.

Para descrever como estabelecer um túnel VPN criptografado, neste documento vou me basear na versão 2.06 do FreeS/WAN.

O Viva o Linux depende da receita de anúncios para se manter. Ative os cookies aqui para nos patrocinar.
Não conseguimos carregar os anúncios. Se usa bloqueador, considere liberar o Viva o Linux para nos patrocinar.
O Viva o Linux depende da receita de anúncios para se manter. Ative os cookies aqui para nos patrocinar.
Não conseguimos carregar os anúncios. Se usa bloqueador, considere liberar o Viva o Linux para nos patrocinar.
   1. Introdução
   2. Instalação
   3. Gerando as chaves RSA - utilizando o arquivo ipsec.secrets
   4. Configurando o serviço IPSec - utilizando o arquivo ipsec.conf
   5. Testando os túneis
   6. Troubleshooting - corrigindo os inevitáveis erros
   7. Fontes e conclusão

OpenVPN se comportando como PPTP

Instalando o Ocomon 1.40 no FreeBSD 6.0

Aplicando patches no kernel

Auditando senhas com John The Ripper

Automatizando as atualizações no Linux

Ajustes finos no Bind (servidor DNS)

Descobrindo chave WPA2 com Aircrack-ng

Linux - Permissões de acesso especiais

Sudo 1.8.12 - Parte II - Como sudo funciona

#1 Comentário enviado por y2h4ck em 10/05/2005 - 09:55h
Ola tudo bem ?
Bom so pra fechar queria dar uma dica, ao inves de fazer com FreeSWAN, utilizem o OpenSWAN pois ele e a continuacao do projeto FreeSWAN que se acabou fazem 2 anos +/-.

ABracos
#2 Comentário enviado por peregrino em 10/05/2005 - 10:39h
opa blz

fala spaw tudo bem e concerteza openswan é bem melhor por ter suporte mas ta otimo esse tutorial

cara gostaria de saber como eu gero chaves dinamicas com essa vpn ou em openswan

obrigado
#3 Comentário enviado por Bique em 10/05/2005 - 12:29h
Simplismente Beleza...Keep Going na minha lingua de Mocambique KANIMAMBO.
#4 Comentário enviado por crayon em 10/05/2005 - 23:15h
O artigo está muito bom, mas a dica do peregrino deve ser seguida, uma vez que o FreeS/WAN acabou, infelizmente.
O Openswan está bem documentado e não tive problemas em sua utilização.

Atc,
Kassiano
#5 Comentário enviado por ferjun01 em 30/08/2008 - 11:13h
Salve galera, peço ajuda para resolver este problema..

Estou com problemas para fechar uma vpn com Freeswan no Slackware, esta configuração já existia e alterei apenas os ip's, a chave PSK e inclui o 3-DES, quando subo a vpn aparentemente está fechada, mas quando mando um telnet para o destino ele vai por fora da vpn, abaixo vou colocar os arquivos de configuraçâo, se possível peço sua ajuda neste caso, muito obrigado :

IPSEC.CONF

# /etc/ipsec.conf - FreeS/WAN IPsec configuration file
# RCSID $Id: ipsec.conf.in,v 1.11 2003/06/13 23:28:41 sam Exp $

# This file: /usr/local/share/doc/freeswan/ipsec.conf-sample
#
# Manual: ipsec.conf.5
#
# Help:
# http://www.strongsec.com/freeswan/install.htm

version 2.0 # conforms to second version of ipsec.conf specification

# basic configuration
config setup
interfaces="ipsec0=eth0"
klipsdebug=none
plutodebug=none
# plutoload=%search
# plutostart=%search
# plutowait=no

# Debug-logging controls: "none" for (almost) none, "all" for lots.
# klipsdebug=all
# plutodebug=all
# crlcheckinterval=600
# strictcrlpolicy=yes

conn %default
auto=add
type=tunnel
left=
right=
authby=secret
keyexchange=ike
esp=3des-md5-96i
keylife=24h

# OE policy groups are disabled by default
conn block
auto=ignore

conn clear
auto=ignore

conn private
auto=ignore

conn private-or-clear
auto=ignore

conn clear-or-private
auto=ignore

conn packetdefault
auto=ignore

# Add connections here.

# sample VPN connection
#sample# conn sample
#sample# # Left security gateway, subnet behind it, next hop toward right.
#sample# left=%defaultroute
#sample# leftcert=myCert.pem
#sample# leftsubnet=172.16.0.0/24
#sample# # Right security gateway, subnet behind it, next hop toward left.
#sample# right=10.12.12.1
#sample# rightid="<Distinguished name of right security gateway>"
#sample# rightsubnet=192.168.0.0/24
#sample# # To authorize this connection, but not actually start it, at startup,
#sample# # uncomment this.
#sample# #auto=start
conn vpn
auto=add
type=tunnel
left=200.X.X.11
leftsubnet=200.X.X.51/32
leftnexthop=
right=201.X.X.2
rightsubnet=192.168.1.0/24
rightnexthop=201.X.X.1
authby=secret
esp=3des-md5-96i
keylife=24h
pfs=yes
rekeymargin=9m
rekeyfuzz=25%

No ipsec.secret, tem apenas uma linha contendo a chave, substitui uma pela outra :

ipsec.secret

:PSK "CHAVE"


Dando um ipsec auto --status :
ipsec auto --status
000 interface ipsec0/eth0 201.X.X.2
000 %myid = (none)
000 debug none
000
000 "vpn": 192.168.1.0/24===201.X.X.2---201.X.X.1...200.X.X.11===200.X.X.51/32; erouted; eroute owner: #4
000 "vpn": ike_life: 3600s; ipsec_life: 86400s; rekey_margin: 540s; rekey_fuzz: 25%; keyingtries: 0
000 "vpn": policy: PSK+ENCRYPT+TUNNEL+PFS+UP; prio: 32,24; interface: eth0;
000 "vpn": newest ISAKMP SA: #3; newest IPsec SA: #4;
000
000 #4: "vpn" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 85714s; newest IPSEC; eroute owner
000 #4: "vpn" esp.243f75c5@200.X.X.11 esp.bbaf1782@201.X.X.2 tun.1004@200.X.X.11 tun.1003@201.X.X.2
000 #3: "vpn" STATE_MAIN_I4 (ISAKMP SA established); EVENT_SA_REPLACE in 3042s; newest ISAKMP
000


No var/log/secure apresenta um erro na 1ª linha do ipsec.secrets :
/var/log/secure
6378 Aug 28 22:27:13 servervpn pluto[15662]: Starting Pluto (FreeS/WAN Version 2.05 X.509-1.5.3 PLUTO_ USES_KEYRR)
6379 Aug 28 22:27:13 servervpn pluto[15662]: Using KLIPS IPsec interface code
6383 Aug 28 22:27:13 servervpn pluto[15662]: Changing to directory '/etc/ipsec.d/crls'
6384 Aug 28 22:27:13 servervpn pluto[15662]: added connection description "vpn"
6385 Aug 28 22:27:13 servervpn pluto[15662]: listening for IKE messages
6386 Aug 28 22:27:13 servervpn pluto[15662]: adding interface ipsec0/eth0 201.X.X.2
6387 Aug 28 22:27:13 servervpn pluto[15662]: loading secrets from "/etc/ipsec.secrets"
6388 Aug 28 22:27:13 servervpn pluto[15662]: ERROR "/etc/ipsec.secrets" line 1: index ":PSK" illegal l eading `:' in IPv6 numeric address
6389 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: initiating Main Mode
6390 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: received Vendor ID Payload; ASCII hash: tmSalve galera, peço ajuda para resolver este problema..

Estou com problemas para fechar uma vpn com Freeswan no Slackware, esta configuração já existia e alterei apenas os ip's, a chave PSK e inclui o 3-DES, quando subo a vpn aparentemente está fechada, mas quando mando um telnet para o destino ele vai por fora da vpn, abaixo vou colocar os arquivos de configuraçâo, se possível peço sua ajuda neste caso, muito obrigado :

IPSEC.CONF

# /etc/ipsec.conf - FreeS/WAN IPsec configuration file
# RCSID $Id: ipsec.conf.in,v 1.11 2003/06/13 23:28:41 sam Exp $

# This file: /usr/local/share/doc/freeswan/ipsec.conf-sample
#
# Manual: ipsec.conf.5
#
# Help:
# http://www.strongsec.com/freeswan/install.htm

version 2.0 # conforms to second version of ipsec.conf specification

# basic configuration
config setup
interfaces="ipsec0=eth0"
klipsdebug=none
plutodebug=none
# plutoload=%search
# plutostart=%search
# plutowait=no

# Debug-logging controls: "none" for (almost) none, "all" for lots.
# klipsdebug=all
# plutodebug=all
# crlcheckinterval=600
# strictcrlpolicy=yes

conn %default
auto=add
type=tunnel
left=
right=
authby=secret
keyexchange=ike
esp=3des-md5-96i
keylife=24h

# OE policy groups are disabled by default
conn block
auto=ignore

conn clear
auto=ignore

conn private
auto=ignore

conn private-or-clear
auto=ignore

conn clear-or-private
auto=ignore

conn packetdefault
auto=ignore

# Add connections here.

# sample VPN connection
#sample# conn sample
#sample# # Left security gateway, subnet behind it, next hop toward right.
#sample# left=%defaultroute
#sample# leftcert=myCert.pem
#sample# leftsubnet=172.16.0.0/24
#sample# # Right security gateway, subnet behind it, next hop toward left.
#sample# right=10.12.12.1
#sample# rightid="<Distinguished name of right security gateway>"
#sample# rightsubnet=192.168.0.0/24
#sample# # To authorize this connection, but not actually start it, at startup,
#sample# # uncomment this.
#sample# #auto=start
conn vpn
auto=add
type=tunnel
left=200.X.X.11
leftsubnet=200.X.X.51/32
leftnexthop=
right=201.X.X.2
rightsubnet=192.168.1.0/24
rightnexthop=201.X.X.1
authby=secret
esp=3des-md5-96i
keylife=24h
pfs=yes
rekeymargin=9m
rekeyfuzz=25%

No ipsec.secret, tem apenas uma linha contendo a chave, substitui uma pela outra :

ipsec.secret

:PSK "CHAVE"


Dando um ipsec auto --status :
ipsec auto --status
000 interface ipsec0/eth0 201.X.X.2
000 %myid = (none)
000 debug none
000
000 "vpn": 192.168.1.0/24===201.X.X.2---201.X.X.1...200.X.X.11===200.X.X.51/32; erouted; eroute owner: #4
000 "vpn": ike_life: 3600s; ipsec_life: 86400s; rekey_margin: 540s; rekey_fuzz: 25%; keyingtries: 0
000 "vpn": policy: PSK+ENCRYPT+TUNNEL+PFS+UP; prio: 32,24; interface: eth0;
000 "vpn": newest ISAKMP SA: #3; newest IPsec SA: #4;
000
000 #4: "vpn" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 85714s; newest IPSEC; eroute owner
000 #4: "vpn" esp.243f75c5@200.X.X.11 esp.bbaf1782@201.X.X.2 tun.1004@200.X.X.11 tun.1003@201.X.X.2
000 #3: "vpn" STATE_MAIN_I4 (ISAKMP SA established); EVENT_SA_REPLACE in 3042s; newest ISAKMP
000


No var/log/secure apresenta um erro na 1ª linha do ipsec.secrets :
/var/log/secure
6378 Aug 28 22:27:13 servervpn pluto[15662]: Starting Pluto (FreeS/WAN Version 2.05 X.509-1.5.3 PLUTO_ USES_KEYRR)
6379 Aug 28 22:27:13 servervpn pluto[15662]: Using KLIPS IPsec interface code
6383 Aug 28 22:27:13 servervpn pluto[15662]: Changing to directory '/etc/ipsec.d/crls'
6384 Aug 28 22:27:13 servervpn pluto[15662]: added connection description "vpn"
6385 Aug 28 22:27:13 servervpn pluto[15662]: listening for IKE messages
6386 Aug 28 22:27:13 servervpn pluto[15662]: adding interface ipsec0/eth0 201.X.X.2
6387 Aug 28 22:27:13 servervpn pluto[15662]: loading secrets from "/etc/ipsec.secrets"
6388 Aug 28 22:27:13 servervpn pluto[15662]: ERROR "/etc/ipsec.secrets" line 1: index ":PSK" illegal l eading `:' in IPv6 numeric address
6389 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: initiating Main Mode
6390 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: received Vendor ID Payload; ASCII hash: tm{COMENTARIO}31` A{COMENTARIO}24kQo*,{COMENTARIO}16c}/({COMENTARIO}0748{COMENTARIO}37
6391 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: Peer ID is ID_IPV4_ADDR: '200.X.X.11'
6392 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: ISAKMP SA established
6393 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: initiating Quick Mode PSK+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1}
6394 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: ignoring informational payload, type IPSEC_RESP ONDER_LIFETIME
6395 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: sent QI2, IPsec SA established {ESP=>0xd6e0a488 <0x92ec5888}
6396 Aug 28 22:28:11 servervpn pluto[15662]: shutting down
6397 Aug 28 22:28:11 servervpn pluto[15662]: forgetting secrets
6398 Aug 28 22:28:11 servervpn pluto[15662]: "vpn": deleting connection
6399 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #2: deleting state (STATE_QUICK_I2)
6400 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #1: deleting state (STATE_MAIN_I4)
6401 Aug 28 22:28:11 servervpn pluto[15662]: shutting down interface ipsec0/eth0 201.X.X.231` ASalve galera, peço ajuda para resolver este problema..

Estou com problemas para fechar uma vpn com Freeswan no Slackware, esta configuração já existia e alterei apenas os ip's, a chave PSK e inclui o 3-DES, quando subo a vpn aparentemente está fechada, mas quando mando um telnet para o destino ele vai por fora da vpn, abaixo vou colocar os arquivos de configuraçâo, se possível peço sua ajuda neste caso, muito obrigado :

IPSEC.CONF

# /etc/ipsec.conf - FreeS/WAN IPsec configuration file
# RCSID $Id: ipsec.conf.in,v 1.11 2003/06/13 23:28:41 sam Exp $

# This file: /usr/local/share/doc/freeswan/ipsec.conf-sample
#
# Manual: ipsec.conf.5
#
# Help:
# http://www.strongsec.com/freeswan/install.htm

version 2.0 # conforms to second version of ipsec.conf specification

# basic configuration
config setup
interfaces="ipsec0=eth0"
klipsdebug=none
plutodebug=none
# plutoload=%search
# plutostart=%search
# plutowait=no

# Debug-logging controls: "none" for (almost) none, "all" for lots.
# klipsdebug=all
# plutodebug=all
# crlcheckinterval=600
# strictcrlpolicy=yes

conn %default
auto=add
type=tunnel
left=
right=
authby=secret
keyexchange=ike
esp=3des-md5-96i
keylife=24h

# OE policy groups are disabled by default
conn block
auto=ignore

conn clear
auto=ignore

conn private
auto=ignore

conn private-or-clear
auto=ignore

conn clear-or-private
auto=ignore

conn packetdefault
auto=ignore

# Add connections here.

# sample VPN connection
#sample# conn sample
#sample# # Left security gateway, subnet behind it, next hop toward right.
#sample# left=%defaultroute
#sample# leftcert=myCert.pem
#sample# leftsubnet=172.16.0.0/24
#sample# # Right security gateway, subnet behind it, next hop toward left.
#sample# right=10.12.12.1
#sample# rightid="<Distinguished name of right security gateway>"
#sample# rightsubnet=192.168.0.0/24
#sample# # To authorize this connection, but not actually start it, at startup,
#sample# # uncomment this.
#sample# #auto=start
conn vpn
auto=add
type=tunnel
left=200.X.X.11
leftsubnet=200.X.X.51/32
leftnexthop=
right=201.X.X.2
rightsubnet=192.168.1.0/24
rightnexthop=201.X.X.1
authby=secret
esp=3des-md5-96i
keylife=24h
pfs=yes
rekeymargin=9m
rekeyfuzz=25%

No ipsec.secret, tem apenas uma linha contendo a chave, substitui uma pela outra :

ipsec.secret

:PSK "CHAVE"


Dando um ipsec auto --status :
ipsec auto --status
000 interface ipsec0/eth0 201.X.X.2
000 %myid = (none)
000 debug none
000
000 "vpn": 192.168.1.0/24===201.X.X.2---201.X.X.1...200.X.X.11===200.X.X.51/32; erouted; eroute owner: #4
000 "vpn": ike_life: 3600s; ipsec_life: 86400s; rekey_margin: 540s; rekey_fuzz: 25%; keyingtries: 0
000 "vpn": policy: PSK+ENCRYPT+TUNNEL+PFS+UP; prio: 32,24; interface: eth0;
000 "vpn": newest ISAKMP SA: #3; newest IPsec SA: #4;
000
000 #4: "vpn" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 85714s; newest IPSEC; eroute owner
000 #4: "vpn" esp.243f75c5@200.X.X.11 esp.bbaf1782@201.X.X.2 tun.1004@200.X.X.11 tun.1003@201.X.X.2
000 #3: "vpn" STATE_MAIN_I4 (ISAKMP SA established); EVENT_SA_REPLACE in 3042s; newest ISAKMP
000


No var/log/secure apresenta um erro na 1ª linha do ipsec.secrets :
/var/log/secure
6378 Aug 28 22:27:13 servervpn pluto[15662]: Starting Pluto (FreeS/WAN Version 2.05 X.509-1.5.3 PLUTO_ USES_KEYRR)
6379 Aug 28 22:27:13 servervpn pluto[15662]: Using KLIPS IPsec interface code
6383 Aug 28 22:27:13 servervpn pluto[15662]: Changing to directory '/etc/ipsec.d/crls'
6384 Aug 28 22:27:13 servervpn pluto[15662]: added connection description "vpn"
6385 Aug 28 22:27:13 servervpn pluto[15662]: listening for IKE messages
6386 Aug 28 22:27:13 servervpn pluto[15662]: adding interface ipsec0/eth0 201.X.X.2
6387 Aug 28 22:27:13 servervpn pluto[15662]: loading secrets from "/etc/ipsec.secrets"
6388 Aug 28 22:27:13 servervpn pluto[15662]: ERROR "/etc/ipsec.secrets" line 1: index ":PSK" illegal l eading `:' in IPv6 numeric address
6389 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: initiating Main Mode
6390 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: received Vendor ID Payload; ASCII hash: tm{COMENTARIO}31` A{COMENTARIO}24kQo*,{COMENTARIO}16c}/({COMENTARIO}0748{COMENTARIO}37
6391 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: Peer ID is ID_IPV4_ADDR: '200.X.X.11'
6392 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: ISAKMP SA established
6393 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: initiating Quick Mode PSK+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1}
6394 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: ignoring informational payload, type IPSEC_RESP ONDER_LIFETIME
6395 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: sent QI2, IPsec SA established {ESP=>0xd6e0a488 <0x92ec5888}
6396 Aug 28 22:28:11 servervpn pluto[15662]: shutting down
6397 Aug 28 22:28:11 servervpn pluto[15662]: forgetting secrets
6398 Aug 28 22:28:11 servervpn pluto[15662]: "vpn": deleting connection
6399 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #2: deleting state (STATE_QUICK_I2)
6400 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #1: deleting state (STATE_MAIN_I4)
6401 Aug 28 22:28:11 servervpn pluto[15662]: shutting down interface ipsec0/eth0 201.X.X.224kQo*,Salve galera, peço ajuda para resolver este problema..

Estou com problemas para fechar uma vpn com Freeswan no Slackware, esta configuração já existia e alterei apenas os ip's, a chave PSK e inclui o 3-DES, quando subo a vpn aparentemente está fechada, mas quando mando um telnet para o destino ele vai por fora da vpn, abaixo vou colocar os arquivos de configuraçâo, se possível peço sua ajuda neste caso, muito obrigado :

IPSEC.CONF

# /etc/ipsec.conf - FreeS/WAN IPsec configuration file
# RCSID $Id: ipsec.conf.in,v 1.11 2003/06/13 23:28:41 sam Exp $

# This file: /usr/local/share/doc/freeswan/ipsec.conf-sample
#
# Manual: ipsec.conf.5
#
# Help:
# http://www.strongsec.com/freeswan/install.htm

version 2.0 # conforms to second version of ipsec.conf specification

# basic configuration
config setup
interfaces="ipsec0=eth0"
klipsdebug=none
plutodebug=none
# plutoload=%search
# plutostart=%search
# plutowait=no

# Debug-logging controls: "none" for (almost) none, "all" for lots.
# klipsdebug=all
# plutodebug=all
# crlcheckinterval=600
# strictcrlpolicy=yes

conn %default
auto=add
type=tunnel
left=
right=
authby=secret
keyexchange=ike
esp=3des-md5-96i
keylife=24h

# OE policy groups are disabled by default
conn block
auto=ignore

conn clear
auto=ignore

conn private
auto=ignore

conn private-or-clear
auto=ignore

conn clear-or-private
auto=ignore

conn packetdefault
auto=ignore

# Add connections here.

# sample VPN connection
#sample# conn sample
#sample# # Left security gateway, subnet behind it, next hop toward right.
#sample# left=%defaultroute
#sample# leftcert=myCert.pem
#sample# leftsubnet=172.16.0.0/24
#sample# # Right security gateway, subnet behind it, next hop toward left.
#sample# right=10.12.12.1
#sample# rightid="<Distinguished name of right security gateway>"
#sample# rightsubnet=192.168.0.0/24
#sample# # To authorize this connection, but not actually start it, at startup,
#sample# # uncomment this.
#sample# #auto=start
conn vpn
auto=add
type=tunnel
left=200.X.X.11
leftsubnet=200.X.X.51/32
leftnexthop=
right=201.X.X.2
rightsubnet=192.168.1.0/24
rightnexthop=201.X.X.1
authby=secret
esp=3des-md5-96i
keylife=24h
pfs=yes
rekeymargin=9m
rekeyfuzz=25%

No ipsec.secret, tem apenas uma linha contendo a chave, substitui uma pela outra :

ipsec.secret

:PSK "CHAVE"


Dando um ipsec auto --status :
ipsec auto --status
000 interface ipsec0/eth0 201.X.X.2
000 %myid = (none)
000 debug none
000
000 "vpn": 192.168.1.0/24===201.X.X.2---201.X.X.1...200.X.X.11===200.X.X.51/32; erouted; eroute owner: #4
000 "vpn": ike_life: 3600s; ipsec_life: 86400s; rekey_margin: 540s; rekey_fuzz: 25%; keyingtries: 0
000 "vpn": policy: PSK+ENCRYPT+TUNNEL+PFS+UP; prio: 32,24; interface: eth0;
000 "vpn": newest ISAKMP SA: #3; newest IPsec SA: #4;
000
000 #4: "vpn" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 85714s; newest IPSEC; eroute owner
000 #4: "vpn" esp.243f75c5@200.X.X.11 esp.bbaf1782@201.X.X.2 tun.1004@200.X.X.11 tun.1003@201.X.X.2
000 #3: "vpn" STATE_MAIN_I4 (ISAKMP SA established); EVENT_SA_REPLACE in 3042s; newest ISAKMP
000


No var/log/secure apresenta um erro na 1ª linha do ipsec.secrets :
/var/log/secure
6378 Aug 28 22:27:13 servervpn pluto[15662]: Starting Pluto (FreeS/WAN Version 2.05 X.509-1.5.3 PLUTO_ USES_KEYRR)
6379 Aug 28 22:27:13 servervpn pluto[15662]: Using KLIPS IPsec interface code
6383 Aug 28 22:27:13 servervpn pluto[15662]: Changing to directory '/etc/ipsec.d/crls'
6384 Aug 28 22:27:13 servervpn pluto[15662]: added connection description "vpn"
6385 Aug 28 22:27:13 servervpn pluto[15662]: listening for IKE messages
6386 Aug 28 22:27:13 servervpn pluto[15662]: adding interface ipsec0/eth0 201.X.X.2
6387 Aug 28 22:27:13 servervpn pluto[15662]: loading secrets from "/etc/ipsec.secrets"
6388 Aug 28 22:27:13 servervpn pluto[15662]: ERROR "/etc/ipsec.secrets" line 1: index ":PSK" illegal l eading `:' in IPv6 numeric address
6389 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: initiating Main Mode
6390 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: received Vendor ID Payload; ASCII hash: tm{COMENTARIO}31` A{COMENTARIO}24kQo*,{COMENTARIO}16c}/({COMENTARIO}0748{COMENTARIO}37
6391 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: Peer ID is ID_IPV4_ADDR: '200.X.X.11'
6392 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: ISAKMP SA established
6393 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: initiating Quick Mode PSK+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1}
6394 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: ignoring informational payload, type IPSEC_RESP ONDER_LIFETIME
6395 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: sent QI2, IPsec SA established {ESP=>0xd6e0a488 <0x92ec5888}
6396 Aug 28 22:28:11 servervpn pluto[15662]: shutting down
6397 Aug 28 22:28:11 servervpn pluto[15662]: forgetting secrets
6398 Aug 28 22:28:11 servervpn pluto[15662]: "vpn": deleting connection
6399 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #2: deleting state (STATE_QUICK_I2)
6400 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #1: deleting state (STATE_MAIN_I4)
6401 Aug 28 22:28:11 servervpn pluto[15662]: shutting down interface ipsec0/eth0 201.X.X.216c}/(Salve galera, peço ajuda para resolver este problema..

Estou com problemas para fechar uma vpn com Freeswan no Slackware, esta configuração já existia e alterei apenas os ip's, a chave PSK e inclui o 3-DES, quando subo a vpn aparentemente está fechada, mas quando mando um telnet para o destino ele vai por fora da vpn, abaixo vou colocar os arquivos de configuraçâo, se possível peço sua ajuda neste caso, muito obrigado :

IPSEC.CONF

# /etc/ipsec.conf - FreeS/WAN IPsec configuration file
# RCSID $Id: ipsec.conf.in,v 1.11 2003/06/13 23:28:41 sam Exp $

# This file: /usr/local/share/doc/freeswan/ipsec.conf-sample
#
# Manual: ipsec.conf.5
#
# Help:
# http://www.strongsec.com/freeswan/install.htm

version 2.0 # conforms to second version of ipsec.conf specification

# basic configuration
config setup
interfaces="ipsec0=eth0"
klipsdebug=none
plutodebug=none
# plutoload=%search
# plutostart=%search
# plutowait=no

# Debug-logging controls: "none" for (almost) none, "all" for lots.
# klipsdebug=all
# plutodebug=all
# crlcheckinterval=600
# strictcrlpolicy=yes

conn %default
auto=add
type=tunnel
left=
right=
authby=secret
keyexchange=ike
esp=3des-md5-96i
keylife=24h

# OE policy groups are disabled by default
conn block
auto=ignore

conn clear
auto=ignore

conn private
auto=ignore

conn private-or-clear
auto=ignore

conn clear-or-private
auto=ignore

conn packetdefault
auto=ignore

# Add connections here.

# sample VPN connection
#sample# conn sample
#sample# # Left security gateway, subnet behind it, next hop toward right.
#sample# left=%defaultroute
#sample# leftcert=myCert.pem
#sample# leftsubnet=172.16.0.0/24
#sample# # Right security gateway, subnet behind it, next hop toward left.
#sample# right=10.12.12.1
#sample# rightid="<Distinguished name of right security gateway>"
#sample# rightsubnet=192.168.0.0/24
#sample# # To authorize this connection, but not actually start it, at startup,
#sample# # uncomment this.
#sample# #auto=start
conn vpn
auto=add
type=tunnel
left=200.X.X.11
leftsubnet=200.X.X.51/32
leftnexthop=
right=201.X.X.2
rightsubnet=192.168.1.0/24
rightnexthop=201.X.X.1
authby=secret
esp=3des-md5-96i
keylife=24h
pfs=yes
rekeymargin=9m
rekeyfuzz=25%

No ipsec.secret, tem apenas uma linha contendo a chave, substitui uma pela outra :

ipsec.secret

:PSK "CHAVE"


Dando um ipsec auto --status :
ipsec auto --status
000 interface ipsec0/eth0 201.X.X.2
000 %myid = (none)
000 debug none
000
000 "vpn": 192.168.1.0/24===201.X.X.2---201.X.X.1...200.X.X.11===200.X.X.51/32; erouted; eroute owner: #4
000 "vpn": ike_life: 3600s; ipsec_life: 86400s; rekey_margin: 540s; rekey_fuzz: 25%; keyingtries: 0
000 "vpn": policy: PSK+ENCRYPT+TUNNEL+PFS+UP; prio: 32,24; interface: eth0;
000 "vpn": newest ISAKMP SA: #3; newest IPsec SA: #4;
000
000 #4: "vpn" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 85714s; newest IPSEC; eroute owner
000 #4: "vpn" esp.243f75c5@200.X.X.11 esp.bbaf1782@201.X.X.2 tun.1004@200.X.X.11 tun.1003@201.X.X.2
000 #3: "vpn" STATE_MAIN_I4 (ISAKMP SA established); EVENT_SA_REPLACE in 3042s; newest ISAKMP
000


No var/log/secure apresenta um erro na 1ª linha do ipsec.secrets :
/var/log/secure
6378 Aug 28 22:27:13 servervpn pluto[15662]: Starting Pluto (FreeS/WAN Version 2.05 X.509-1.5.3 PLUTO_ USES_KEYRR)
6379 Aug 28 22:27:13 servervpn pluto[15662]: Using KLIPS IPsec interface code
6383 Aug 28 22:27:13 servervpn pluto[15662]: Changing to directory '/etc/ipsec.d/crls'
6384 Aug 28 22:27:13 servervpn pluto[15662]: added connection description "vpn"
6385 Aug 28 22:27:13 servervpn pluto[15662]: listening for IKE messages
6386 Aug 28 22:27:13 servervpn pluto[15662]: adding interface ipsec0/eth0 201.X.X.2
6387 Aug 28 22:27:13 servervpn pluto[15662]: loading secrets from "/etc/ipsec.secrets"
6388 Aug 28 22:27:13 servervpn pluto[15662]: ERROR "/etc/ipsec.secrets" line 1: index ":PSK" illegal l eading `:' in IPv6 numeric address
6389 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: initiating Main Mode
6390 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: received Vendor ID Payload; ASCII hash: tm{COMENTARIO}31` A{COMENTARIO}24kQo*,{COMENTARIO}16c}/({COMENTARIO}0748{COMENTARIO}37
6391 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: Peer ID is ID_IPV4_ADDR: '200.X.X.11'
6392 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: ISAKMP SA established
6393 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: initiating Quick Mode PSK+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1}
6394 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: ignoring informational payload, type IPSEC_RESP ONDER_LIFETIME
6395 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: sent QI2, IPsec SA established {ESP=>0xd6e0a488 <0x92ec5888}
6396 Aug 28 22:28:11 servervpn pluto[15662]: shutting down
6397 Aug 28 22:28:11 servervpn pluto[15662]: forgetting secrets
6398 Aug 28 22:28:11 servervpn pluto[15662]: "vpn": deleting connection
6399 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #2: deleting state (STATE_QUICK_I2)
6400 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #1: deleting state (STATE_MAIN_I4)
6401 Aug 28 22:28:11 servervpn pluto[15662]: shutting down interface ipsec0/eth0 201.X.X.20748Salve galera, peço ajuda para resolver este problema..

Estou com problemas para fechar uma vpn com Freeswan no Slackware, esta configuração já existia e alterei apenas os ip's, a chave PSK e inclui o 3-DES, quando subo a vpn aparentemente está fechada, mas quando mando um telnet para o destino ele vai por fora da vpn, abaixo vou colocar os arquivos de configuraçâo, se possível peço sua ajuda neste caso, muito obrigado :

IPSEC.CONF

# /etc/ipsec.conf - FreeS/WAN IPsec configuration file
# RCSID $Id: ipsec.conf.in,v 1.11 2003/06/13 23:28:41 sam Exp $

# This file: /usr/local/share/doc/freeswan/ipsec.conf-sample
#
# Manual: ipsec.conf.5
#
# Help:
# http://www.strongsec.com/freeswan/install.htm

version 2.0 # conforms to second version of ipsec.conf specification

# basic configuration
config setup
interfaces="ipsec0=eth0"
klipsdebug=none
plutodebug=none
# plutoload=%search
# plutostart=%search
# plutowait=no

# Debug-logging controls: "none" for (almost) none, "all" for lots.
# klipsdebug=all
# plutodebug=all
# crlcheckinterval=600
# strictcrlpolicy=yes

conn %default
auto=add
type=tunnel
left=
right=
authby=secret
keyexchange=ike
esp=3des-md5-96i
keylife=24h

# OE policy groups are disabled by default
conn block
auto=ignore

conn clear
auto=ignore

conn private
auto=ignore

conn private-or-clear
auto=ignore

conn clear-or-private
auto=ignore

conn packetdefault
auto=ignore

# Add connections here.

# sample VPN connection
#sample# conn sample
#sample# # Left security gateway, subnet behind it, next hop toward right.
#sample# left=%defaultroute
#sample# leftcert=myCert.pem
#sample# leftsubnet=172.16.0.0/24
#sample# # Right security gateway, subnet behind it, next hop toward left.
#sample# right=10.12.12.1
#sample# rightid="<Distinguished name of right security gateway>"
#sample# rightsubnet=192.168.0.0/24
#sample# # To authorize this connection, but not actually start it, at startup,
#sample# # uncomment this.
#sample# #auto=start
conn vpn
auto=add
type=tunnel
left=200.X.X.11
leftsubnet=200.X.X.51/32
leftnexthop=
right=201.X.X.2
rightsubnet=192.168.1.0/24
rightnexthop=201.X.X.1
authby=secret
esp=3des-md5-96i
keylife=24h
pfs=yes
rekeymargin=9m
rekeyfuzz=25%

No ipsec.secret, tem apenas uma linha contendo a chave, substitui uma pela outra :

ipsec.secret

:PSK "CHAVE"


Dando um ipsec auto --status :
ipsec auto --status
000 interface ipsec0/eth0 201.X.X.2
000 %myid = (none)
000 debug none
000
000 "vpn": 192.168.1.0/24===201.X.X.2---201.X.X.1...200.X.X.11===200.X.X.51/32; erouted; eroute owner: #4
000 "vpn": ike_life: 3600s; ipsec_life: 86400s; rekey_margin: 540s; rekey_fuzz: 25%; keyingtries: 0
000 "vpn": policy: PSK+ENCRYPT+TUNNEL+PFS+UP; prio: 32,24; interface: eth0;
000 "vpn": newest ISAKMP SA: #3; newest IPsec SA: #4;
000
000 #4: "vpn" STATE_QUICK_I2 (sent QI2, IPsec SA established); EVENT_SA_REPLACE in 85714s; newest IPSEC; eroute owner
000 #4: "vpn" esp.243f75c5@200.X.X.11 esp.bbaf1782@201.X.X.2 tun.1004@200.X.X.11 tun.1003@201.X.X.2
000 #3: "vpn" STATE_MAIN_I4 (ISAKMP SA established); EVENT_SA_REPLACE in 3042s; newest ISAKMP
000


No var/log/secure apresenta um erro na 1ª linha do ipsec.secrets :
/var/log/secure
6378 Aug 28 22:27:13 servervpn pluto[15662]: Starting Pluto (FreeS/WAN Version 2.05 X.509-1.5.3 PLUTO_ USES_KEYRR)
6379 Aug 28 22:27:13 servervpn pluto[15662]: Using KLIPS IPsec interface code
6383 Aug 28 22:27:13 servervpn pluto[15662]: Changing to directory '/etc/ipsec.d/crls'
6384 Aug 28 22:27:13 servervpn pluto[15662]: added connection description "vpn"
6385 Aug 28 22:27:13 servervpn pluto[15662]: listening for IKE messages
6386 Aug 28 22:27:13 servervpn pluto[15662]: adding interface ipsec0/eth0 201.X.X.2
6387 Aug 28 22:27:13 servervpn pluto[15662]: loading secrets from "/etc/ipsec.secrets"
6388 Aug 28 22:27:13 servervpn pluto[15662]: ERROR "/etc/ipsec.secrets" line 1: index ":PSK" illegal l eading `:' in IPv6 numeric address
6389 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: initiating Main Mode
6390 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: received Vendor ID Payload; ASCII hash: tm{COMENTARIO}31` A{COMENTARIO}24kQo*,{COMENTARIO}16c}/({COMENTARIO}0748{COMENTARIO}37
6391 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: Peer ID is ID_IPV4_ADDR: '200.X.X.11'
6392 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: ISAKMP SA established
6393 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: initiating Quick Mode PSK+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1}
6394 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: ignoring informational payload, type IPSEC_RESP ONDER_LIFETIME
6395 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: sent QI2, IPsec SA established {ESP=>0xd6e0a488 <0x92ec5888}
6396 Aug 28 22:28:11 servervpn pluto[15662]: shutting down
6397 Aug 28 22:28:11 servervpn pluto[15662]: forgetting secrets
6398 Aug 28 22:28:11 servervpn pluto[15662]: "vpn": deleting connection
6399 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #2: deleting state (STATE_QUICK_I2)
6400 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #1: deleting state (STATE_MAIN_I4)
6401 Aug 28 22:28:11 servervpn pluto[15662]: shutting down interface ipsec0/eth0 201.X.X.237
6391 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: Peer ID is ID_IPV4_ADDR: '200.X.X.11'
6392 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #1: ISAKMP SA established
6393 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: initiating Quick Mode PSK+ENCRYPT+TUNNEL+PFS+UP {using isakmp#1}
6394 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: ignoring informational payload, type IPSEC_RESP ONDER_LIFETIME
6395 Aug 28 22:27:16 servervpn pluto[15662]: "vpn" #2: sent QI2, IPsec SA established {ESP=>0xd6e0a488 <0x92ec5888}
6396 Aug 28 22:28:11 servervpn pluto[15662]: shutting down
6397 Aug 28 22:28:11 servervpn pluto[15662]: forgetting secrets
6398 Aug 28 22:28:11 servervpn pluto[15662]: "vpn": deleting connection
6399 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #2: deleting state (STATE_QUICK_I2)
6400 Aug 28 22:28:11 servervpn pluto[15662]: "vpn" #1: deleting state (STATE_MAIN_I4)
6401 Aug 28 22:28:11 servervpn pluto[15662]: shutting down interface ipsec0/eth0 201.X.X.2
#6 Comentário enviado por ferjun01 em 30/08/2008 - 13:55h
Estes são os requerimentos para fechar a vpn :

Fase I – Protocolo IKE – Não será aceito outro protocolo senão IKE
Fase I – Algoritmos de criptografia e integridade  3DES com MD5
Fase I – Grupo Diffie-Hellman Grupo 2 (1024 bits)
Fase I – Renegociar IKE Security Associations a cada 1440 minutos
Fase I – Aggressive Mode (DESABILITADO)
Fase I – Método de autenticação Shared Secret
Fase II - Protocolo IPSEC
Fase II – Algoritmos de criptografia e integridade
A Fase II seguirá os mesmos algoritmos da Fase I.
Fase II –PFS (Perfect Forward Secrecy) Grupo Diffie-Helmann 2 (1024 bits)
Fase II – Renegociar IPSEC Security Association a cada 3600 segundos
Fase II – Compressão de dados IPSEC (DESABILITADO)

Contribuir com comentário

Entre na sua conta para comentar.