Message ID | 20250401180802.19784-4-adolf.belka@ipfire.org |
---|---|
State | Staged |
Commit | 1fda10e584da6b99237c94aa4e652d97589c7df6 |
Headers |
Return-Path: <development+bounces-191-patchwork=ipfire.org@lists.ipfire.org> Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4ZRwwH4qV8z3xVv for <patchwork@web04.haj.ipfire.org>; Tue, 1 Apr 2025 18:08:15 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4ZRwwD0Pkfz5Lp for <patchwork@ipfire.org>; Tue, 1 Apr 2025 18:08:12 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4ZRwwC0c1Hz335n for <patchwork@ipfire.org>; Tue, 1 Apr 2025 18:08:11 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4ZRww80yg9z336t for <development@lists.ipfire.org>; Tue, 1 Apr 2025 18:08:08 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4ZRww76bCzzCD; Tue, 1 Apr 2025 18:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1743530888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hZLH0o3gmJLniD9moHpCUluSTG+aMDT/sTN8xoyfpB4=; b=Nb0BhrUR2j6WkoujjbLKL3dj7auD4qCzhSeEfUmQ1G875nKjeKjT9JR25xr2SfdPra+cCa uFuRj7p+SY2klFe83rqvA2DBY7m63bEt8XxIzDU48xVoLEYUilBhr5JyDuQEc2wq5yjvrz XA/ydYMlpIBNzgDnw+Iz27/rqBdd6yXA89GK7WGkWqDwfTtExqw3eAyMZVFCDTt+eHaG0Z K9xxme5faL0D5n8RJNp+89xV5FErR0c9cMQ1pJO+0PBCZVd/04KEPdlIbU5BvMGzUxU1Vn 2vfQiHWbRgwCjywsXnVZSpiQmU5h+wi0Swlhfe2HyXhK3oiv2qHk1I2gQnZ66w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1743530888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hZLH0o3gmJLniD9moHpCUluSTG+aMDT/sTN8xoyfpB4=; b=ssWK/twzamfl/ttkm9kM+2PrZPZ45t7G7XeFJ3eVp0JD3yyLv6vqj0J2qChUVN4po8Nh9j GvHsYf8Xe4KoR0Cw== From: Adolf Belka <adolf.belka@ipfire.org> To: development@lists.ipfire.org Cc: Adolf Belka <adolf.belka@ipfire.org> Subject: [PATCH 4/6] backup.pl: Fixes bug13737 - restarts ipsec to use the restored certs etc Date: Tue, 1 Apr 2025 20:08:00 +0200 Message-ID: <20250401180802.19784-4-adolf.belka@ipfire.org> In-Reply-To: <20250401180802.19784-1-adolf.belka@ipfire.org> References: <20250401180802.19784-1-adolf.belka@ipfire.org> Precedence: list List-Id: <development.lists.ipfire.org> List-Subscribe: <https://lists.ipfire.org/>, <mailto:development+subscribe@lists.ipfire.org?subject=subscribe> List-Unsubscribe: <https://lists.ipfire.org/>, <mailto:development+unsubscribe@lists.ipfire.org?subject=unsubscribe> List-Post: <mailto:development@lists.ipfire.org> List-Help: <mailto:development+help@lists.ipfire.org?subject=help> Sender: <development@lists.ipfire.org> Mail-Followup-To: <development@lists.ipfire.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit |
Series |
[1/6] vpnmain.cgi: Fixes bug13737 - remove unneeded &cleanssldatabase calls
|
|
Commit Message
Adolf Belka
April 1, 2025, 6:08 p.m. UTC
- This adds a check if the ipsec server is enabled. If it is then ipsecctrl is run to restart ipsec and ensure that the restored certs are all being used. - Tested this out on my vm testbed and confirmed that with this I could restore a backup and make the client connection as previously set up. - Without this I had to press the Save button on the ipsec WUI page to get the certs etc being used. Fixes: bug13737 Tested-by: Adolf Belka <adolf.belka@ipfire.org> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> --- config/backup/backup.pl | 3 +++ 1 file changed, 3 insertions(+)
Comments
Hi Tom, On 01/04/2025 21:00, Tom Rymes wrote: > I’m sure that this has been considered already, and Abigail’s is probably a better place to ask, but: Is there a warning of any type so that the user knows existing connections will be dropped, or is this only used in a situation where existing connections would not exist? I am not sure what "Abigail's" is a reference to. If you do a restore then currently the root/host certs and the client certs and the PSK secrets etc will all be replaced in the /var/ipfire/vpn/config and /var/ipfire/vpn/ipsec.secrets files anyway. So I have the feeling that you currently could also have a problem if you do a restore from an old backup which had different ipsec client connections. I am not sure that any existing connections would continue working currently if a backup was restored even if the ipsec daemon was not restarted. It was just that I found doing an x509 clearout and then doing the restore so all the client certs etc came back, did not give a system where the connections would work. I will try and find some time to see what happens if a restore on a non x509 cleared system replaces things with an old version but the server is not restarted. Do the existing client connections still work if they were already ongoing, and what happens if I try and newly connect with the previously working connection. The only alternative would be to not use that patch to do a restart but then after a restore has been done then none of the restored connections will work unless the user remembers to press the save button in the global section of the enabled ipsec wui page. That I definitely know, because I went through a period of restoring the backup and then having the connection from the client continuously failing to work until I though to try out pressing the Save button in the Global options section. We don't have to press any buttons for restores on any other WUI page so that doesn't seem consistent to me that it would need to be done for the ipsec page restore. > > I’m thinking of a PSK connection that would be reset if you restore certificates, perhaps? The PSK in the ipsec.secrets file will be replaced with whatever was in the backup being restored. That is the same for all of IPFire. It also happens with OpenVPN, where the existing certs will be cleared out and replaced with the new ones. I think the user needs to understand what version of backup they are restoring from and that there might be an interruption in service, in the same way as when doing an update and you have to do a reboot. All existing connections will be lost at that point. I will try and do some testing but I may not have time before I am going off travelling. Something does need to be done to fix this bug because currently if your host cert expires the renew function is not working properly and will fail and the only option there is to replace the root/host cert, which will also remove all the client connections based on certificates. The PSK connection will stay in place, although I am not sure if it still works with a new root/host x509 cert set or not. Having said all the above, I need to do a v2 version of this patch 4/6 anyway as I have just noticed that I didn't update the backup.pl with the final version I got working. The patch actually submitted won't work anyway. Regards, Adolf. > > Tom > > >> On Apr 1, 2025, at 2:08 PM, Adolf Belka <adolf.belka@ipfire.org> wrote: >> >> - This adds a check if the ipsec server is enabled. If it is then ipsecctrl is run to >> restart ipsec and ensure that the restored certs are all being used. >> - Tested this out on my vm testbed and confirmed that with this I could restore a backup >> and make the client connection as previously set up. >> - Without this I had to press the Save button on the ipsec WUI page to get the certs >> etc being used. >> >> Fixes: bug13737 >> Tested-by: Adolf Belka <adolf.belka@ipfire.org> >> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> >> --- >> config/backup/backup.pl | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/config/backup/backup.pl b/config/backup/backup.pl >> index 1c8c87d0a..a6d1467fd 100644 >> --- a/config/backup/backup.pl >> +++ b/config/backup/backup.pl >> @@ -307,6 +307,9 @@ restore_backup() { >> # start collectd after restore >> /etc/rc.d/init.d/collectd start >> >> + # Reload ipsec certificates and secrets after doing a restore >> + &General::system('/usr/local/bin/ipsecctrl', 'R'); >> + >> return 0 >> } >> >> -- >> 2.49.0 >> >>
Hi Tom, On 01/04/2025 22:44, Adolf Belka wrote: > Hi Tom, > > > On 01/04/2025 21:00, Tom Rymes wrote: >> I’m sure that this has been considered already, and Abigail’s is probably a better place to ask, but: Is there a warning of any type so that the user knows existing connections will be dropped, or is this only used in a situation where existing connections would not exist? > > I am not sure what "Abigail's" is a reference to. > > If you do a restore then currently the root/host certs and the client certs and the PSK secrets etc will all be replaced in the /var/ipfire/vpn/config and /var/ipfire/vpn/ipsec.secrets files anyway. So I have the feeling that you currently could also have a problem if you do a restore from an old backup which had different ipsec client connections. > > I am not sure that any existing connections would continue working currently if a backup was restored even if the ipsec daemon was not restarted. I have tested this and the old ipsec certificate connection kept on working, even though the restore had only a PSK connection and no certificate connection. So not doing a restart would leave the existing connections going but the connections that were restored would not work. So the question would be why do a restore if you don't intend to replace the existing connections. You don't need to do a restart on OpenVPN to be able to use the restored client connections. So if I don't do the ipsec restart, then users will need to remember that for IPSec, they have to manually restart the daemon to be able to access the restored connections, but not for OpenVPN. Seems a bit inconsistent with that approach. Would be good to get @Michaels input on this. Regards, Adolf. > > It was just that I found doing an x509 clearout and then doing the restore so all the client certs etc came back, did not give a system where the connections would work. > > I will try and find some time to see what happens if a restore on a non x509 cleared system replaces things with an old version but the server is not restarted. Do the existing client connections still work if they were already ongoing, and what happens if I try and newly connect with the previously working connection. > > The only alternative would be to not use that patch to do a restart but then after a restore has been done then none of the restored connections will work unless the user remembers to press the save button in the global section of the enabled ipsec wui page. That I definitely know, because I went through a period of restoring the backup and then having the connection from the client continuously failing to work until I though to try out pressing the Save button in the Global options section. > > We don't have to press any buttons for restores on any other WUI page so that doesn't seem consistent to me that it would need to be done for the ipsec page restore. > >> >> I’m thinking of a PSK connection that would be reset if you restore certificates, perhaps? > > The PSK in the ipsec.secrets file will be replaced with whatever was in the backup being restored. That is the same for all of IPFire. It also happens with OpenVPN, where the existing certs will be cleared out and replaced with the new ones. > > I think the user needs to understand what version of backup they are restoring from and that there might be an interruption in service, in the same way as when doing an update and you have to do a reboot. All existing connections will be lost at that point. > > I will try and do some testing but I may not have time before I am going off travelling. > > Something does need to be done to fix this bug because currently if your host cert expires the renew function is not working properly and will fail and the only option there is to replace the root/host cert, which will also remove all the client connections based on certificates. The PSK connection will stay in place, although I am not sure if it still works with a new root/host x509 cert set or not. > > Having said all the above, I need to do a v2 version of this patch 4/6 anyway as I have just noticed that I didn't update the backup.pl with the final version I got working. The patch actually submitted won't work anyway. > > Regards, > > Adolf. > >> >> Tom >> >> >>> On Apr 1, 2025, at 2:08 PM, Adolf Belka <adolf.belka@ipfire.org> wrote: >>> >>> - This adds a check if the ipsec server is enabled. If it is then ipsecctrl is run to >>> restart ipsec and ensure that the restored certs are all being used. >>> - Tested this out on my vm testbed and confirmed that with this I could restore a backup >>> and make the client connection as previously set up. >>> - Without this I had to press the Save button on the ipsec WUI page to get the certs >>> etc being used. >>> >>> Fixes: bug13737 >>> Tested-by: Adolf Belka <adolf.belka@ipfire.org> >>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> >>> --- >>> config/backup/backup.pl | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/config/backup/backup.pl b/config/backup/backup.pl >>> index 1c8c87d0a..a6d1467fd 100644 >>> --- a/config/backup/backup.pl >>> +++ b/config/backup/backup.pl >>> @@ -307,6 +307,9 @@ restore_backup() { >>> # start collectd after restore >>> /etc/rc.d/init.d/collectd start >>> >>> + # Reload ipsec certificates and secrets after doing a restore >>> + &General::system('/usr/local/bin/ipsecctrl', 'R'); >>> + >>> return 0 >>> } >>> >>> -- >>> 2.49.0 >>> >>> >
Adolf, I wouldn’t worry about any additional testing. So long as it’s obvious to the user that any established tunnels will be torn down and re-established, that’s all I was worried about. It sounds (as I suspected) as if the nature of the operation (restoring a backup) should make this obvious. Lastly, “Abagail” was just autocorrect’s fun way of changing “Bugzilla”, for whatever reason, so please disregard. Tom > On Apr 1, 2025, at 4:44 PM, Adolf Belka <adolf.belka@ipfire.org> wrote: > > Hi Tom, > > >> On 01/04/2025 21:00, Tom Rymes wrote: >> I’m sure that this has been considered already, and Abigail’s is probably a better place to ask, but: Is there a warning of any type so that the user knows existing connections will be dropped, or is this only used in a situation where existing connections would not exist? > > I am not sure what "Abigail's" is a reference to. > > If you do a restore then currently the root/host certs and the client certs and the PSK secrets etc will all be replaced in the /var/ipfire/vpn/config and /var/ipfire/vpn/ipsec.secrets files anyway. So I have the feeling that you currently could also have a problem if you do a restore from an old backup which had different ipsec client connections. > > I am not sure that any existing connections would continue working currently if a backup was restored even if the ipsec daemon was not restarted. > > It was just that I found doing an x509 clearout and then doing the restore so all the client certs etc came back, did not give a system where the connections would work. > > I will try and find some time to see what happens if a restore on a non x509 cleared system replaces things with an old version but the server is not restarted. Do the existing client connections still work if they were already ongoing, and what happens if I try and newly connect with the previously working connection. > > The only alternative would be to not use that patch to do a restart but then after a restore has been done then none of the restored connections will work unless the user remembers to press the save button in the global section of the enabled ipsec wui page. That I definitely know, because I went through a period of restoring the backup and then having the connection from the client continuously failing to work until I though to try out pressing the Save button in the Global options section. > > We don't have to press any buttons for restores on any other WUI page so that doesn't seem consistent to me that it would need to be done for the ipsec page restore. > >> I’m thinking of a PSK connection that would be reset if you restore certificates, perhaps? > > The PSK in the ipsec.secrets file will be replaced with whatever was in the backup being restored. That is the same for all of IPFire. It also happens with OpenVPN, where the existing certs will be cleared out and replaced with the new ones. > > I think the user needs to understand what version of backup they are restoring from and that there might be an interruption in service, in the same way as when doing an update and you have to do a reboot. All existing connections will be lost at that point. > > I will try and do some testing but I may not have time before I am going off travelling. > > Something does need to be done to fix this bug because currently if your host cert expires the renew function is not working properly and will fail and the only option there is to replace the root/host cert, which will also remove all the client connections based on certificates. The PSK connection will stay in place, although I am not sure if it still works with a new root/host x509 cert set or not. > > Having said all the above, I need to do a v2 version of this patch 4/6 anyway as I have just noticed that I didn't update the backup.pl with the final version I got working. The patch actually submitted won't work anyway. > > Regards, > > Adolf. > >> Tom >>>> On Apr 1, 2025, at 2:08 PM, Adolf Belka <adolf.belka@ipfire.org> wrote: >>> >>> - This adds a check if the ipsec server is enabled. If it is then ipsecctrl is run to >>> restart ipsec and ensure that the restored certs are all being used. >>> - Tested this out on my vm testbed and confirmed that with this I could restore a backup >>> and make the client connection as previously set up. >>> - Without this I had to press the Save button on the ipsec WUI page to get the certs >>> etc being used. >>> >>> Fixes: bug13737 >>> Tested-by: Adolf Belka <adolf.belka@ipfire.org> >>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> >>> --- >>> config/backup/backup.pl | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/config/backup/backup.pl b/config/backup/backup.pl >>> index 1c8c87d0a..a6d1467fd 100644 >>> --- a/config/backup/backup.pl >>> +++ b/config/backup/backup.pl >>> @@ -307,6 +307,9 @@ restore_backup() { >>> # start collectd after restore >>> /etc/rc.d/init.d/collectd start >>> >>> + # Reload ipsec certificates and secrets after doing a restore >>> + &General::system('/usr/local/bin/ipsecctrl', 'R'); >>> + >>> return 0 >>> } >>> >>> -- >>> 2.49.0 >>> >>> >
> On Apr 1, 2025, at 5:47 PM, Adolf Belka <adolf.belka@ipfire.org> wrote: <snip> > I have tested this and the old ipsec certificate connection kept on working, even though the restore had only a PSK connection and no certificate connection. > So not doing a restart would leave the existing connections going but the connections that were restored would not work. So the question would be why do a restore if you don't intend to replace the existing connections. The restart seems wise to me. My only concern was that the user should be aware that initiating the process will cause existing connections to be dropped. Perhaps this could be an explicit notice to the user, or perhaps that’s unneeded because it should be obvious. Tom
Hi Tom, On 01/04/2025 23:52, Tom Rymes wrote: > Adolf, > > I wouldn’t worry about any additional testing. So long as it’s obvious to the user that any established tunnels will be torn down and re-established, that’s all I was worried about. > > It sounds (as I suspected) as if the nature of the operation (restoring a backup) should make this obvious. > > Lastly, “Abagail” was just autocorrect’s fun way of changing “Bugzilla”, for whatever reason, so please disregard. LOL. I have suffered some of those on my phone but that one is a beauty. Regards, Adolf. > > Tom > >> On Apr 1, 2025, at 4:44 PM, Adolf Belka <adolf.belka@ipfire.org> wrote: >> >> Hi Tom, >> >> >>> On 01/04/2025 21:00, Tom Rymes wrote: >>> I’m sure that this has been considered already, and Abigail’s is probably a better place to ask, but: Is there a warning of any type so that the user knows existing connections will be dropped, or is this only used in a situation where existing connections would not exist? >> >> I am not sure what "Abigail's" is a reference to. >> >> If you do a restore then currently the root/host certs and the client certs and the PSK secrets etc will all be replaced in the /var/ipfire/vpn/config and /var/ipfire/vpn/ipsec.secrets files anyway. So I have the feeling that you currently could also have a problem if you do a restore from an old backup which had different ipsec client connections. >> >> I am not sure that any existing connections would continue working currently if a backup was restored even if the ipsec daemon was not restarted. >> >> It was just that I found doing an x509 clearout and then doing the restore so all the client certs etc came back, did not give a system where the connections would work. >> >> I will try and find some time to see what happens if a restore on a non x509 cleared system replaces things with an old version but the server is not restarted. Do the existing client connections still work if they were already ongoing, and what happens if I try and newly connect with the previously working connection. >> >> The only alternative would be to not use that patch to do a restart but then after a restore has been done then none of the restored connections will work unless the user remembers to press the save button in the global section of the enabled ipsec wui page. That I definitely know, because I went through a period of restoring the backup and then having the connection from the client continuously failing to work until I though to try out pressing the Save button in the Global options section. >> >> We don't have to press any buttons for restores on any other WUI page so that doesn't seem consistent to me that it would need to be done for the ipsec page restore. >> >>> I’m thinking of a PSK connection that would be reset if you restore certificates, perhaps? >> >> The PSK in the ipsec.secrets file will be replaced with whatever was in the backup being restored. That is the same for all of IPFire. It also happens with OpenVPN, where the existing certs will be cleared out and replaced with the new ones. >> >> I think the user needs to understand what version of backup they are restoring from and that there might be an interruption in service, in the same way as when doing an update and you have to do a reboot. All existing connections will be lost at that point. >> >> I will try and do some testing but I may not have time before I am going off travelling. >> >> Something does need to be done to fix this bug because currently if your host cert expires the renew function is not working properly and will fail and the only option there is to replace the root/host cert, which will also remove all the client connections based on certificates. The PSK connection will stay in place, although I am not sure if it still works with a new root/host x509 cert set or not. >> >> Having said all the above, I need to do a v2 version of this patch 4/6 anyway as I have just noticed that I didn't update the backup.pl with the final version I got working. The patch actually submitted won't work anyway. >> >> Regards, >> >> Adolf. >> >>> Tom >>>>> On Apr 1, 2025, at 2:08 PM, Adolf Belka <adolf.belka@ipfire.org> wrote: >>>> >>>> - This adds a check if the ipsec server is enabled. If it is then ipsecctrl is run to >>>> restart ipsec and ensure that the restored certs are all being used. >>>> - Tested this out on my vm testbed and confirmed that with this I could restore a backup >>>> and make the client connection as previously set up. >>>> - Without this I had to press the Save button on the ipsec WUI page to get the certs >>>> etc being used. >>>> >>>> Fixes: bug13737 >>>> Tested-by: Adolf Belka <adolf.belka@ipfire.org> >>>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> >>>> --- >>>> config/backup/backup.pl | 3 +++ >>>> 1 file changed, 3 insertions(+) >>>> >>>> diff --git a/config/backup/backup.pl b/config/backup/backup.pl >>>> index 1c8c87d0a..a6d1467fd 100644 >>>> --- a/config/backup/backup.pl >>>> +++ b/config/backup/backup.pl >>>> @@ -307,6 +307,9 @@ restore_backup() { >>>> # start collectd after restore >>>> /etc/rc.d/init.d/collectd start >>>> >>>> + # Reload ipsec certificates and secrets after doing a restore >>>> + &General::system('/usr/local/bin/ipsecctrl', 'R'); >>>> + >>>> return 0 >>>> } >>>> >>>> -- >>>> 2.49.0 >>>> >>>> >> >
I call things wrong all of the time, and I am very sure it is not me, but auto-correct. It happens, but this one was indeed a riddle that was very hard to solve. > On 2 Apr 2025, at 11:24, Adolf Belka <adolf.belka@ipfire.org> wrote: > > Hi Tom, > > On 01/04/2025 23:52, Tom Rymes wrote: >> Adolf, >> I wouldn’t worry about any additional testing. So long as it’s obvious to the user that any established tunnels will be torn down and re-established, that’s all I was worried about. >> It sounds (as I suspected) as if the nature of the operation (restoring a backup) should make this obvious. >> Lastly, “Abagail” was just autocorrect’s fun way of changing “Bugzilla”, for whatever reason, so please disregard. > > LOL. I have suffered some of those on my phone but that one is a beauty. > > Regards, > > Adolf. > >> Tom >>> On Apr 1, 2025, at 4:44 PM, Adolf Belka <adolf.belka@ipfire.org> wrote: >>> >>> Hi Tom, >>> >>> >>>> On 01/04/2025 21:00, Tom Rymes wrote: >>>> I’m sure that this has been considered already, and Abigail’s is probably a better place to ask, but: Is there a warning of any type so that the user knows existing connections will be dropped, or is this only used in a situation where existing connections would not exist? >>> >>> I am not sure what "Abigail's" is a reference to. >>> >>> If you do a restore then currently the root/host certs and the client certs and the PSK secrets etc will all be replaced in the /var/ipfire/vpn/config and /var/ipfire/vpn/ipsec.secrets files anyway. So I have the feeling that you currently could also have a problem if you do a restore from an old backup which had different ipsec client connections. >>> >>> I am not sure that any existing connections would continue working currently if a backup was restored even if the ipsec daemon was not restarted. >>> >>> It was just that I found doing an x509 clearout and then doing the restore so all the client certs etc came back, did not give a system where the connections would work. >>> >>> I will try and find some time to see what happens if a restore on a non x509 cleared system replaces things with an old version but the server is not restarted. Do the existing client connections still work if they were already ongoing, and what happens if I try and newly connect with the previously working connection. >>> >>> The only alternative would be to not use that patch to do a restart but then after a restore has been done then none of the restored connections will work unless the user remembers to press the save button in the global section of the enabled ipsec wui page. That I definitely know, because I went through a period of restoring the backup and then having the connection from the client continuously failing to work until I though to try out pressing the Save button in the Global options section. >>> >>> We don't have to press any buttons for restores on any other WUI page so that doesn't seem consistent to me that it would need to be done for the ipsec page restore. >>> >>>> I’m thinking of a PSK connection that would be reset if you restore certificates, perhaps? >>> >>> The PSK in the ipsec.secrets file will be replaced with whatever was in the backup being restored. That is the same for all of IPFire. It also happens with OpenVPN, where the existing certs will be cleared out and replaced with the new ones. >>> >>> I think the user needs to understand what version of backup they are restoring from and that there might be an interruption in service, in the same way as when doing an update and you have to do a reboot. All existing connections will be lost at that point. >>> >>> I will try and do some testing but I may not have time before I am going off travelling. >>> >>> Something does need to be done to fix this bug because currently if your host cert expires the renew function is not working properly and will fail and the only option there is to replace the root/host cert, which will also remove all the client connections based on certificates. The PSK connection will stay in place, although I am not sure if it still works with a new root/host x509 cert set or not. >>> >>> Having said all the above, I need to do a v2 version of this patch 4/6 anyway as I have just noticed that I didn't update the backup.pl with the final version I got working. The patch actually submitted won't work anyway. >>> >>> Regards, >>> >>> Adolf. >>> >>>> Tom >>>>>> On Apr 1, 2025, at 2:08 PM, Adolf Belka <adolf.belka@ipfire.org> wrote: >>>>> >>>>> - This adds a check if the ipsec server is enabled. If it is then ipsecctrl is run to >>>>> restart ipsec and ensure that the restored certs are all being used. >>>>> - Tested this out on my vm testbed and confirmed that with this I could restore a backup >>>>> and make the client connection as previously set up. >>>>> - Without this I had to press the Save button on the ipsec WUI page to get the certs >>>>> etc being used. >>>>> >>>>> Fixes: bug13737 >>>>> Tested-by: Adolf Belka <adolf.belka@ipfire.org> >>>>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> >>>>> --- >>>>> config/backup/backup.pl | 3 +++ >>>>> 1 file changed, 3 insertions(+) >>>>> >>>>> diff --git a/config/backup/backup.pl b/config/backup/backup.pl >>>>> index 1c8c87d0a..a6d1467fd 100644 >>>>> --- a/config/backup/backup.pl >>>>> +++ b/config/backup/backup.pl >>>>> @@ -307,6 +307,9 @@ restore_backup() { >>>>> # start collectd after restore >>>>> /etc/rc.d/init.d/collectd start >>>>> >>>>> + # Reload ipsec certificates and secrets after doing a restore >>>>> + &General::system('/usr/local/bin/ipsecctrl', 'R'); >>>>> + >>>>> return 0 >>>>> } >>>>> >>>>> -- >>>>> 2.49.0 >>>>> >>>>> >>> > >
diff --git a/config/backup/backup.pl b/config/backup/backup.pl index 1c8c87d0a..a6d1467fd 100644 --- a/config/backup/backup.pl +++ b/config/backup/backup.pl @@ -307,6 +307,9 @@ restore_backup() { # start collectd after restore /etc/rc.d/init.d/collectd start + # Reload ipsec certificates and secrets after doing a restore + &General::system('/usr/local/bin/ipsecctrl', 'R'); + return 0 }