Commit Graph

192 Commits

Author SHA1 Message Date
Peter Müller
818dde8e8b IPsec/OpenVPN: Use 4,096-bit RSA for host certificates as well
We already moved away from 2048-MODP in Core Update 170. Similarly,
German Federal Office for Information Security (BSI) recommends shifting
away from RSA keys below 3,000 bits by the end of 2022 at the latest.

The only place left in IPFire 2.x where we generate such keys is for
IPsec and OpenVPN host certificates. This patch increases their key
sizes to 4,096 bits as well - CA certificates already have this length.

Existing VPN connections cannot be migrated automatically. However, only
the respective host certificate has to be regenerated - thanks to the CA
certificates' key length being sufficient, there is no need to replace
the entire VPN CA.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
2022-11-03 16:49:51 +00:00
Michael Tremer
69d4453e08 IPsec: Enable ECP-521/384 by default for new connections
https://lists.ipfire.org/pipermail/development/2022-August/014129.html

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Acked-by: Peter Müller <peter.mueller@ipfire.org>
2022-08-11 18:32:27 +00:00
Peter Müller
46803376d5 vpnmain.cgi: Mark MODP-1536 as broken, phase out MODP-2048
https://weakdh.org/imperfect-forward-secrecy-ccs15.pdf (released in
2015) recommends "to use primes of 2048 bits or larger", to which BSI's
techical guideline BSI-TR-02102 (https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Publikationen/TechnischeRichtlinien/TR02102/BSI-TR-02102.pdf?__blob=publicationFile&v=5)
concurs. The latter also recommends not to use DH groups comprising of
less than 2000 bits after 2022, and shift to 3000 bit DH groups earlier
as a precaution.

According to RFC 3526, section 8, MODP-1536 provides an estimated
security between 90 and 120 bits, a value that can be reasonably
considered broken today, as it has been so for other types of
cryptographic algorithms already, and per section 2.4 in the
aforementioned paper, breaking 1024-bit DH is considered feasible for
the NSA in 2015, which does not inspire confidence for MODP-1536 in
2022.

Therefore, this patch suggests to mark MODP-1536 as broken, since it
de facto is, and tag MODP-2048 as weak. The latter is also removed from
the default selection, so newly created VPN connections won't use it
anymore, to follow BSI's recommendations of using DH groups >= 3000 bits
in 2022 and later.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Acked-by: Michael Tremer <michael.tremer@ipfire.org>
2022-08-11 18:30:49 +00:00
Michael Tremer
59dc2a4c47 vpnmain.cgi: Select Curve 25519 as default
This was supposed to be enabled by default. Due to a copy-and-paste
error, it was, however, not selected for IKE, but only for ESP.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-23 15:53:46 +00:00
Stefan Schantl
f8384fbf8d vpnmain.cgi: Fix extra whitespace in exported pk12 file
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2022-01-04 18:06:12 +01:00
Michael Tremer
85d5f26fa9 ipsec: Prefer curve448 over curve25519
Curve448 provides better cryptographic security. For more details see:

  https://bugzilla.ipfire.org/show_bug.cgi?id=12634

Fixes: #12634
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-11-24 09:14:52 +00:00
Stefan Schantl
b5b19f370d vpnmain.cgi: Do not interpret $? as error code of move()
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-09-10 16:57:06 +00:00
Michael Tremer
aec1c53cf1 IPsec: Do not interpret $? as error code of move()
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-09-10 16:57:06 +00:00
Michael Tremer
6688e0bc7a IPsec: Fix extra whitespace in exported certificates
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-09-10 16:57:06 +00:00
Michael Tremer
c64dc3bef5 vpnmain.cgi: Join certificate output before &Header::cleanhtml();
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-07-13 15:33:49 +00:00
Michael Tremer
b71a7fb97d Partially revert "vpnmain.cgi: Use new system methods"
This reverts commit a81cbf6127.

It was no longer possible to generate the root/host certificates.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-07-13 15:33:42 +00:00
Stefan Schantl
016859ffe4 vpnmain.cgi: Fix typo.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-06-21 17:16:41 +00:00
Michael Tremer
46443100e0 Merge branch 'perl-system' into next 2021-06-17 20:11:47 +00:00
Stefan Schantl
a81cbf6127 vpnmain.cgi: Use new system methods
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-06-17 20:11:37 +00:00
Michael Tremer
7f6620986c ipsec: Prefer curve448 over curve25519
Curve448 provides better cryptographic security. For more details see:

  https://bugzilla.ipfire.org/show_bug.cgi?id=12634

Fixes: #12634
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-06-14 13:29:09 +00:00
Michael Tremer
d22c7c1062 vpnmain.cgi: Use new perl system functions
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-06-10 15:23:52 +01:00
Michael Tremer
08fa1272d2 Revert "IPsec: Ensure that iOS VPNs are always connected"
This reverts commit 8ce6222a10.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-20 09:26:13 +00:00
Michael Tremer
db33a1220a IPsec: Add CA certificate in Apple profile
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
9326f51c24 Revert "IPsec: Apple: Stop prompting for credentials"
This reverts commit eef4cd4b101da0c7ceab0c3386ad755ed242f8d5.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
1108156c39 IPsec: Strip @ from IDs in Apple profile
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
8ce6222a10 IPsec: Ensure that iOS VPNs are always connected
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
839183d8b8 IPsec: Set display name for VPN connections
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
9f3742222a IPsec: Always send our host certificate to all RW clients
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
dccd7e874b IPsec: Allow sending DNS server addresses to RW clients
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
5b2e16dde2 IPsec: Apple: Stop prompting for credentials
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
2d7b3347ca IPsec: Apple: Add desired cipher suites to profiles
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
b75d92100c IPsec: Apple: Enable PFS on client when enabled
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
f356736432 vpnmain.cgi: Fix indentation on Apple profiles
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
c7fe09c6ad vpnmain.cgi: Add field for roadwarrior endpoint
This is the IP address or FQDN which will be written into
Apple Configuration profiles as public peer address.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
205c3c17c6 vpnmain.cgi: Generate random UUIDs
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:27:04 +00:00
Michael Tremer
26a0befd75 IPsec: Add prototype to export Apple Configuration profiles
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:21:00 +00:00
Michael Tremer
926e5519a6 IPsec: Use sane defaults for certificate lifetimes
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-05 11:20:22 +00:00
Jonatan Schlag
8186b37230 Hardcode theme to ipfire
This disables the theme support and makes it impossible to use any other
themes than the ipfire default theme.

The only intention of this patch is to hardcode the theme to ipfire.
To change any cgi we have is an ugly way, but the only way to do this
fast. The colour handling needs certainly to be improved as well, but
this will and should be done in other patches.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-04-08 10:11:34 +00:00
Michael Tremer
1f3f2d676e IPsec: Fix showing tunnels as connecting when they are established
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-10-27 18:38:03 +00:00
Michael Tremer
b45faf9e70 IPsec: Bring down connections after reloading configuration
It could happen that the remote peer re-established the connection
before "ipsec reload" removed it from the daemon.

Now, we write the configuration files first, reload them
and then bring down any connections that are still established.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-09-24 17:36:38 +00:00
Arne Fitzenreiter
81ebfac70d vpnmain.cgi: fix string
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-03-30 17:25:08 +00:00
Michael Tremer
610108ffbd Fix accidentially reverted IKE lifetime limit to 24 hours
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-03-30 17:21:25 +00:00
Peter Müller
993724b4dd vpnmain.cgi: set SubjectAlternativeName default during root certificate generation
Some IPsec implementations such as OpenIKED require SubjectAlternativeName
data on certificates and refuse to establish connections otherwise.

The StrongSwan project also recommends it (see:
https://wiki.strongswan.org/projects/strongswan/wiki/SimpleCA) although
it is currently not enforced by their IPsec software.

For convenience purposes and to raise awareness, this patch adds a default
SubjectAlternativeName based on the machines hostname or IP address. Existing
certificates remain unchanged for obvious reasons.

The third version of this patch fixes a duplicate DNS query reported by Michael.

Fixes #11594

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Cc: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-01-11 14:15:28 +00:00
Michael Tremer
2ad1b18bdb vpnmain.cgi+ovpnmain.cgi: Fix file upload with new versions of Perl
File uploads did not work since Perl was upgraded. This patch
fixes that problem by only checking if an object was returned
instead of performing a string comparison.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-10-14 18:10:20 +00:00
Michael Tremer
d47b2cc28b IPsec: Add support for Curve448
This is supported since strongswan 5.7.2 and is a good alternative
to Curve25519 because Curve448 is almost equally secure but performs
faster.

  https://en.wikipedia.org/wiki/Curve448

This is enabled by default although we do not expect many other
implementations to be able to support this.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-10-08 18:53:23 +00:00
Peter Müller
0dd16f4047 vpnmain.cgi: Fix writing ESP settings for PFS ciphers
The changes introduced due to #12091 caused IPsec ESP
to be invalid if PFS ciphers were selected. Code has
to read "!$pfs" instead of just "$pfs", as it should trigger
for ciphers _without_ Perfect Forward Secrecy.

Fixes #12099

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Cc: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-06-17 16:14:27 +01:00
Arne Fitzenreiter
faec909e1a vpnmain.cgi: remove wrongh "shift-space"
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-06-15 17:38:47 +02:00
Michael Tremer
745915d82c vpnmain.cgi: Fix wrong cipher suite generation when PFS is disabled
Fixes: #12091
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-06-05 05:07:27 +01:00
Michael Tremer
ab79dc43bf vpnmain.cgi: Set MTU to a default when editing an old connection
This field is required and therefore we need to initialize it
for old connections. Right now, the CGI throws an error message
when editing an existing connection without the MTU being filled
in.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-04 11:53:11 +01:00
Michael Tremer
71a355c3a2 Merge branch 'ipsec-on-demand' into next 2019-03-05 15:25:36 +00:00
Michael Tremer
b15b70bc6b vpnmain.cgi: Make on-demand mode default for IPsec VPNs
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-03-05 15:24:19 +00:00
Michael Tremer
eb09c90ef4 vpnmain.cgi: Carry over START_ACTION attribute correctly
This setting was not carried correctly and therefore the default was ignored.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-03-05 15:23:33 +00:00
Michael Tremer
38f6bdb740 ipsec: Drop delayed restart setting
This is a very bad race-condition situation and is not solved by
an unintuitive setting.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-02-04 18:20:36 +00:00
Michael Tremer
517683eeb1 ipsec: Drop VPN_IP setting
This is now a per-connection setting

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-02-04 18:20:36 +00:00
Michael Tremer
ae0d069827 ipsec: Allow to select local IP address used for peer on UI
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-02-04 18:20:36 +00:00