Re: [strongSwan] Route based VPN in Linux

2018-04-16 Thread Andrii Petrenko
https://wiki.strongswan.org/projects/strongswan/wiki/RouteBasedVPN 
<https://wiki.strongswan.org/projects/strongswan/wiki/RouteBasedVPN>

---
Andrii Petrenko
apl...@gmail.com

> On Apr 16, 2018, at 11:26, Kaushal Shriyan <kaushalshri...@gmail.com> wrote:
> 
> Hi,
> 
> I will appreciate if anyone can point me to a doc to setup Route based VPN in 
> Linux using VTI
> Thanks in Advance. 
> 
> I look forward to hearing from you.
> 
> Best Regards,
> 
> Kaushal



Re: [strongSwan] Strong swan IKE issue.

2018-03-20 Thread Andrii Petrenko
Hello Tobias,

Remote side is asking  disable PFS Group 5:

PFS Group 5 is not configured on our end and is not enabled by default.
If this is currently required on the Andrii end then we will open a change to 
have this added.
 
Can it cause this problem?

How can I disable PFS on my side? 

we have no DH group defined for esp, so pfs is disabled. What i have in doc:

pfs = yes | no
whether Perfect Forward Secrecy of keys is desired on the connection's keying 
channel (with PFS,
penetration of the key-exchange protocol does not compromise keys negotiated 
earlier). IKEv2 always uses
PFS for IKE_SA rekeying whereas for CHILD_SA rekeying PFS is enforced by 
defining a Diffie-Hellman dhgroup
in the esp parameter. Since 5.0.0 
<https://wiki.strongswan.org/projects/strongswan/wiki/500> the latter also 
applies to IKEv1 and this parameter has no effect anymore.

I set pfs=no, and have this in my log:

ipsec_starter[1]: Starting strongSwan 5.6.2 IPsec [starter]...
# deprecated keyword 'pfs' in conn 'remote-asa'
ipsec_starter[1]: # deprecated keyword 'pfs' in conn 'remote-asa'
  PFS is enabled by specifying a DH group in the 'esp' cipher suite
ipsec_starter[1]:   PFS is enabled by specifying a DH group in the 'esp' cipher 
suite

I have no DH group specified for ESP on my side:

esp=aes256-sha1!


Thank you,

Andrii Petrenko
apl...@gmail.com <mailto:apl...@gmail.com>  

> On Mar 20, 2018, at 8:07 AM, Andrii Petrenko <apl...@gmail.com> wrote:
> 
> Hello Tobias,
> 
> Thank you for details.
> I’ve already tased with 
> 
> esp=aes256-sha1!
> esp=aes128-sha1! 
> esp=3des-md5! 
> 
> No luck.  Requested logs and configs from ASA by
> 
> debug crypto ikev1 127 
> debug crypto ipsec 127 
> 
> show crypto ipsec sa
> 
> Thank you,
> 
> Andrii Petrenko
> apl...@gmail.com <mailto:apl...@gmail.com>
> 
>> On Mar 20, 2018, at 12:45 AM, Tobias Brunner <tob...@strongswan.org 
>> <mailto:tob...@strongswan.org>> wrote:
>> 
>> Hi Andrii,
>> 
>> ike-scan won't help you here as it only reports on Phase 1 (IKE SA), but
>> your problem is during Phase 2 (Quick Mode, IPsec SA).
>> 
>>> Remote side is not supporting pfs.
>>> 
>>> IKE Phase One Parameters:   
>>> Encryption Algorithm:   AES 256
>>> Hash Algorithm: SHA
>>> Authentication Method:  Pre-shared key
>>> Key Exchange:   Diffie Hellman Group 5
>>> IKE SA Lifetime:86400 (Cisco default)
>>> 
>>> IKE Phase Two Parameters (IPSEC):   
>>> Authentication: ESP with SHA-HMAC
>>> Encryption Algorithm:   ESP-AES 256
>>> SA Establishment:   ipsec-isakmp (IKE negotiated)
>>> IPSEC Mode  Tunnel (Cisco default)
>>> IPSEC SA Lifetime (time)3600 seconds
>>> IPSEC SA Lifetime (volume)  4608000 kilobytes
>>> PFS (Perfect Forward Secrecy)   No
>>> 
>>> Optional encryption if requirements differ from above:  
>>> esp-3des esp-md5-hmac   
>>> esp-aes 256 esp-sha-hmac
>>> esp-aes 128 esp-sha-hmac
>>> 
>>> This information I have from remote side. 
>> 
>> Looks like esp=aes256-sha1! should be correct then.  You could also try
>> esp=aes128-sha1! or esp=3des-md5! (not recommended though).  And if this
>> doesn't work, ask the remote admins for the correct settings (they
>> should see in the log why the proposal was rejected).
>> 
>>> Is it possible to se what offer remote side?
>> 
>> No (unless you do what ike-scan does i.e. try a number of possible
>> combinations).
>> 
>> Regards,
>> Tobias
> 



Re: [strongSwan] Strong swan IKE issue.

2018-03-20 Thread Andrii Petrenko
Hello Tobias,

Thank you for details.
I’ve already tased with 

esp=aes256-sha1!
esp=aes128-sha1! 
esp=3des-md5! 

No luck.  Requested logs and configs from ASA by

debug crypto ikev1 127 
debug crypto ipsec 127 

show crypto ipsec sa

Thank you,

Andrii Petrenko
apl...@gmail.com <mailto:apl...@gmail.com>  

> On Mar 20, 2018, at 12:45 AM, Tobias Brunner <tob...@strongswan.org> wrote:
> 
> Hi Andrii,
> 
> ike-scan won't help you here as it only reports on Phase 1 (IKE SA), but
> your problem is during Phase 2 (Quick Mode, IPsec SA).
> 
>> Remote side is not supporting pfs.
>> 
>> IKE Phase One Parameters:
>> Encryption Algorithm:AES 256
>> Hash Algorithm:  SHA
>> Authentication Method:   Pre-shared key
>> Key Exchange:Diffie Hellman Group 5
>> IKE SA Lifetime: 86400 (Cisco default)
>>  
>> IKE Phase Two Parameters (IPSEC):
>> Authentication:  ESP with SHA-HMAC
>> Encryption Algorithm:ESP-AES 256
>> SA Establishment:ipsec-isakmp (IKE negotiated)
>> IPSEC Mode   Tunnel (Cisco default)
>> IPSEC SA Lifetime (time) 3600 seconds
>> IPSEC SA Lifetime (volume)   4608000 kilobytes
>> PFS (Perfect Forward Secrecy)No
>>  
>> Optional encryption if requirements differ from above:   
>> esp-3des esp-md5-hmac
>> esp-aes 256 esp-sha-hmac 
>> esp-aes 128 esp-sha-hmac 
>> 
>> This information I have from remote side. 
> 
> Looks like esp=aes256-sha1! should be correct then.  You could also try
> esp=aes128-sha1! or esp=3des-md5! (not recommended though).  And if this
> doesn't work, ask the remote admins for the correct settings (they
> should see in the log why the proposal was rejected).
> 
>> Is it possible to se what offer remote side?
> 
> No (unless you do what ike-scan does i.e. try a number of possible
> combinations).
> 
> Regards,
> Tobias



Re: [strongSwan] Strong swan IKE issue.

2018-03-19 Thread Andrii Petrenko
Actually  all of them are identified:

12.10.219.4 Main Mode Handshake returned HDR=(CKY-R=8d51ab7841c04271) 
SA=(Enc=AES KeyLength=128 Hash=SHA1 Group=5:modp1536 Auth=PSK LifeType=Seconds 
LifeDuration=28800)
12.10.219.4 Main Mode Handshake returned HDR=(CKY-R=8d51ab78aa98b745) 
SA=(Enc=AES KeyLength=256 Hash=SHA1 Group=5:modp1536 Auth=PSK LifeType=Seconds 
LifeDuration=28800)
12.10.219.4 Main Mode Handshake returned HDR=(CKY-R=8d51ab78faedcf4f) 
SA=(Enc=3DES Hash=MD5 Group=1:modp768 Auth=PSK LifeType=Seconds 
LifeDuration=28800)

But strong swan set for all:

12[ENC] parsed INFORMATIONAL_V1 request 76122219 [ HASH N(NO_PROP) ]
12[IKE] received NO_PROPOSAL_CHOSEN error notify


Thank you,
AP



> On Mar 19, 2018, at 15:22, Andrii Petrenko <apl...@gmail.com> wrote:
> 
> Tobias,
> 
> I’ve tried ike-scan and what I see: 
> 
> ~/ike-scan$ sudo ike-scan --verbose  --trans=7/256,2,1,5  xx.xx.xx.xx
> sudo: unable to resolve host stratus01
> DEBUG: pkt len=88 bytes, bandwidth=56000 bps, int=16571 us
> Starting ike-scan 1.9.4 with 1 hosts 
> (http://www.nta-monitor.com/tools/ike-scan/ 
> <http://www.nta-monitor.com/tools/ike-scan/>)
> xx.xx.xx.xx Main Mode Handshake returned HDR=(CKY-R=8d51ab7680ad) 
> SA=(Enc=AES KeyLength=256 Hash=SHA1 Group=5:modp1536 Auth=PSK 
> LifeType=Seconds LifeDuration=28800)
> 
> 
> 
> 
>> On Mar 19, 2018, at 11:01, Andrii Petrenko <apl...@gmail.com 
>> <mailto:apl...@gmail.com>> wrote:
>> 
>> Tobias, thank you for reply.
>> 
>> Remote side is not supporting pfs.
>> 
>> IKE Phase One Parameters:
>> Encryption Algorithm:AES 256
>> Hash Algorithm:  SHA
>> Authentication Method:   Pre-shared key
>> Key Exchange:Diffie Hellman Group 5
>> IKE SA Lifetime: 86400 (Cisco default)
>> IKE Phase Two Parameters (IPSEC):
>> Authentication:  ESP with SHA-HMAC
>> Encryption Algorithm:ESP-AES 256
>> SA Establishment:ipsec-isakmp (IKE negotiated)
>> IPSEC Mode   Tunnel (Cisco default)
>> IPSEC SA Lifetime (time) 3600 seconds
>> IPSEC SA Lifetime (volume)   4608000 kilobytes
>> PFS (Perfect Forward Secrecy)No
>> Optional encryption if requirements differ from above:   
>> esp-3des esp-md5-hmac
>> esp-aes 256 esp-sha-hmac 
>> esp-aes 128 esp-sha-hmac 
>> 
>> This information I have from remote side. 
>> 
>> Is it possible to se what offer remote side?
>> 
>> Thank you,
>> AP
>> 
>> 
>>> On Mar 19, 2018, at 10:52, Tobias Brunner <tob...@strongswan.org 
>>> <mailto:tob...@strongswan.org>> wrote:
>>> 
>>> Hi Andrii,
>>> 
>>>> I see the problem on IKE side, but don’t know how to debug and fix it.
>>> 
>>> The log tells you _exactly_ what the problem is:
>>> 
>>>> 12[ENC] parsed INFORMATIONAL_V1 request 2090615229 [ HASH N(NO_PROP) ]
>>>> 12[IKE] received NO_PROPOSAL_CHOSEN error notify
>>> 
>>> The peer doesn't like the crypto proposal sent by the client.  So fix
>>> the `esp` setting in the config (maybe you have to enabled PFS by adding
>>> a DH group, ask the other server admin for the correct algorithms).
>>> 
>>> Regards,
>>> Tobias
>> 
> 



Re: [strongSwan] Strong swan IKE issue.

2018-03-19 Thread Andrii Petrenko
Tobias,

I’ve tried ike-scan and what I see: 

~/ike-scan$ sudo ike-scan --verbose  --trans=7/256,2,1,5  xx.xx.xx.xx
sudo: unable to resolve host stratus01
DEBUG: pkt len=88 bytes, bandwidth=56000 bps, int=16571 us
Starting ike-scan 1.9.4 with 1 hosts 
(http://www.nta-monitor.com/tools/ike-scan/)
xx.xx.xx.xx Main Mode Handshake returned HDR=(CKY-R=8d51ab7680ad) 
SA=(Enc=AES KeyLength=256 Hash=SHA1 Group=5:modp1536 Auth=PSK LifeType=Seconds 
LifeDuration=28800)




> On Mar 19, 2018, at 11:01, Andrii Petrenko <apl...@gmail.com> wrote:
> 
> Tobias, thank you for reply.
> 
> Remote side is not supporting pfs.
> 
> IKE Phase One Parameters: 
> Encryption Algorithm: AES 256
> Hash Algorithm:   SHA
> Authentication Method:Pre-shared key
> Key Exchange: Diffie Hellman Group 5
> IKE SA Lifetime:  86400 (Cisco default)
> IKE Phase Two Parameters (IPSEC): 
> Authentication:   ESP with SHA-HMAC
> Encryption Algorithm: ESP-AES 256
> SA Establishment: ipsec-isakmp (IKE negotiated)
> IPSEC ModeTunnel (Cisco default)
> IPSEC SA Lifetime (time)  3600 seconds
> IPSEC SA Lifetime (volume)4608000 kilobytes
> PFS (Perfect Forward Secrecy) No
> Optional encryption if requirements differ from above:
> esp-3des esp-md5-hmac 
> esp-aes 256 esp-sha-hmac  
> esp-aes 128 esp-sha-hmac  
> 
> This information I have from remote side. 
> 
> Is it possible to se what offer remote side?
> 
> Thank you,
> AP
> 
> 
>> On Mar 19, 2018, at 10:52, Tobias Brunner <tob...@strongswan.org 
>> <mailto:tob...@strongswan.org>> wrote:
>> 
>> Hi Andrii,
>> 
>>> I see the problem on IKE side, but don’t know how to debug and fix it.
>> 
>> The log tells you _exactly_ what the problem is:
>> 
>>> 12[ENC] parsed INFORMATIONAL_V1 request 2090615229 [ HASH N(NO_PROP) ]
>>> 12[IKE] received NO_PROPOSAL_CHOSEN error notify
>> 
>> The peer doesn't like the crypto proposal sent by the client.  So fix
>> the `esp` setting in the config (maybe you have to enabled PFS by adding
>> a DH group, ask the other server admin for the correct algorithms).
>> 
>> Regards,
>> Tobias
> 



[strongSwan] Strong swan IKE issue.

2018-03-19 Thread Andrii Petrenko
 key authentication
remote-asa:   remote: [xx.xx.xx.xx] uses pre-shared key authentication
remote-asa:   child:  dynamic === 148.171.0.0/16 TUNNEL
Security Associations (0 up, 0 connecting):
  no match
apl@stratus01:~/alpine-strongswan-vpn$ docker exec -it strongswan ipsec 
statusall remote-asa
Status of IKE charon daemon (strongSwan 5.6.2, Linux 3.13.0-58-generic, x86_64):
  uptime: 2 seconds, since Mar 19 14:31:18 2018
  worker threads: 11 of 16 idle, 5/0/0/0 working, job queue: 0/0/0/0, 
scheduled: 6
  loaded plugins: charon aesni aes des rc2 sha2 sha3 sha1 md4 md5 mgf1 random 
nonce x509 revocation constraints pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey 
sshkey pem openssl fips-prf gmp curve25519 chapoly xcbc cmac hmac gcm ntru 
newhope curl files attr kernel-netlink resolve socket-default farp stroke vici 
updown eap-identity eap-md5 eap-mschapv2 eap-dynamic eap-radius eap-tls 
xauth-generic dhcp counters
Listening IP addresses:
  45.55.20.248
  2604:a880:1:20::120:9001
  172.17.0.1
Connections:
remote-asa:  %any...xx.xx.xx.xx  IKEv1
remote-asa:   local:  [trueaccord] uses pre-shared key authentication
remote-asa:   remote: [xx.xx.xx.xx] uses pre-shared key authentication
remote-asa:   child:  dynamic === 148.171.0.0/16 TUNNEL
Security Associations (1 up, 0 connecting):
remote-asa[1]: ESTABLISHED 2 seconds ago, 
45.55.20.248[trueaccord]...xx.xx.xx.xx[xx.xx.xx.xx]
remote-asa[1]: IKEv1 SPIs: 563b49d3d678b72f_i* 8d51ab782bd5738d_r, 
pre-shared key reauthentication in 23 hours
remote-asa[1]: IKE proposal: 
AES_CBC_256/HMAC_SHA1_96/PRF_HMAC_SHA1/MODP_1536


Config:
#
config setup
charondebug="dmni 4, mgr 4, ike 4, chd 4, job 4, cfg 4, knl 4, net 4, asn 
4, enc 4, lib 4, esp 4, tls 4, tnc 4, imc 4, imv 4, pts 4"
#strictcrlpolicy=yes

conn %default
ikelifetime=86400
ikeylife=60m
rekeymargin=3m
keyingtries=1
keyexchange=ikev1
authby=secret

ike=aes128-sha1-modp1024,aes128-sha1-modp1536,aes128-sha1-modp2048,aes128-sha256-ecp256,aes128-sha256-modp1024,aes128-sha256-modp1536,aes128-sha256-modp2048,aes256-aes128-sha256-sha1-modp2048-modp4096-modp1024,aes256-sha1-modp1024,aes256-sha256-modp1024,aes256-sha256-modp1536,aes256-sha256-modp2048,aes256-sha256-modp4096,aes256-sha384-ecp384,aes256-sha384-modp1024,aes256-sha384-modp1536,aes256-sha384-modp2048,aes256-sha384-modp4096,aes256gcm16-aes256gcm12-aes128gcm16-aes128gcm12-sha256-sha1-modp2048-modp4096-modp1024,3des-sha1-modp1024!

esp=aes128-aes256-sha1-sha256-modp2048-modp4096-modp1024,aes128-sha1,aes128-sha1-modp1024,aes128-sha1-modp1536,aes128-sha1-modp2048,aes128-sha256,aes128-sha256-ecp256,aes128-sha256-modp1024,aes128-sha256-modp1536,aes128-sha256-modp2048,aes128gcm12-aes128gcm16-aes256gcm12-aes256gcm16-modp2048-modp4096-modp1024,aes128gcm16,aes128gcm16-ecp256,aes256-sha1,aes256-sha256,aes256-sha256-modp1024,aes256-sha256-modp1536,aes256-sha256-modp2048,aes256-sha256-modp4096,aes256-sha384,aes256-sha384-ecp384,aes256-sha384-modp1024,aes256-sha384-modp1536,aes256-sha384-modp2048,aes256-sha384-modp4096,aes256gcm16,aes256gcm16-ecp384,3des-sha1!

conn remote-asa
type=tunnel
#server, remote side
right=xx.xx.xx.xx
rightsubnet=178.171.0.0/16
rightid=xx.xx.xx.xx

#leftsubnet=10.78.47.0/24
leftid=trueaccord
leftfirewall=yes

auto=start
keyexchange=ikev1

ike=aes256-sha1-modp1536
esp=aes256-sha1!
ikelifetime=86400s
aggressive=no
lifebytes=4608000
lifetime=3600


I see the problem on IKE side, but don’t know how to debug and fix it.
Please help.


Thank you,

Andrii Petrenko
apl...@gmail.com <mailto:apl...@gmail.com>