From 2809d5fa7a0031ed5e30c2da374243f3adc3f3ec Mon Sep 17 00:00:00 2001 From: MattIPv4 Date: Thu, 7 May 2020 17:14:04 +0100 Subject: [PATCH] Add SSL, certbot & go live setup steps --- src/nginxconfig/scss/style.scss | 22 ++- .../templates/global_sections/https.vue | 158 ++++++++++++------ .../templates/setup_sections/certbot.vue | 126 ++++++++++++++ .../templates/setup_sections/go_live.vue | 30 ++++ .../templates/setup_sections/index.js | 3 + .../templates/setup_sections/ssl.vue | 83 +++++++++ 6 files changed, 356 insertions(+), 66 deletions(-) create mode 100644 src/nginxconfig/templates/setup_sections/certbot.vue create mode 100644 src/nginxconfig/templates/setup_sections/go_live.vue create mode 100644 src/nginxconfig/templates/setup_sections/ssl.vue diff --git a/src/nginxconfig/scss/style.scss b/src/nginxconfig/scss/style.scss index 9a1e82c..3b9e2e3 100644 --- a/src/nginxconfig/scss/style.scss +++ b/src/nginxconfig/scss/style.scss @@ -81,10 +81,9 @@ $highlight: #f2c94c; .panel { margin-top: 0; padding: 1.5rem 0 2rem; + text-align: left; &.presets { - text-align: left; - .header-group, .buttons-group { display: flex; @@ -115,21 +114,20 @@ $highlight: #f2c94c; } &.setup { - ol { + p { color: $dark-blue; + overflow-wrap: break-word; + + a { + text-decoration: none; + } + } + + ol { margin: 0 1rem; - text-align: left; li { margin: 0 0 1.5rem; - - p { - overflow-wrap: break-word; - - a { - text-decoration: none; - } - } } } } diff --git a/src/nginxconfig/templates/global_sections/https.vue b/src/nginxconfig/templates/global_sections/https.vue index 3beffd1..dadb0cd 100644 --- a/src/nginxconfig/templates/global_sections/https.vue +++ b/src/nginxconfig/templates/global_sections/https.vue @@ -1,77 +1,94 @@ @@ -139,19 +156,52 @@ }, deep: true, }, - // Enable LE webroot if any site uses LE '$parent.$parent.$data.domains': { handler(data) { + let httpsEnabled = false, leEnabled = false; + for (const domain of data) { + // Enable HTTPS server settings if any site uses HTTPS + if (domain && domain.https && domain.https.https && domain.https.https.computed) { + this.$props.data.sslProfile.enabled = true; + this.$props.data.sslProfile.computed = this.$props.data.sslProfile.value; + this.$props.data.ocspCloudflare.enabled = true; + this.$props.data.ocspCloudflare.computed = this.$props.data.ocspCloudflare.value; + this.$props.data.ocspGoogle.enabled = true; + this.$props.data.ocspGoogle.computed = this.$props.data.ocspGoogle.value; + this.$props.data.ocspOpenDns.enabled = true; + this.$props.data.ocspOpenDns.computed = this.$props.data.ocspOpenDns.value; + this.$props.data.letsEncryptRoot.enabled = true; + this.$props.data.letsEncryptRoot.computed = this.$props.data.letsEncryptRoot.value; + httpsEnabled = true; + } + + // Enable LE webroot if any site uses LE if (domain && domain.https && domain.https.certType && domain.https.certType.computed === 'letsEncrypt') { this.$props.data.letsEncryptRoot.enabled = true; this.$props.data.letsEncryptRoot.computed = this.$props.data.letsEncryptRoot.value; - return; + leEnabled = true; } } - this.$props.data.letsEncryptRoot.enabled = false; - this.$props.data.letsEncryptRoot.computed = ''; + + if (!httpsEnabled) { + this.$props.data.sslProfile.enabled = false; + this.$props.data.sslProfile.computed = ''; + this.$props.data.ocspCloudflare.enabled = false; + this.$props.data.ocspCloudflare.computed = false; + this.$props.data.ocspGoogle.enabled = false; + this.$props.data.ocspGoogle.computed = false; + this.$props.data.ocspOpenDns.enabled = false; + this.$props.data.ocspOpenDns.computed = false; + this.$props.data.letsEncryptRoot.enabled = false; + this.$props.data.letsEncryptRoot.computed = ''; + } + + if (!leEnabled) { + this.$props.data.letsEncryptRoot.enabled = false; + this.$props.data.letsEncryptRoot.computed = ''; + } }, deep: true, }, diff --git a/src/nginxconfig/templates/setup_sections/certbot.vue b/src/nginxconfig/templates/setup_sections/certbot.vue new file mode 100644 index 0000000..f9f86fc --- /dev/null +++ b/src/nginxconfig/templates/setup_sections/certbot.vue @@ -0,0 +1,126 @@ + + + diff --git a/src/nginxconfig/templates/setup_sections/go_live.vue b/src/nginxconfig/templates/setup_sections/go_live.vue new file mode 100644 index 0000000..30c81d5 --- /dev/null +++ b/src/nginxconfig/templates/setup_sections/go_live.vue @@ -0,0 +1,30 @@ + + + diff --git a/src/nginxconfig/templates/setup_sections/index.js b/src/nginxconfig/templates/setup_sections/index.js index ae26dd7..f149966 100644 --- a/src/nginxconfig/templates/setup_sections/index.js +++ b/src/nginxconfig/templates/setup_sections/index.js @@ -1 +1,4 @@ export { default as Download } from './download'; +export { default as SSL } from './ssl'; +export { default as Certbot } from './certbot'; +export { default as GoLive } from './go_live'; diff --git a/src/nginxconfig/templates/setup_sections/ssl.vue b/src/nginxconfig/templates/setup_sections/ssl.vue new file mode 100644 index 0000000..cdd1cde --- /dev/null +++ b/src/nginxconfig/templates/setup_sections/ssl.vue @@ -0,0 +1,83 @@ + + +