%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.248 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/bind8/ |
Upload File : |
#!/usr/bin/perl # Create, update or delete a TLS key and cert use strict; use warnings; no warnings 'redefine'; no warnings 'uninitialized'; our (%access, %text, %in, %config); require './bind8-lib.pl'; $access{'defaults'} || &error($text{'tls_ecannot'}); &supports_tls() || &error($text{'tls_esupport'}); &ReadParse(); &error_setup($in{'new'} ? $text{'tls_cerr'} : $in{'delete'} ? $text{'tls_derr'} : $text{'tls_err'}); # Get the TLS config being edited my $parent = &get_config_parent(); my $conf = &get_config(); my @tls = &find("tls", $conf); my $tls; if (!$in{'new'}) { ($tls) = grep { $_->{'values'}->[0] eq $in{'oldname'} } @tls; $tls || &error($text{'tls_egone'}); } &lock_file(&make_chroot($config{'named_conf'})); if ($in{'delete'}) { # Just remove this one TLS key, if unused my @users = &find_tls_users($conf, $tls->{'values'}->[0]); @users && &error($text{'tls_eusers'}); &save_directive($parent, [ $tls ], [ ]); } else { # Validate inputs $in{'name'} =~ /^[a-z0-9\-\_]+$/i || &error($text{'tls_ename'}); -r $in{'key'} || &error($text{'tls_ekey'}); -r $in{'cert'} || &error($text{'tls_ecert'}); if (!$in{'ca_def'}) { -r $in{'ca'} || &error($text{'tls_eca'}); } &foreign_require("webmin"); &webmin::validate_key_cert($in{'key'}, $in{'cert'}); if (!$in{'ca_def'}) { &webmin::validate_key_cert($in{'key'}, $in{'ca'}); } if ($in{'new'}) { # Create the TLS object $tls = { 'name' => 'tls', 'values' => [ $in{'name'} ], 'type' => 1, 'members' => [ { 'name' => 'key-file', 'values' => [ $in{'key'} ] }, { 'name' => 'cert-file', 'values' => [ $in{'cert'} ] }, ] }; if (!$in{'ca_def'}) { push(@{$tls->{'members'}}, { 'name' => 'ca-file', 'values' => [ $in{'ca'} ] }); } &save_directive($parent, [ ], [ $tls ]); } else { # Update the existing object $tls->{'values'}->[0] = $in{'name'}; &save_directive($parent, [ $tls ], [ $tls ]); &save_directive($tls, "key-file", [ { 'name' => 'key-file', 'values' => [ $in{'key'} ] } ]); &save_directive($tls, "cert-file", [ { 'name' => 'cert-file', 'values' => [ $in{'cert'} ] } ]); &save_directive($tls, "ca-file", $in{'ca_def'} ? [ ] : [ { 'name' => 'ca-file', 'values' => [ $in{'ca'} ] } ]); } } &flush_file_lines(); &unlock_file(&make_chroot($config{'named_conf'})); &webmin_log($in{'new'} ? 'create' : $in{'delete'} ? 'delete' : 'modify', 'tls', $tls->{'values'}->[0]); &redirect("list_tls.cgi");