]> git.proxmox.com Git - pmg-api.git/commitdiff
fix #2093 pmgproxy: read in /etc/default/pmgproxy
authorStoiko Ivanov <s.ivanov@proxmox.com>
Tue, 26 Feb 2019 11:14:09 +0000 (12:14 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 26 Feb 2019 11:59:09 +0000 (12:59 +0100)
and use the same configuration parameters as pveproxy

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
PMG/Service/pmgproxy.pm

index 303fb3065750d5ced3b0c07b8a359f7e931ee0aa..4263f391f077f248e1511525fcdb87b7f19a5992 100755 (executable)
@@ -17,6 +17,7 @@ use PVE::APIServer::Formatter;
 use PVE::APIServer::Formatter::Standard;
 use PVE::APIServer::Formatter::HTML;
 use PVE::APIServer::AnyEvent;
+use PVE::APIServer::Utils;
 
 use PMG::HTTPServer;
 use PMG::API2;
@@ -53,6 +54,8 @@ my $framework7_dir = '/usr/share/javascript/framework7';
 sub init {
     my ($self) = @_;
 
+    my $proxyconf = PVE::APIServer::Utils::read_proxy_config($self->{name});
+
     my $accept_lock_fn = "/var/lock/pmgproxy.lck";
 
     my $lockfh = IO::File->new(">>${accept_lock_fn}") ||
@@ -88,16 +91,16 @@ sub init {
        debug => $self->{debug},
        trusted_env => 0, # not trusted, anyone can connect
        logfile => '/var/log/pmgproxy/pmgproxy.log',
+       allow_from => $proxyconf->{ALLOW_FROM},
+       deny_from => $proxyconf->{DENY_FROM},
+       policy => $proxyconf->{POLICY},
        ssl => {
-           # Note: older versions are considered insecure, for example
-           # search for "Poodle"-Attac
-           method => 'any',
-           sslv2 => 0,
-           sslv3 => 0,
-           cipher_list => 'HIGH:MEDIUM:!aNULL:!MD5',
            cert_file => '/etc/pmg/pmg-api.pem',
            dh => 'skip2048',
+           cipher_list => $proxyconf->{CIPHERS},
+           honor_cipher_order => $proxyconf->{HONOR_CIPHER_ORDER},
        },
+       compression => $proxyconf->{COMPRESSION},
        # Note: there is no authentication for those pages and dirs!
        pages => {
            '/' => sub { get_index($self->{nodename}, @_) },
@@ -112,6 +115,10 @@ sub init {
        },
        dirs => $dirs,
     };
+
+    if (defined($proxyconf->{DHPARAMS})) {
+       $self->{server_config}->{ssl}->{dh_file} = $proxyconf->{DHPARAMS};
+    }
 }
 
 sub run {