-
Notifications
You must be signed in to change notification settings - Fork 405
T8136: IPSEC PPK Support #4930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: current
Are you sure you want to change the base?
T8136: IPSEC PPK Support #4930
Conversation
|
👍 |
cf026ea to
0f19483
Compare
sarthurdev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good, can you extend ipsec smoketests for the new use cases?
|
I was going to make an attempt to write a smoke test. It’ll be my first run at writing a smoketest. I have already tested against known working strongSwan configs. I’ll take those tests to put into smoketest and update. I’m also planning to put together the documentation PR. Just haven’t gotten to that yet. I’ll update the initial PR comment to reflect these updates when complete, and take this out of draft. |
|
Added relevant smoketest, and completed documentation update. I think this should be ready to go. |
sarthurdev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the smoketest.
Just needs couple extra steps for config validation and XML deduplication.
|
Much appreciated for catching those items. It got me thinking about some additional error checking. I added in that PPK IDs need to be unique, so it now checks that all IDs are unique. Since I had to gather all the IDs for that check, the verify() also confirms that a PPK ID used in a connection is actually defined in the authentication config. It might be useful to replicate that check for PSKs. I'm happy to open a new task and take care of that if it would be helpful. Branch was also rebased to current. |
src/conf_mode/vpn_ipsec.py
Outdated
| for ppkID in ppk_config['id']: | ||
| if ppkID in ppk_ids: | ||
| raise ConfigError(f'Authentication PPK "{ppk}" has duplicate ID "{ppkID}" from another PPK. IDs should be unique.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my testing if you use the same ID for multiple PPKs, it seems like strongSwan will only use the last loaded PPK for that ID. That is why I put in a check. The ID needs not be an IP address, it is a string that is passed in the IKE phase 1 to let the other side know I'm using key XX. If the receiving side has a key with that same key ID, then it will use that secret to try and establish the SA.
|
Removed the check in the connection configurations to confirm that a PPK ID was defined in the authentication configuration. This allows an operator to define a wildcard match for the PPK ID, as referenced in the strongSwan example PPK configuration. |
sever-sever
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the ability to use PPK ID and secrets for IPsec connections
117394b to
a641609
Compare
alexandr-san4ez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also fix linter errors for your changes.
alexandr-san4ez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post-quantum preshared key support well implemented and ready to merge.
vyos@vyos:~$ /usr/libexec/vyos/tests/smoke/cli/test_vpn_ipsec.py
...
test_site_to_site_nist_800_77_cnsa_1_with_ppk (__main__.TestVPNIPsec.test_site_to_site_nist_800_77_cnsa_1_with_ppk) ... ok
...
----------------------------------------------------------------------
Ran 20 tests in 101.409s
OK
|
CI integration 👍 passed! Details
|
sarthurdev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested changes addressed, code looks good, adds smoketest coverage. Locally verified CLI and resulting strongswan config/instance.
dmbaturin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation seems sensible but I left a few suggestions.
| <!-- include start from ipsec/childless.xml.i --> | ||
| <leafNode name="childless"> | ||
| <properties> | ||
| <help>Enable support for childless IKE_SA initiation</help> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <help>Enable support for childless IKE_SA initiation</help> | |
| <help>Enable support for childless IKE SA initiation</help> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there should be an underscore here, just a space.
| </completionHelp> | ||
| <valueHelp> | ||
| <format>allow</format> | ||
| <description>Responder will allow childless IKE_SA, but initiator will not create childless connection</description> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <description>Responder will allow childless IKE_SA, but initiator will not create childless connection</description> | |
| <description>Responder will allow childless IKE SA, but initiator will not create childless connections</description> |
| </valueHelp> | ||
| <valueHelp> | ||
| <format>prefer</format> | ||
| <description>Responder will allow childless IKE_SA, and initiator will make childless connection if supported by responder</description> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <description>Responder will allow childless IKE_SA, and initiator will make childless connection if supported by responder</description> | |
| <description>Responder will allow childless IKE SA, and initiator will make childless connections if supported by responder</description> |
| </valueHelp> | ||
| <valueHelp> | ||
| <format>force</format> | ||
| <description>Require the use of childless IKE_SA</description> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <description>Require the use of childless IKE_SA</description> | |
| <description>Require the use of childless IKE SA</description> |
| </valueHelp> | ||
| <valueHelp> | ||
| <format>never</format> | ||
| <description>Disable support for childless IKE_SAs as responder</description> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <description>Disable support for childless IKE_SAs as responder</description> | |
| <description>Disable support for childless IKE SAs as responder</description> |
| ike = ra_conf['ike_group'] | ||
| if dict_search(f'ike_group.{ike}.key_exchange', ipsec) != 'ikev2': | ||
| raise ConfigError( | ||
| f'Post-quantum preshared keys must be used with IKEv2! IKEv2 key-exchange not set in ike-group "{ike}".' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| f'Post-quantum preshared keys must be used with IKEv2! IKEv2 key-exchange not set in ike-group "{ike}".' | |
| f'Incorrect configuration in IKE group "{ike}": post-quantum pre-shared keys are not supported for IKEv1.' |
| ike = ra_conf['ike_group'] | ||
| if dict_search(f'ike_group.{ike}.key_exchange', ipsec) != 'ikev2': | ||
| raise ConfigError( | ||
| f'Childless IKE SAs be used with IKEv2! IKEv2 key-exchange not set in ike-group "{ike}".' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| f'Childless IKE SAs be used with IKEv2! IKEv2 key-exchange not set in ike-group "{ike}".' | |
| f'Incorrect configuration in IKE group "{ike}": childless IKE SAs can only be used with IKEv2.' |
| ike = peer_conf['ike_group'] | ||
| if dict_search(f'ike_group.{ike}.key_exchange', ipsec) != 'ikev2': | ||
| raise ConfigError( | ||
| f'Post-quantum preshared keys must be used with IKEv2! IKEv2 key-exchange not set in ike-group "{ike}".' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need this error at all? IKEv2 is enabled by default, so it will be fine for initiating connections. Not setting key exchange to IKEv2 explicitly will enable the peer to respond to IKEv1 connections, but will that not fail automatically if the local side demands post-quantum key exchange?
Change summary
Adds support for IKEv2 post-quantum preshared keys
Types of changes
Related Task(s)
https://vyos.dev/T8136
Related PR(s)
vyos/vyos-documentation#1733
How to test / Smoketest result
Checklist: