mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-02-18 03:10:47 +01:00
KASM-3542 new yaml options http-header, stun server
This commit is contained in:
parent
d9b5b5db6a
commit
bd8b6d522a
3
spec/fixtures/defaults_config.yaml
vendored
3
spec/fixtures/defaults_config.yaml
vendored
@ -73,9 +73,10 @@ encoding:
|
|||||||
hextile_improved_compression: true
|
hextile_improved_compression: true
|
||||||
|
|
||||||
server:
|
server:
|
||||||
|
http:
|
||||||
|
httpd_directory: /usr/share/kasmvnc/www
|
||||||
advanced:
|
advanced:
|
||||||
x_font_path: auto
|
x_font_path: auto
|
||||||
httpd_directory: /usr/share/kasmvnc/www
|
|
||||||
kasm_password_file: ~/.kasmpasswd
|
kasm_password_file: ~/.kasmpasswd
|
||||||
x_authority_file: auto
|
x_authority_file: auto
|
||||||
auto_shutdown:
|
auto_shutdown:
|
||||||
|
@ -33,6 +33,16 @@ sub new {
|
|||||||
|
|
||||||
scalar $self->configValues() > 0;
|
scalar $self->configValues() > 0;
|
||||||
},
|
},
|
||||||
|
toStringSub => $args->{toStringSub} || sub {
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
my $derivedValue = $self->deriveValue();
|
||||||
|
if (defined($derivedValue)) {
|
||||||
|
return "-$self->{name} " . "'$derivedValue'";
|
||||||
|
}
|
||||||
|
|
||||||
|
"-$self->{name}";
|
||||||
|
},
|
||||||
errors => []
|
errors => []
|
||||||
}, $class;
|
}, $class;
|
||||||
}
|
}
|
||||||
@ -75,12 +85,7 @@ sub toString {
|
|||||||
|
|
||||||
return unless $self->isActive();
|
return unless $self->isActive();
|
||||||
|
|
||||||
my $derivedValue = $self->deriveValue();
|
$self->{toStringSub}->($self);
|
||||||
if (defined($derivedValue)) {
|
|
||||||
return "-$self->{name} " . "'$derivedValue'";
|
|
||||||
}
|
|
||||||
|
|
||||||
"-$self->{name}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub toValue {
|
sub toValue {
|
||||||
|
@ -15,6 +15,7 @@ network:
|
|||||||
udp:
|
udp:
|
||||||
public_ip: auto
|
public_ip: auto
|
||||||
port: auto
|
port: auto
|
||||||
|
stun_server: auto
|
||||||
ssl:
|
ssl:
|
||||||
pem_certificate: /etc/ssl/certs/ssl-cert-snakeoil.pem
|
pem_certificate: /etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||||
pem_key: /etc/ssl/private/ssl-cert-snakeoil.key
|
pem_key: /etc/ssl/private/ssl-cert-snakeoil.key
|
||||||
@ -117,9 +118,13 @@ encoding:
|
|||||||
hextile_improved_compression: true
|
hextile_improved_compression: true
|
||||||
|
|
||||||
server:
|
server:
|
||||||
|
http:
|
||||||
|
headers:
|
||||||
|
- Cross-Origin-Embedder-Policy=require-corp
|
||||||
|
- Cross-Origin-Opener-Policy=same-origin
|
||||||
|
httpd_directory: /usr/share/kasmvnc/www
|
||||||
advanced:
|
advanced:
|
||||||
x_font_path: auto
|
x_font_path: auto
|
||||||
httpd_directory: /usr/share/kasmvnc/www
|
|
||||||
kasm_password_file: ${HOME}/.kasmpasswd
|
kasm_password_file: ${HOME}/.kasmpasswd
|
||||||
x_authority_file: auto
|
x_authority_file: auto
|
||||||
auto_shutdown:
|
auto_shutdown:
|
||||||
|
@ -1962,11 +1962,32 @@ sub DefineConfigToCLIConversion {
|
|||||||
name => 'httpd',
|
name => 'httpd',
|
||||||
configKeys => [
|
configKeys => [
|
||||||
KasmVNC::ConfigKey->new({
|
KasmVNC::ConfigKey->new({
|
||||||
name => "server.advanced.httpd_directory",
|
name => "server.http.httpd_directory",
|
||||||
type => KasmVNC::ConfigKey::ANY
|
type => KasmVNC::ConfigKey::ANY
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
|
KasmVNC::CliOption->new({
|
||||||
|
name => 'http-header',
|
||||||
|
configKeys => [
|
||||||
|
KasmVNC::ConfigKey->new({
|
||||||
|
name => "server.http.headers",
|
||||||
|
type => KasmVNC::ConfigKey::ANY
|
||||||
|
})
|
||||||
|
],
|
||||||
|
toStringSub => sub {
|
||||||
|
$self = shift;
|
||||||
|
|
||||||
|
my @values = @{ listify($self->configValues()) };
|
||||||
|
|
||||||
|
my $valuesStr = "";
|
||||||
|
foreach $value (@values) {
|
||||||
|
$valuesStr = $valuesStr . "-http-header '$value' "
|
||||||
|
}
|
||||||
|
chop($valuesStr);
|
||||||
|
return $valuesStr;
|
||||||
|
}
|
||||||
|
}),
|
||||||
KasmVNC::CliOption->new({
|
KasmVNC::CliOption->new({
|
||||||
name => 'IgnoreClientSettingsKasm',
|
name => 'IgnoreClientSettingsKasm',
|
||||||
configKeys => [
|
configKeys => [
|
||||||
@ -2199,6 +2220,24 @@ sub DefineConfigToCLIConversion {
|
|||||||
isActiveSub => sub {
|
isActiveSub => sub {
|
||||||
$self = shift;
|
$self = shift;
|
||||||
|
|
||||||
|
my $value = $self->configValue();
|
||||||
|
isPresent($value) && $value ne 'auto';
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
KasmVNC::CliOption->new({
|
||||||
|
name => 'StunServer',
|
||||||
|
configKeys => [
|
||||||
|
KasmVNC::ConfigKey->new({
|
||||||
|
name => "network.udp.stun_server",
|
||||||
|
validator => KasmVNC::PatternValidator->new({
|
||||||
|
pattern => qr/^(auto|\S+)$/,
|
||||||
|
errorMessage => "must be 'auto' or an IP address/hostname"
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
],
|
||||||
|
isActiveSub => sub {
|
||||||
|
$self = shift;
|
||||||
|
|
||||||
my $value = $self->configValue();
|
my $value = $self->configValue();
|
||||||
isPresent($value) && $value ne 'auto';
|
isPresent($value) && $value ne 'auto';
|
||||||
}
|
}
|
||||||
@ -2644,7 +2683,9 @@ sub ConfigToCmd {
|
|||||||
%optFromConfig = %{ ConstructOptFromConfig() };
|
%optFromConfig = %{ ConstructOptFromConfig() };
|
||||||
|
|
||||||
my @cmd = map { $cliArgMap{$_}->toString() } (keys %optFromConfig);
|
my @cmd = map { $cliArgMap{$_}->toString() } (keys %optFromConfig);
|
||||||
" " . join " ", @cmd;
|
my $cmdStr = " " . join " ", @cmd;
|
||||||
|
|
||||||
|
return $cmdStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub ValidateConfig {
|
sub ValidateConfig {
|
||||||
|
Loading…
Reference in New Issue
Block a user