Skip to content

Commit d30cedf

Browse files
committed
Add initial gui for ssl ca cert install #173
1 parent 280512f commit d30cedf

14 files changed

+117
-210
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"typeface-roboto": "^0.0.75",
2828
"vue": "^2.6.11",
2929
"vue-apollo": "^3.0.3",
30+
"vue-browser-detect-plugin": "^0.1.8",
3031
"vue-cesium": "^2.0.6",
3132
"vue-cli-plugin-apollo": "^0.21.3",
3233
"vue-fullscreen": "^2.1.5",

public/img/ssl/firefox-sslca.png

134 KB
Loading

public/img/ssl/macffsafari-1.png

19.5 KB
Loading

public/img/ssl/macffsafari-2.png

59.9 KB
Loading

public/img/ssl/macffsafari-3.png

78.8 KB
Loading

public/img/ssl/macffsafari-4.png

88.9 KB
Loading
File renamed without changes.

src/components/modules/config/ConfigConnections.vue

+71-16
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,20 @@ div
9696
v-icon(v-else color='error') mdi-alert-circle-outline
9797
v-list-item
9898
v-list-item-content Icon Set
99-
v-list-item-content {{ apistate[item.key].icon }}
99+
v-list-item-content
100100
v-icon(v-if="apistate[item.key].icon" color='success') {{ apistate[item.key].icon }}
101101
v-icon(v-else color='error') mdi-alert-circle-outline
102102
v-divider
103-
// img(:src="`https://${item.hostname}/img/misc/onepixel.png`" @error="imgError('http', item)" style="display:none")
104-
// img(:src="`http://${item.hostname}/img/misc/onepixel.png`" @error="imgError('https', item)" style="display:none")
105-
103+
v-list(dense)
104+
v-list-item
105+
v-list-item-content SSL Status
106+
v-list-item-content
107+
v-icon(v-if="apistate[item.key].sslstate === true" color='success') mdi-check-circle-outline
108+
v-icon(v-else color='error') mdi-alert-circle-outline
109+
v-list-item(v-if="apistate[item.key].sslstate !== true")
110+
v-list-item-content
111+
v-btn(color="primary" @click="setupSsl(item.key)") Setup SSL
112+
106113
v-dialog(v-model="dialog" max-width="600px")
107114
v-card
108115
v-card-title.headline(class="primary" primary-title)
@@ -126,6 +133,56 @@ div
126133
v-btn.ma-2(color="success" @click="createConnection()") Create Connection
127134
v-btn.ma-2(color="error" @click="dialog = false") Cancel
128135

136+
v-dialog(v-model="sslDialog" max-width="600px" overlay-opacity=0.85)
137+
v-card
138+
v-card-title.headline.primary(primary-title)
139+
span SSL Setup
140+
v-spacer(v-if="sslitem")
141+
span.subtitle-1(v-if="sslitem") {{ sslitem.name }}
142+
v-card-text(v-if="sslitem")
143+
v-container
144+
// Download CA cert step
145+
v-row
146+
v-col(cols="12" sm="12" md="12")
147+
div 1. Please click on the button below to download the SSL Certificate
148+
v-btn(color="primary" small :href="`http://${sslitem.hostname}/security/mavCA.crt`") Download SSL CA Certificate
149+
// Firefox ssl guide
150+
v-row(v-if="$browserDetect.isFirefox")
151+
v-col(cols="12" sm="12" md="12")
152+
div 2. In Firefox, a dialog should popup asking which permissions to give the certificate:
153+
img(src="img/ssl/firefox-sslca.png")
154+
div Click to enable 'Trust this CA to identify web sites'
155+
// MacOS Chrome/Safari ssl guide
156+
v-row(v-else-if="($browserDetect.isChrome || $browserDetect.isSafari) && (/OS X/.test($browserDetect.meta.ua) || /OSX/.test($browserDetect.meta.ua))")
157+
v-col(cols="12" sm="12" md="12")
158+
div 2. In MacOS Chrome or Safari, click on the downloaded file in the footer of the browser.
159+
img(src="img/ssl/macffsafari-1.png")
160+
div This will import the certificate into MacOS system Keychain Access app.
161+
img(src="img/ssl/macffsafari-2.png")
162+
div Choose the default 'login' option and click Add
163+
v-col(cols="12" sm="12" md="12")
164+
div 3. Double click on the untrusted certificate (with red X)
165+
img(src="img/ssl/macffsafari-3.png")
166+
v-col(cols="12" sm="12" md="12")
167+
div 4. Open the 'Trust' section and change 'When using this certificate' to 'Always Trust'
168+
img(src="img/ssl/macffsafari-4.png")
169+
div Close the window and it will ask you to authenticate, to verify the system certificate update.
170+
// Undetected browser ssl guide
171+
v-row(v-else)
172+
v-col(cols="12" sm="12" md="12")
173+
div 2. Unknown browser - please search on the internet for installation instructions for your OS/Browser:
174+
div {{ $browserDetect.meta.ua }}
175+
// Add reload step
176+
v-row
177+
v-col(cols="12" sm="12" md="12")
178+
div 3. Reload the website to activate the new certificate.
179+
v-btn(color="primary" small @click="reloadPage()") Reload
180+
181+
v-divider
182+
v-card-actions
183+
v-spacer
184+
v-btn.ma-2(color="error" @click="sslDialog = false") Close
185+
129186
v-dialog(v-if="deleteitem" v-model="deleteDialog" max-width="400")
130187
v-card
131188
v-card-title
@@ -150,8 +207,10 @@ export default {
150207
filter: {},
151208
dialog: false,
152209
deleteDialog: false,
210+
sslDialog: false,
153211
newitem: {},
154212
deleteitem: null,
213+
sslitem: null,
155214
expand: true
156215
}
157216
},
@@ -190,22 +249,13 @@ export default {
190249
}
191250
this.$store.commit('data/addApi', {key: data.key, data: data})
192251
},
193-
/*
194-
imgError (protocol, item) {
195-
this.logDebug(`protocol: ${protocol}`)
196-
this.logDebug(item)
197-
if (event.type == "error" && item.hasOwnProperty('hostname')) {
198-
this.logError(`Error connecting to API (${item.name}) over SSL.`)
199-
this.logDebug(event)
200-
} else if (! item.hasOwnProperty('hostname')) {
201-
this.logError(`Error: This API definition (${item.name}) does not have a hostname set. Please update maverick-api.`)
202-
}
203-
},
204-
*/
205252
lastseen (api) {
206253
let lastseen = (this.$store.state.core.apiSeen.hasOwnProperty(api)) ? this.$store.state.core.apiSeen[api] : 0
207254
return (performance.now() - lastseen)
208255
},
256+
reloadPage(){
257+
window.location.reload()
258+
},
209259
remove(item) {
210260
this.deleteitem = item
211261
this.deleteDialog = true
@@ -228,6 +278,11 @@ export default {
228278
// delete this.$apollo.provider.clients[apiData.key]
229279
// this.createClient(apiData.key+'new', apiData)
230280
},
281+
setupSsl(api) {
282+
this.logDebug(`Opening setupSsl for Api: ${this.apis[api].name}`)
283+
this.sslitem = this.apis[api]
284+
this.sslDialog = true
285+
},
231286
async testSsl(api) {
232287
// Define an internal method function promise that fetches the image and watches for completion or error
233288
function testImage(imgPath) {

src/components/modules/config/ConfigHome.vue

+13-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ v-container(fluid)
66
v-spacer
77
v-container(fluid)
88
v-row()
9-
v-col(lg=4 md=6)
9+
v-col(lg=6 md=6)
1010
v-card(ripple hover shaped to="/config/interface")
1111
div.d-flex.flex-no-wrap.justify-space-between
1212
div
@@ -17,7 +17,7 @@ v-container(fluid)
1717
v-avatar.ma-3(tile)
1818
v-icon(x-large) mdi-account-cog
1919
v-spacer
20-
v-col(lg=4 md=6)
20+
v-col(lg=6 md=6)
2121
v-card(ripple hover shaped to="/config/modules")
2222
div.d-flex.flex-no-wrap.justify-space-between
2323
div
@@ -28,17 +28,6 @@ v-container(fluid)
2828
v-avatar.ma-3(tile)
2929
v-icon(x-large) mdi-view-module
3030
v-spacer
31-
v-col(lg=4 md=6)
32-
v-card(ripple hover shaped to="/config/video")
33-
div.d-flex.flex-no-wrap.justify-space-between
34-
div
35-
v-card-title.headline Video Streams
36-
v-card-subtitle Create and edit Video Streams.
37-
v-card-actions
38-
v-btn(color="primary" small to="/config/video") GoTo Video Streams
39-
v-avatar.ma-3(tile)
40-
v-icon(x-large) mdi-video
41-
v-spacer
4231

4332
v-card.mt-4
4433
v-app-bar(:color="topColor" dense)
@@ -68,6 +57,17 @@ v-container(fluid)
6857
v-avatar.ma-3(tile)
6958
v-icon(x-large) mdi-router-wireless-settings
7059
v-spacer
60+
v-col(lg=4 md=6)
61+
v-card(ripple hover shaped to="/config/video")
62+
div.d-flex.flex-no-wrap.justify-space-between
63+
div
64+
v-card-title.headline Video Streams
65+
v-card-subtitle Create and edit Video Streams.
66+
v-card-actions
67+
v-btn(color="primary" small to="/config/video") GoTo Video Streams
68+
v-avatar.ma-3(tile)
69+
v-icon(x-large) mdi-video
70+
v-spacer
7171
</template>
7272
<script>
7373
export default {

src/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import './plugins/vuebar'
1717
import './plugins/vuetoast'
1818
import './plugins/vuevisibility'
1919
import mq from './plugins/vuemq'
20+
import './plugins/vuebrowserdetect'
2021
// import './plugins/registerServiceWorker'
2122
import { createProvider } from './plugins/graphql/vue-apollo'
2223

src/plugins/core/CoreApi.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,13 @@ const plugin = {
111111
// Add a vuex apis entry
112112
this.$store.commit('core/addApiState', api)
113113

114+
if (!this.apis[api].hostname) {
115+
this.logError(`Error: API ${this.apis[api].name} does not have a hostname set, please upgrade maverick-api`)
116+
return false
117+
}
114118
// Check ssl connection
115119
let httpsState = false
116-
let httpsLoad = this.testImage(`https://${this.apis[api].hostname}/img/ssltest.png`)
120+
let httpsLoad = this.testImage(`https://${this.apis[api].hostname}/img/ssl/ssltest.png`)
117121
.then(img => { httpsState = true })
118122
.catch(err => { httpsState = false })
119123
await httpsLoad

src/plugins/vuebrowserdetect.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Vue from 'vue'
2+
import browserDetect from "vue-browser-detect-plugin"
3+
4+
Vue.use(browserDetect)

vue.config.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// const fs = require('fs');
1+
const fs = require('fs');
22

33
module.exports = {
44
"transpileDependencies": [
@@ -64,14 +64,12 @@ module.exports = {
6464
'X-Requested-With, content-type, Authorization'
6565
},
6666
// Uncomment this https block below to enable https in the Maverick environment
67-
/*
6867
https: {
6968
key: fs.readFileSync('/srv/maverick/data/security/ssl/web/mavweb.key'),
7069
cert: fs.readFileSync('/srv/maverick/data/security/ssl/web/mavweb.crt'),
7170
ca: fs.readFileSync('/srv/maverick/data/security/ssl/ca/mavCA.pem'),
7271
},
73-
*/
74-
https: false,
72+
// https: false,
7573
hotOnly: true,
7674
inline: true,
7775
open: false,

0 commit comments

Comments
 (0)