From d72f6fa784d72e32b817dac03f6a58766a5016b9 Mon Sep 17 00:00:00 2001 From: Corne Oppelaar Date: Fri, 2 Sep 2016 21:33:58 +0200 Subject: [PATCH] add config builder + fix server overview --- config/routes.yml | 14 ++-- public/css/main.css | 10 ++- public/css/main.css.map | 2 +- public/css/partials/_base.scss | 3 +- public/js/pages/servers/edit.js | 2 +- src/Handler/Panel.php | 4 ++ src/Handler/Panel/ConfigBuilder/Action.php | 83 ++++++++++++++++++++++ src/Handler/Panel/ConfigBuilder/Show.php | 23 ++++++ src/Handler/Panel/Servers/Show.php | 34 +++++++++ views/panel/config_builder.html.twig | 26 +++++++ views/panel/servers.html.twig | 10 ++- views/panel/servers/edit.html.twig | 4 +- views/panel/servers/show.html.twig | 49 +++++++++++++ 13 files changed, 250 insertions(+), 14 deletions(-) create mode 100644 src/Handler/Panel/ConfigBuilder/Action.php create mode 100644 src/Handler/Panel/ConfigBuilder/Show.php create mode 100644 src/Handler/Panel/Servers/Show.php create mode 100644 views/panel/config_builder.html.twig diff --git a/config/routes.yml b/config/routes.yml index bdf410f..03bf25a 100644 --- a/config/routes.yml +++ b/config/routes.yml @@ -37,14 +37,20 @@ routes: /sign: post: Panel\Servers\Sign /{fingerprint}: - get: Panel\Servers\Edit\Show - post: Panel\Servers\Edit\Action - /{fingerprint}/config: Panel\Servers\Config - /{fingerprint}/config/{cert}: Panel\Servers\Config + get: Panel\Servers\Show + /edit: + get: Panel\Servers\Edit\Show + post: Panel\Servers\Edit\Action + /config: + get: Panel\Servers\Config + /{cert}: Panel\Servers\Config /invites: get: Panel\Invites /create: post: Panel\Invites\Create + /config-builder: + get: Panel\ConfigBuilder\Show + post: Panel\ConfigBuilder\Action /server: /register: post: Server\Register \ No newline at end of file diff --git a/public/css/main.css b/public/css/main.css index 56613e5..472d2a0 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -250,31 +250,37 @@ body { .certificate-list li .actions .certificate-download-key:hover, .certificate-list li .actions .no:hover, .certificate-list li .actions .copy:hover, - .certificate-list li .actions .edit:hover, .certificate-list li .revoke-q .certificate-download:hover, + .certificate-list li .actions .edit:hover, + .certificate-list li .actions .details:hover, .certificate-list li .revoke-q .certificate-download:hover, .certificate-list li .revoke-q .certificate-download-key:hover, .certificate-list li .revoke-q .no:hover, .certificate-list li .revoke-q .copy:hover, .certificate-list li .revoke-q .edit:hover, + .certificate-list li .revoke-q .details:hover, .servers li .actions .certificate-download:hover, .servers li .actions .certificate-download-key:hover, .servers li .actions .no:hover, .servers li .actions .copy:hover, .servers li .actions .edit:hover, + .servers li .actions .details:hover, .servers li .revoke-q .certificate-download:hover, .servers li .revoke-q .certificate-download-key:hover, .servers li .revoke-q .no:hover, .servers li .revoke-q .copy:hover, .servers li .revoke-q .edit:hover, + .servers li .revoke-q .details:hover, .invites li .actions .certificate-download:hover, .invites li .actions .certificate-download-key:hover, .invites li .actions .no:hover, .invites li .actions .copy:hover, .invites li .actions .edit:hover, + .invites li .actions .details:hover, .invites li .revoke-q .certificate-download:hover, .invites li .revoke-q .certificate-download-key:hover, .invites li .revoke-q .no:hover, .invites li .revoke-q .copy:hover, - .invites li .revoke-q .edit:hover { + .invites li .revoke-q .edit:hover, + .invites li .revoke-q .details:hover { background: #aca4bc; } .certificate-list li .actions .no, .certificate-list li .revoke-q .no, .servers li .actions .no, diff --git a/public/css/main.css.map b/public/css/main.css.map index b3a49fb..88b77de 100644 --- a/public/css/main.css.map +++ b/public/css/main.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA;gFACgF;AAEhF;;;;GAIG;ACPH;;GAEG;AAcH;;GAEG;AClBH;;GAEG;AFqBK,kCAAuB;AACvB,iCAAsB;AACtB,yCAA8B;AErBtC,IAAK;EACH,gBAAgB,EAAE,OAAO;;AAG3B,cAAe;EACb,OAAO,EAAE,YAAY;EACrB,OAAO,EAAE,IAAI;EACb,sBAAsB,EAAE,MAAM;EAC9B,cAAc,EAAE,MAAM;;AAGxB,6DAAU;EACR,OAAO,EAAE,IAA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ass","partials/_messages.scss","partials/_menus.scss","partials/_forms.sass","partials/_fonts.scss","partials/_typography.scss","partials/_tooltips.scss","pages/certificates/new.scss"], "names": [], "file": "main.css" diff --git a/public/css/partials/_base.scss b/public/css/partials/_base.scss index 538f60c..d406e01 100644 --- a/public/css/partials/_base.scss +++ b/public/css/partials/_base.scss @@ -255,7 +255,8 @@ body { .certificate-download-key, .no, .copy, - .edit { + .edit, + .details { &:hover { background: #aca4bc; } diff --git a/public/js/pages/servers/edit.js b/public/js/pages/servers/edit.js index fb7400d..be4de13 100644 --- a/public/js/pages/servers/edit.js +++ b/public/js/pages/servers/edit.js @@ -20,7 +20,7 @@ $(function () { var data = $('.server-form input,.server-form select').serializeArray(); - $.post('/panel/server/' + fingerprint, data, function (data) { + $.post('/panel/server/' + fingerprint + '/edit', data, function (data) { if (!data.success) { error(data.error); return; diff --git a/src/Handler/Panel.php b/src/Handler/Panel.php index 0caa444..42b9558 100644 --- a/src/Handler/Panel.php +++ b/src/Handler/Panel.php @@ -43,6 +43,10 @@ class Panel extends Session 'name' => 'Invites', 'path' => '/panel/invites' ], + [ + 'name' => 'Config builder', + 'path' => '/panel/config-builder' + ], [ 'name' => 'Profile > ' . $this->getUser()->getUsername(), 'path' => '/panel/profile' diff --git a/src/Handler/Panel/ConfigBuilder/Action.php b/src/Handler/Panel/ConfigBuilder/Action.php new file mode 100644 index 0000000..8eaa816 --- /dev/null +++ b/src/Handler/Panel/ConfigBuilder/Action.php @@ -0,0 +1,83 @@ +open($zipFile, \ZipArchive::CREATE); + $server = ServerQuery::create()->findOneByFingerprint($this->post('fingerprint')); + $name = $server->getFqdn(); + + $this->fillZipWithCaAndConfig($zip, $server); + + $cert = $this->post('cert'); + + if ($cert !== null) { + $certModel = CertificateQuery::create()->findOneByUserAndName($this->getUser(), $cert); + $this->addClientCertificateData($zip, $certModel); + + $name .= '-' . $certModel->getName() . '.' . $certModel->getSerial(); + } + + $zip->close(); + + $zipContents = file_get_contents($zipFile); + unlink($zipFile); + + return $this->getResponse() + ->withHeader('Content-Type', 'application/zip') + ->withHeader('Content-Disposition', 'attachment; filename="' . $name . '.zip"') + ->write($zipContents); + } + + /** + * @param \ZipArchive $zip + * @param Server $server + */ + public function fillZipWithCaAndConfig($zip, $server) + { + $config = $this->getConfigForServerFingerprint($server); + $zip->addFromString('server.conf', $config); + $zip->addFromString('ca.crt', file_get_contents($this->getCore()->getBaseDir() . '/storage/ca/ca.crt')); + } + + /** + * @param Server $server + * @return string + */ + public function getConfigForServerFingerprint($server) + { + /** @var \Twig_Environment $twig */ + $twig = $this->get('twig'); + + $config = $twig->render('etc/openvpn-client.conf.twig', [ + 'server' => $server + ]); + + return $config; + } + + /** + * @param \ZipArchive $zip + * @param Certificate $cert + */ + public function addClientCertificateData($zip, $cert) + { + $zip->addFromString('client.crt', $cert->getCertificate()); + + if ($cert->hasPrivateKey()) { + $zip->addFromString('client.key', $cert->getPrivateKey()); + } + } +} \ No newline at end of file diff --git a/src/Handler/Panel/ConfigBuilder/Show.php b/src/Handler/Panel/ConfigBuilder/Show.php new file mode 100644 index 0000000..b2b82e7 --- /dev/null +++ b/src/Handler/Panel/ConfigBuilder/Show.php @@ -0,0 +1,23 @@ +filterByStatus('signed')->find(); + + return $this->render( + 'panel/config_builder.html.twig', + [ + 'servers' => $servers + ] + ); + } +} \ No newline at end of file diff --git a/src/Handler/Panel/Servers/Show.php b/src/Handler/Panel/Servers/Show.php new file mode 100644 index 0000000..8867c16 --- /dev/null +++ b/src/Handler/Panel/Servers/Show.php @@ -0,0 +1,34 @@ +findOneByFingerprint($this->attr('fingerprint')); + + if ($server === null) { + return $this->getResponse()->withStatus(404); + } + + return $this->render( + "panel/servers/show.html.twig", + [ + 'server' => $server + ] + ); + } +} \ No newline at end of file diff --git a/views/panel/config_builder.html.twig b/views/panel/config_builder.html.twig new file mode 100644 index 0000000..72fe298 --- /dev/null +++ b/views/panel/config_builder.html.twig @@ -0,0 +1,26 @@ +{% extends "panel.html.twig" %} + +{% block panel_contents %} +

Config builder

+
+
+ + +
+
+ + +
+
+ +
+
+{% endblock %} diff --git a/views/panel/servers.html.twig b/views/panel/servers.html.twig index f01e2ba..878333f 100644 --- a/views/panel/servers.html.twig +++ b/views/panel/servers.html.twig @@ -16,10 +16,14 @@ {% for server in servers %}
  • - {{ server.getName() }} + {{ server.getFQDN() }}
    - Details + download config + details + {% if user.isSuperUser() %} + edit + {% endif %}
  • {% else %} @@ -44,7 +48,7 @@ - edit + edit diff --git a/views/panel/servers/edit.html.twig b/views/panel/servers/edit.html.twig index 2ffdfc4..3b77228 100644 --- a/views/panel/servers/edit.html.twig +++ b/views/panel/servers/edit.html.twig @@ -47,8 +47,8 @@
    - - + +
    diff --git a/views/panel/servers/show.html.twig b/views/panel/servers/show.html.twig index e69de29..975ae45 100644 --- a/views/panel/servers/show.html.twig +++ b/views/panel/servers/show.html.twig @@ -0,0 +1,49 @@ +{% extends "panel.html.twig" %} + +{% block panel_contents %} +

    Server '{{ server.getFqdn() }}'

    +
    +
    + + +
    +
    + + +
    +

    Details

    +
    + + +
    +
    + + +
    +

    Config

    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +{% endblock %} \ No newline at end of file