{"id":753,"date":"2021-11-19T22:54:03","date_gmt":"2021-11-19T21:54:03","guid":{"rendered":"https:\/\/www.labtinker.net\/?p=753"},"modified":"2021-11-19T22:54:03","modified_gmt":"2021-11-19T21:54:03","slug":"on-yer-ike","status":"publish","type":"post","link":"http:\/\/18.135.13.153\/?p=753","title":{"rendered":"On yer IKE"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I was reviewing a VPN configuration and wondered why the engineer was using IKEv1 (IKE being Internet Key Exchange) instead of IKEv2 and then it occurred to me I was merely following a play in the Bluffers&#8217; Guide to IT: the newer the version, the longer the key, the fresher the acronym, the better it must be. I didn&#8217;t really have a deep understanding of the difference between the versions of IKE. So I thought I would  do a little research then have a tinker.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My lab was a couple of ASAs in GNS3 with a  IPsec VPN between them:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"927\" height=\"252\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/image.png\" alt=\"\" class=\"wp-image-755\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/image.png 927w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/image-300x82.png 300w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/image-768x209.png 768w\" sizes=\"auto, (max-width: 927px) 100vw, 927px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The terminology around VPNs can be confusing and even though this was intended as a practical post it&#8217;s probably useful to go over some of it. This is my high-level understanding (I found inconsistencies or perhaps differences of emphasis in sources I consulted)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">IPSec itself is a collection of protocols; IKE, (the subject of this post), ESP (Encapsulating Security Payload) and AH (Authentication Header). Let&#8217;s forgot AH, as it doesn&#8217;t provide encryption which leaves us with IKE and ESP.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">IKE itself is a collection of protocols, namely ISAKMP, Oakley and Skeme<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ISAKMP (Internet Security Association and Key Management Protocol) describes a framework for establishing security associations between peers; these being authenticated and cryptographically protected channels of communication<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">IKE and ISKAMP often seemed to be used interchangeably. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">IKE has two phases: <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>IKE Phase one<\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This establishes an SA (security association) to protect message exchanges between two IKE peers to enable them to securely  negotiate a policy for the SAs in phase two. The phase one SA can be almost considered a management SA between the two peers. In the above example the VPN is between the two ASAs so this SA will be between them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>IKE Phase two <\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This creates the IPSec SAs for configured local and remote subnets that can be used to securely transfer data. So in the above example the VPN has been configued such that traffic is secured between the subnets that the routers sit on, when it travels between the two ASAs. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">IKEv1 has two different modes of operation which are aggressive or main. These are explored and explained here:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.omnisecu.com\/tcpip\/ikev1-main-aggressive-and-quick-mode-message-exchanges.php\">https:\/\/www.omnisecu.com\/tcpip\/ikev1-main-aggressive-and-quick-mode-message-exchanges.php<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>IKEV1 Aggressive Mode<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This has to be used when one of the peers doesn&#8217;t have a fixed ip address and peer-id is used instead. It has advantage of only needing three exchanges. I set up ikev1 and ikev2 on the ASAs &#8211; and for this part of the exercise forced &#8216;aggressive mode&#8217;. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"494\" height=\"124\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/aggressive-setting.png\" alt=\"\" class=\"wp-image-765\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/aggressive-setting.png 494w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/aggressive-setting-300x75.png 300w\" sizes=\"auto, (max-width: 494px) 100vw, 494px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So setting up a ping from R1 to R2 to raise the VPN we see the three phase one exchanges (marked &#8216;Aggressive&#8217;, &#8216;Quick Mode&#8217; is phase 2)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"110\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/aggressive-cap-1024x110.png\" alt=\"\" class=\"wp-image-767\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/aggressive-cap-1024x110.png 1024w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/aggressive-cap-300x32.png 300w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/aggressive-cap-768x83.png 768w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/aggressive-cap.png 1032w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">And we see the identity of the peer sent in the clear:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"346\" height=\"166\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/phase1-id.png\" alt=\"\" class=\"wp-image-768\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/phase1-id.png 346w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/phase1-id-300x144.png 300w\" sizes=\"auto, (max-width: 346px) 100vw, 346px\" \/><figcaption>&#8230;which in this instance is the ip address of the ASA (though when dyanmic ip addresses are used it is typically some kind of tag)<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>IKEV1 Main mode<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So converting to main mode with the following command:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>crypto map outside_map 10 set phase1-mode main<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;though when I repeat the command to show the set up main mode isn&#8217;t explicitly stated, presumably as it&#8217;s the default.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"461\" height=\"96\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/main-setting.png\" alt=\"\" class=\"wp-image-770\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/main-setting.png 461w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/main-setting-300x62.png 300w\" sizes=\"auto, (max-width: 461px) 100vw, 461px\" \/><figcaption>&#8230;and in this instance we see six phase one IKE messages&#8230;.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"110\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/main-cap-1024x110.png\" alt=\"\" class=\"wp-image-772\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/main-cap-1024x110.png 1024w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/main-cap-300x32.png 300w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/main-cap-768x83.png 768w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/main-cap.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This mode doesn&#8217;t reveal the identity of the peer as is more secure. What these messages contain and their purpose has been covered in detail here:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.omnisecu.com\/tcpip\/ikev1-main-aggressive-and-quick-mode-message-exchanges.php\">https:\/\/www.omnisecu.com\/tcpip\/ikev1-main-aggressive-and-quick-mode-message-exchanges.php<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>IKEV2 <\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The differences beween the IKEv1 and IKEv2 are summarised here:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/privecstasy.com\/ikev1-vs-ikev2\/\">https:\/\/privecstasy.com\/ikev1-vs-ikev2\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Essentially, IKEv2 supports EAP authentication, has a more secure means of connection than aggressive mode, for when you have one peer with a dynamic address, called MOBIKE. It also allows you to use different authentication between peers (eg: psk one way and certificates the other)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The exchange is more efficient than ikev1 main mode:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"82\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/ikev2-cap-1-1024x82.png\" alt=\"\" class=\"wp-image-777\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/ikev2-cap-1-1024x82.png 1024w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/ikev2-cap-1-300x24.png 300w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/ikev2-cap-1-768x62.png 768w, http:\/\/18.135.13.153\/wp-content\/uploads\/2021\/11\/ikev2-cap-1.png 1230w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>I did think of playing a bit more with this but my ASAs in GNS3 keep rebooting today and so I&#8217;m inclined to trust my IT betters when they say ikev2 is better and more secure than ikev1.<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I was reviewing a VPN configuration and wondered why the engineer was using IKEv1 (IKE being Internet Key Exchange) instead of IKEv2 and then it occurred to me I was merely following a play in the Bluffers&#8217; Guide to IT: the newer the version, the longer the key, the fresher the acronym, the better it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-753","post","type-post","status-publish","format-standard","hentry","category-encryption"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts\/753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=753"}],"version-history":[{"count":0,"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts\/753\/revisions"}],"wp:attachment":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=753"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}