From a65bda0f1959da9944769155b48f6f87b50005b5 Mon Sep 17 00:00:00 2001 From: Ilya Sosnovsky Date: Mon, 2 Nov 2020 19:30:36 +0300 Subject: [PATCH] Added user connection verification; Added filter to auto hide revoked certs; Some fixes --- .werffiles/configure.sh | 4 ++-- .werffiles/openvpn.conf | 1 + docker-compose.yaml | 2 +- frontend/src/main.js | 19 +++++++++++++++---- frontend/static/css/style.css | 4 ++++ frontend/static/index.html | 34 ++++++---------------------------- main.go | 25 +++++++++++++++++++++---- 7 files changed, 50 insertions(+), 39 deletions(-) diff --git a/.werffiles/configure.sh b/.werffiles/configure.sh index 73284fc..7291b26 100644 --- a/.werffiles/configure.sh +++ b/.werffiles/configure.sh @@ -24,8 +24,8 @@ fi cp -f /etc/openvpn/setup/openvpn.conf /etc/openvpn/openvpn.conf -[ -d /etc/openvpn/certs/pki ] && chmod 755 /etc/openvpn/certs/pki -[ -f /etc/openvpn/certs/pki/crl.pem ] && chmod 644 /etc/openvpn/certs/pki/crl.pem +[ -d $EASY_RSA_LOC/pki ] && chmod 755 $EASY_RSA_LOC/pki +[ -f $EASY_RSA_LOC/pki/crl.pem ] && chmod 644 $EASY_RSA_LOC/pki/crl.pem mkdir -p /etc/openvpn/ccd diff --git a/.werffiles/openvpn.conf b/.werffiles/openvpn.conf index 4f4b81c..10d1c4f 100644 --- a/.werffiles/openvpn.conf +++ b/.werffiles/openvpn.conf @@ -8,6 +8,7 @@ dh /etc/openvpn/easyrsa/pki/dh.pem crl-verify /etc/openvpn/easyrsa/pki/crl.pem tls-auth /etc/openvpn/easyrsa/pki/ta.key key-direction 0 +duplicate-cn cipher AES-128-CBC management 127.0.0.1 8989 keepalive 10 60 diff --git a/docker-compose.yaml b/docker-compose.yaml index f712e27..b2d107a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,7 +10,7 @@ services: cap_add: - NET_ADMIN ports: - - 1194:1194 + - 7777:1194 volumes: - ./easyrsa:/etc/openvpn/easyrsa - ./ccd:/etc/openvpn/ccd diff --git a/frontend/src/main.js b/frontend/src/main.js index 93f7db6..b881fb6 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -108,6 +108,9 @@ new Vue({ showWhenStatus: 'Active' } ], + filters: { + hide_revoked: true + }, u: { newUserName: '', // newUserPassword: 'nopass', @@ -127,9 +130,6 @@ new Vue({ } }, watch: { -// u: function () { -// this.u.columns = Object.keys(this.u.data[0]) //.reverse() -// } }, mounted: function () { this.u_get_data() @@ -209,11 +209,22 @@ new Vue({ modalShowCcdDisplay: function () { return this.u.modalShowCcdVisible ? {display: 'flex'} : {} }, + filteredRows: function() { + var _this = this; + + if(_this.filters.hide_revoked) { + return _this.rows.filter(function(account) { + return account.AccountStatus === "Active"; + }); + } else { + return _this.rows; + } + } }, methods: { rowStyleClassFn: function(row) { - return row.ConnectionStatus == '' ? '' : 'active-row'; + return row.ConnectionStatus == 'Connected' ? 'connected-user' : '' ; }, rowActionFn: function(e) { this.username = e.target.dataset.username; diff --git a/frontend/static/css/style.css b/frontend/static/css/style.css index 6d4fce6..833cabc 100644 --- a/frontend/static/css/style.css +++ b/frontend/static/css/style.css @@ -44,6 +44,10 @@ body { margin: 0.1rem; } +.connected-user { + background-color: rgba(162, 245, 169, 0.5); +} + .new-user-btn { margin-right: 2rem; } diff --git a/frontend/static/index.html b/frontend/static/index.html index f4840a6..a79406f 100644 --- a/frontend/static/index.html +++ b/frontend/static/index.html @@ -9,42 +9,20 @@
- - - - - - - - - - - - - - - - - - - - - - - - -
+ +
-
- This will show up when there are no rows +
+

No users have been created yet.

+