Skip to content

Commit f803ce1

Browse files
enoch85claude
andcommitted
sysutils/nextcloud-backup: add option to disable SSL verification
Adds an optional "Verify SSL certificate" checkbox to the Nextcloud backup settings, defaulting to enabled so existing behavior is preserved. When unchecked, CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST are disabled, allowing the plugin to back up to Nextcloud instances behind self-signed or otherwise untrusted certificates. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f16b0a5 commit f803ce1

4 files changed

Lines changed: 22 additions & 2 deletions

File tree

sysutils/nextcloud-backup/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PLUGIN_NAME= nextcloud-backup
2-
PLUGIN_VERSION= 1.2
2+
PLUGIN_VERSION= 1.3
33
PLUGIN_COMMENT= Track config changes using NextCloud
44

55
.include "../../Mk/plugins.mk"

sysutils/nextcloud-backup/pkg-descr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ strongly advise to not use a public service to send backups to.
66
Plugin Changelog
77
================
88

9+
1.3
10+
11+
* Add option to disable SSL certificate verification
12+
913
1.2
1014

1115
* Add option to upload to one file each day instead of syncing the contents of /conf/backup

sysutils/nextcloud-backup/src/opnsense/mvc/app/library/OPNsense/Backup/Nextcloud.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ public function getConfigurationFields()
7979
"help" => gettext("A password to encrypt your configuration"),
8080
"value" => null
8181
),
82+
array(
83+
"name" => "verify_ssl",
84+
"type" => "checkbox",
85+
"label" => gettext("Verify SSL certificate"),
86+
"help" => gettext("Uncheck to allow self-signed or otherwise untrusted certificates. " .
87+
"Only disable this if you trust the network path to the Nextcloud server."),
88+
"value" => null
89+
),
8290
array(
8391
"name" => "backupdir",
8492
"type" => "text",
@@ -691,6 +699,9 @@ public function curl_request_nothrow(
691699
$postdata = null,
692700
$headers = array("User-Agent: OPNsense Firewall")
693701
) {
702+
// verify_ssl defaults to '1' via the model definition (NextcloudSettings.xml),
703+
// so unset/upgraded configs verify by default; only an explicit '0' disables it
704+
$verify_ssl = (string)(new NextcloudSettings())->verify_ssl !== '0';
694705
$curl = curl_init();
695706
curl_setopt_array($curl, array(
696707
CURLOPT_URL => $url,
@@ -701,6 +712,8 @@ public function curl_request_nothrow(
701712
CURLOPT_TIMEOUT => 60, // maximum time: 1 min
702713
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
703714
CURLOPT_USERPWD => $username . ":" . $password,
715+
CURLOPT_SSL_VERIFYPEER => $verify_ssl,
716+
CURLOPT_SSL_VERIFYHOST => $verify_ssl ? 2 : 0,
704717
CURLOPT_HTTPHEADER => $headers
705718
));
706719
if ($postdata != null) {

sysutils/nextcloud-backup/src/opnsense/mvc/app/models/OPNsense/Backup/NextcloudSettings.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<model>
22
<mount>//system/backup/nextcloud</mount>
3-
<version>1.0.2</version>
3+
<version>1.0.3</version>
44
<description>OPNsense Nextcloud Backup Settings</description>
55
<items>
66
<enabled type="BooleanField">
@@ -43,6 +43,9 @@
4343
</Constraints>
4444
</password>
4545
<password_encryption type="UpdateOnlyTextField"/>
46+
<verify_ssl type="BooleanField">
47+
<Default>1</Default>
48+
</verify_ssl>
4649
<backupdir type="TextField">
4750
<Required>Y</Required>
4851
<Mask>/^([\w%+\-]+\/)*[\w+%\-]+$/</Mask>

0 commit comments

Comments
 (0)