* Fri Jun 13 2025 Brian Read <brianr@koozali.org> 11.0.0-91.sme

- Port Forwarding  - Same error as in local networking [SME: 13043]
This commit is contained in:
2025-06-13 17:04:22 +01:00
parent dcc098b206
commit 0733537064
5 changed files with 119 additions and 124 deletions

View File

@@ -1,16 +1,13 @@
'pf_FORM_TITLE' => 'Configure Port Forwarding',
'pf_FIRST_PAGE_DESCRIPTION' => '<p>
You can use this panel to modify your firewall rules so
'pf_FIRST_PAGE_DESCRIPTION' => 'You can use this panel to modify your firewall rules so
as to open a specific port on this server and forward it
to another port on another host. Doing so will permit
incoming traffic to directly access a private host on
your LAN.
</p><p>
WARNING: Misuse of this feature can seriously compromise the
security of your network. Do not use this feature
lightly, or without fully understanding the implications
of your actions.
</p>',
of your actions.',
'pf_CREATE_RULE' => 'Create portforwarding rule',
'pf_SUMMARY_ADD_DESC' => 'The following summarizes the port-forwarding rule
that you are about to add. If you are satisfied with the rule,
@@ -22,13 +19,13 @@
port-forwarding rules installed on this server. Click on the
\'Remove\' link to remove the corresponding rule.',
'pf_NO_FORWARDS' => 'There are currently no forwarded ports on the system.',
'pf_CREATE_PAGE_DESCRIPTION' => '<p>Select the protocol, the port you wish to forward, the
'pf_CREATE_PAGE_DESCRIPTION' => 'Select the protocol, the port you wish to forward, the
destination host, and the port on the destination host
that you wish to forward to. If you wish to specify a port
range, enter the lower and upper boundaries separated by a
hyphen. The destination port may be left blank, which will
instruct the firewall to leave the source port
unaltered.</p>',
unaltered',
'pf_LABEL_SOURCE_PORT' => 'Source Port(s)',
'pf_LABEL_PROTOCOL' => 'Protocol',
'pf_LABEL_DESTINATION_PORT' => 'Destination Port(s)',
@@ -53,4 +50,4 @@
'pf_ERR_BADAHOST' => 'This does not appear to be a valid IP address list.
ie: 192.168.0.1,192.168.1.1/24',
'pf_IN_SERVERONLY' => 'This server is currently in serveronly mode and portforwarding
is possible only to localhost.',
is possible only to localhost.',

View File

@@ -1,40 +1,37 @@
<div id='pf_add'>
% my $retref= $c->stash("ret");
% my %ret;
% unless (length($retref)) {%ret = (ret=>"");}
% else {%ret = %$retref;}
% my @vars = split(",",$ret{vars});
% my $var1 = @vars[0];
% my $var2 = @vars[1];
% my $var3 = @vars[2];
% my $var4 = @vars[3];
% my $var5 = @vars[4];
% my $var6 = @vars[5];
% my %ret = $retref ? %$retref : (ret => "");
% my @vars = split(/,/, $ret{vars} // '');
% my ($var1, $var2, $var3, $var4, $var5, $var6, $var7) = @vars;
% if ($c->app->config->{debug}) {
<pre>
%= dumper { ret_data => \%ret }
</pre>
% }
% if ($ret{ret} eq "") {
% } elsif (index($ret{ret},"SUCCESS") != -1) {
<br>
%if ($ret{'ret'} eq "") {
%} elsif (index($ret{ret},"SUCCESS") != -1) {
<div class='success'>
<!--<h2> Operation Status Report</h2>-->
%= $c->l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6);
</div>
%} else {
<div class='sme-error'>
<!--<h2> Operation Status Report - Error</h2>-->
%= $c->l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6);
</div>
%}
<div class='success'>
%= $c->render_to_string(inline => l($ret{ret}, @vars[0..6]))
</div>
% } else {
<br>
<div class='sme-error'>
%= $c->render_to_string(inline => l($ret{ret}, @vars[0..6]))
</div>
% }
<br />
% my $btn = l('ADD');
% if (config->{debug} == 1) {
<p>
</pre>
%= dumper $c->current_route
%= dumper $c->stash("ret")
</p>
</pre>
% }
%= form_for '/portforwardingb' => (method => 'POST') => begin

View File

@@ -9,11 +9,11 @@
% my $allow = $pf_datas->{allow};
% if (config->{debug} == 1) {
<p>
<pre>
%= dumper $c->current_route
%= dumper $c->stash("ret")
%= dumper %$pf_datas
</p>
</pre>
% }
%= form_for '/portforwardinge' => (method => 'POST') => begin
@@ -63,4 +63,4 @@
%end
</div>
</div>

View File

@@ -2,37 +2,35 @@
% my $btn = l('pf_CREATE_RULE');
%= form_for '/portforwardinga' => (method => 'POST') => begin
% my $retref= $c->stash("ret");
% my %ret;
% unless (length($retref)) {%ret = (ret=>"");}
% else {%ret = %$retref;}
% my $numtcpforwards = @$tcpforwards;
% my $numudpforwards = @$udpforwards;
% my @vars = split(",",$ret{vars});
% my $var1 = @vars[0];
% my $var2 = @vars[1];
% my $var3 = @vars[2];
% my $var4 = @vars[3];
% my $var5 = @vars[4];
% my $var6 = @vars[5];
% my $retref= $c->stash("ret");
% my %ret = $retref ? %$retref : (ret => "");
% my @vars = split(/,/, $ret{vars} // '');
% my ($var1, $var2, $var3, $var4, $var5, $var6, $var7) = @vars;
% if ($c->app->config->{debug}) {
<pre>
%= dumper { ret_data => \%ret }
</pre>
% }
% if ($ret{ret} eq "") {
%=l "pf_FIRST_PAGE_DESCRIPTION"
% } elsif (index($ret{ret},"SUCCESS") != -1) {
<br>
<div class='success'>
%= $c->render_to_string(inline => l($ret{ret}, @vars[0..6]))
</div>
% } else {
<br>
<div class='sme-error'>
%= $c->render_to_string(inline => l($ret{ret}, @vars[0..6]))
</div>
% }
<br />
%if ($ret{ret} eq "") {
%= $c->render_to_string(inline => l('pf_FIRST_PAGE_DESCRIPTION'));
%} elsif (index($ret{ret},"SUCCESS") != -1) {
<br>
<div class='success'>
<!--<h2> Operation Status Report</h2>-->
%= $c->l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6);
</div>
%} else {
<br>
<div class='sme-error'>
<!--<h2> Operation Status Report - Error</h2>-->
%= $c->l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6);
</div>
%}
<p>
<br>
@@ -69,7 +67,7 @@
<th class='sme-border'>
%=l 'pf_RULE_COMMENT'
</th>
<th class='sme-border' '>
<th class='sme-border'>
%=l 'ACTION'
</th>
</tr>