Allow TLS key to be selectd for a port

This commit is contained in:
Jamie Cameron 2025-04-27 17:22:28 -07:00
parent 6743d3b4c6
commit 723e169905
3 changed files with 22 additions and 4 deletions

View File

@ -30,10 +30,19 @@ my $ltable = &ui_radio("listen_def", @listen ? 0 : 1,
my @table = ( );
push(@listen, { });
my @tls = map { $_->{'values'}->[0] } &find("tls", $conf);
for(my $i=0; $i<@listen; $i++) {
my $l = $listen[$i];
my $port = $l->{'value'} eq 'port' ?
$l->{'values'}->[1] : undef;
my $v = $l->{'values'} || [];
my ($port, $tls);
for(my $j=0; $j<@$v; $j++) {
if ($v->[$j] eq "port") {
$port = $v->[++$j];
}
if ($v->[$j] eq "tls") {
$tls = $v->[++$j];
}
}
my @vals = map { $_->{'name'} } @{$l->{'members'}};
push(@table, [
&ui_select("proto_$i",
@ -45,11 +54,15 @@ for(my $i=0; $i<@listen; $i++) {
&ui_radio("pdef_$i", $port ? 0 : 1,
[ [ 1, $text{'default'} ],
[ 0, &ui_textbox("port_$i", $port, 5) ] ]),
@tls ? ( &ui_select("tls_$i", $tls, [ '', @tls ]) ) : ( ),
&ui_textbox("addrs_$i", join(" ", @vals), 50),
]);
}
$ltable .= &ui_columns_table(
[ $text{'net_proto'}, $text{'net_port'}, $text{'net_addrs'} ],
[ $text{'net_proto'},
$text{'net_port'},
@tls ? ( $text{'net_tls'} ) : ( ),
$text{'net_addrs'} ],
undef,
\@table,
undef,

View File

@ -733,6 +733,7 @@ net_ip=IP address
net_sport=Source port for queries
net_port=Port number
net_proto=Protocol
net_tls=SSL Key
net_none=&lt;None&gt;
net_topol=Nameserver choice topology
net_recur=Allow recursive queries from

View File

@ -24,11 +24,15 @@ if (!$in{'listen_def'}) {
next if (!$in{"proto_$i"});
my $l = { 'name' => $in{"proto_$i"} eq 'v6' ?
'listen-on-v6' : 'listen-on',
'values' => [ ],
'type' => 1 };
if (!$in{"pdef_$i"}) {
$in{"port_$i"} =~ /^\d+$/ ||
&error(&text('net_eport', $in{"port_$i"}));
$l->{'values'} = [ 'port', $in{"port_$i"} ];
push(@{$l->{'values'}}, 'port', $in{"port_$i"});
}
if ($in{"tls_$i"}) {
push(@{$l->{'values'}}, 'tls', $in{"tls_$i"});
}
my $port = $in{"pdef_$i"} ? 53 : $in{"port_$i"};
$used{$port,$l->{'name'}}++ &&