Skip to content

Commit 12aa4f9

Browse files
net/cloudflared: replace sysctl JS warning with AbstractStatus banner
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3a6cb1c commit 12aa4f9

3 files changed

Lines changed: 56 additions & 51 deletions

File tree

net/cloudflared/src/opnsense/mvc/app/controllers/OPNsense/Cloudflared/Api/SettingsController.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,4 @@ class SettingsController extends ApiMutableModelControllerBase
3434
{
3535
protected static $internalModelClass = '\OPNsense\Cloudflared\Cloudflared';
3636
protected static $internalModelName = 'cloudflared';
37-
38-
public function sysctlCheckAction()
39-
{
40-
$checks = [
41-
'kern.ipc.maxsockbuf' => 16777216,
42-
'net.inet.udp.recvspace' => 8388608,
43-
];
44-
$result = [];
45-
foreach ($checks as $key => $minimum) {
46-
$value = intval(trim(shell_exec('sysctl -n ' . escapeshellarg($key) . ' 2>/dev/null')));
47-
$result[$key] = ['value' => $value, 'minimum' => $minimum, 'ok' => $value >= $minimum];
48-
}
49-
return $result;
50-
}
5137
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
/*
4+
* Copyright (C) 2026 Richard Aspden <rick+github@insanityinside.net>
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
*
13+
* 2. Redistributions in binary form must reproduce the above copyright
14+
* notice, this list of conditions and the following disclaimer in the
15+
* documentation and/or other materials provided with the distribution.
16+
*
17+
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18+
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19+
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20+
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21+
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
29+
namespace OPNsense\System\Status;
30+
31+
use OPNsense\System\AbstractStatus;
32+
use OPNsense\System\SystemStatusCode;
33+
34+
class CloudflaredStatus extends AbstractStatus
35+
{
36+
public function __construct()
37+
{
38+
$this->internalPriority = 2;
39+
$this->internalPersistent = true;
40+
$this->internalIsBanner = true;
41+
$this->internalTitle = gettext('Cloudflare Tunnel');
42+
$this->internalScope = [
43+
'/ui/cloudflared/'
44+
];
45+
}
46+
47+
public function collectStatus()
48+
{
49+
$this->internalMessage = gettext(
50+
'Cloudflare Tunnel traffic bypasses OPNsense firewall rules; access control must be enforced in ' .
51+
'Cloudflare Access. For optimal QUIC performance, set the recommended kernel tunables. ' .
52+
'See the plugin documentation for details.'
53+
);
54+
$this->internalStatus = SystemStatusCode::NOTICE;
55+
}
56+
}

net/cloudflared/src/opnsense/mvc/app/views/OPNsense/Cloudflared/index.volt

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,9 @@
2626

2727
<script>
2828
$(document).ready(function() {
29-
function updateSysctlWarning() {
30-
var protocol = $("#cloudflared\\.general\\.protocol").val();
31-
if (protocol !== 'auto' && protocol !== 'quic') {
32-
$("#sysctl_warning").hide();
33-
return;
34-
}
35-
ajaxCall("/api/cloudflared/settings/sysctlCheck", {}, function(data) {
36-
var issues = [];
37-
$.each({'kern.ipc.maxsockbuf': 16777216, 'net.inet.udp.recvspace': 8388608}, function(key, min) {
38-
if (data[key] && !data[key].ok) {
39-
issues.push(key + " {{ lang._('(current:') }} " + data[key].value +
40-
"{{ lang._(', recommended: ≥') }} " + min + ")");
41-
}
42-
});
43-
if (issues.length > 0) {
44-
$("#sysctl_issues").html(issues.join("<br>"));
45-
$("#sysctl_warning").show();
46-
} else {
47-
$("#sysctl_warning").hide();
48-
}
49-
});
50-
}
51-
5229
mapDataToFormUI({'frm_GeneralSettings': "/api/cloudflared/settings/get"}).done(function() {
5330
$('.selectpicker').selectpicker('refresh');
5431
updateServiceControlUI('cloudflared');
55-
updateSysctlWarning();
56-
});
57-
58-
$("#cloudflared\\.general\\.protocol").on('change', function() {
59-
updateSysctlWarning();
6032
});
6133

6234
$("#reconfigureAct").SimpleActionButton({
@@ -71,15 +43,6 @@ $(document).ready(function() {
7143

7244
<div class="content-box">
7345
{{ partial('layout_partials/base_form', ['fields': general, 'id': 'frm_GeneralSettings']) }}
74-
<div id="sysctl_warning" class="alert alert-warning" role="alert" style="margin: 10px; display: none;">
75-
{{ lang._("QUIC performance: the following UDP buffer sysctl(s) are below the recommended values. Set them under") }}
76-
<a href="/ui/core/tunables">{{ lang._("System > Settings > Tuneables") }}</a>
77-
{{ lang._("for optimal tunnel throughput.") }}
78-
<br><span id="sysctl_issues"></span>
79-
</div>
80-
<div class="alert alert-warning" role="alert" style="margin: 10px;">
81-
{{ lang._("Traffic received via the Cloudflare Tunnel bypasses OPNsense firewall rules. Access control for tunnelled services must be enforced within Cloudflare Access. Backend services must also be reachable from the router's own IP address, as cloudflared forwards connections from the router itself.") }}
82-
</div>
8346
</div>
8447

8548
{{ partial('layout_partials/base_apply_button', {'data_endpoint': '/api/cloudflared/service/reconfigure', 'data_service_widget': 'cloudflared'}) }}

0 commit comments

Comments
 (0)