<div dir="ltr">Hi,<div><br></div><div>I had a question about how peer configs are matched by Strongswan. I have two connection definitions in my ipsec.conf, one for road-warriors and one for site2site. They are roughly defined as shown at the end of thie email. As can be seen the rw only accept ikev1, but any right-id. The site2site accept any ike version, but specific right-id that matches the peer's cert DN. What I see is that the perfect match of ike version is given preference over the perfect match of ID when choosing connection. When a site connects with IKEv1, and the proper cert, the "conn rw" is chosen, even though "conn site2site" has a perfect match of the ID, and also matches the ike version (since that connection definition can accept IKEv1/IKEv2). Shouldn't the site2site connection definition be chosen because it has the perfect match of the ID and accepts the ike version? We are using strongswan version 5.1.2 (+selective patches)</div><div><br></div><div>conn <b>rw</b></div><div><div><span style="color:rgb(54,0,12);font-family:Verdana,sans-serif;font-size:10.8px">          authby=rsasig</span><br></div></div><div>          <span style="color:rgb(54,0,12);font-family:Verdana,sans-serif;font-size:10.8px"><b>keyexchange=ikev1</b><br></span></div><div><span style="color:rgb(54,0,12);font-family:Verdana,sans-serif;font-size:10.8px">          rightid=%any</span></div><div><span style="color:rgb(54,0,12);font-family:Verdana,sans-serif;font-size:10.8px"><br></span></div><div><span style="color:rgb(54,0,12);font-family:Verdana,sans-serif;font-size:10.8px">conn <b>site2site</b></span></div><div><div><div><span style="color:rgb(54,0,12);font-family:Verdana,sans-serif;font-size:10.8px">          authby=rsasig</span><br></div></div><div>          <span style="color:rgb(54,0,12);font-family:Verdana,sans-serif;font-size:10.8px"><b>keyexchange=ike</b><br></span></div><div><span style="color:rgb(54,0,12);font-family:Verdana,sans-serif;font-size:10.8px">          rightid="DN from the peer's cert"</span></div><div><br></div></div><div>The log lines for the match show</div><div><span style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px">candidate "site2site", match: 1/20/1048 (me/other/ike)</span>  <br></div><div><span style="color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont;font-size:16px">candidate "rw", match: 1/1/1052 (me/other/ike)</span>  <br></div><div><br></div><div>.Candidate "rw" has higher ike match (1052) resulting in "rw" being chosen.</div><div><br></div><div>-sk</div><div><br></div><div><br></div></div>