From 1e322804ce397beed5e9458889c9135d35169991 Mon Sep 17 00:00:00 2001 From: Julian Gassner Date: Wed, 4 Dec 2024 16:47:36 +0100 Subject: [PATCH 01/26] Add ZoneEdit certbot plugin --- global/certbot-dns-plugins.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/global/certbot-dns-plugins.json b/global/certbot-dns-plugins.json index 0758777..31d721c 100644 --- a/global/certbot-dns-plugins.json +++ b/global/certbot-dns-plugins.json @@ -510,5 +510,13 @@ "dependencies": "", "credentials": "edgedns_client_secret = as3d1asd5d1a32sdfsdfs2d1asd5=\nedgedns_host = sdflskjdf-dfsdfsdf-sdfsdfsdf.luna.akamaiapis.net\nedgedns_access_token = kjdsi3-34rfsdfsdf-234234fsdfsdf\nedgedns_client_token = dkfjdf-342fsdfsd-23fsdfsdfsdf", "full_plugin_name": "edgedns" + }, + "zoneedit": { + "name": "ZoneEdit", + "package_name": "certbot-dns-zoneedit", + "version": "~=0.3.2", + "dependencies": "", + "credentials": "dns_zoneedit_user = \ndns_zoneedit_token = ", + "full_plugin_name": "dns-zoneedit" } } From 5d087f1256cbd110a4ba2e6809616b266d22a43d Mon Sep 17 00:00:00 2001 From: FabianK3 <21039694+FabianK3@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:35:58 +0100 Subject: [PATCH 02/26] Update DomainOffensive certbot plugin --- global/certbot-dns-plugins.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/global/certbot-dns-plugins.json b/global/certbot-dns-plugins.json index 0758777..2bf4555 100644 --- a/global/certbot-dns-plugins.json +++ b/global/certbot-dns-plugins.json @@ -153,11 +153,11 @@ }, "domainoffensive": { "name": "DomainOffensive (do.de)", - "package_name": "certbot-dns-do", - "version": "~=0.31.0", + "package_name": "certbot-dns-domainoffensive", + "version": "~=2.0.0", "dependencies": "", "credentials": "dns_do_api_token = YOUR_DO_DE_AUTH_TOKEN", - "full_plugin_name": "dns-do" + "full_plugin_name": "dns-domainoffensive" }, "domeneshop": { "name": "Domeneshop", From 356b98bf7eb1421fc3d435b1ecd232ad48e86873 Mon Sep 17 00:00:00 2001 From: ComradeBlin Date: Sun, 22 Dec 2024 01:02:47 +0100 Subject: [PATCH 03/26] Add Gcore DNS Provider --- global/certbot-dns-plugins.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/global/certbot-dns-plugins.json b/global/certbot-dns-plugins.json index d439bc9..ce8da80 100644 --- a/global/certbot-dns-plugins.json +++ b/global/certbot-dns-plugins.json @@ -207,6 +207,14 @@ "credentials": "# Gandi personal access token\ndns_gandi_token=PERSONAL_ACCESS_TOKEN", "full_plugin_name": "dns-gandi" }, + "gcore": { + "name": "Gcore DNS", + "package_name": "certbot-dns-gcore", + "version": "~=0.1.8", + "dependencies": "", + "credentials": "dns_gcore_api_key = 0123456789abcdef0123456789abcdef01234567", + "full_plugin_name": "dns-gcore" + }, "godaddy": { "name": "GoDaddy", "package_name": "certbot-dns-godaddy", From 73110d5e1e365e1f712b5786486d5ae4d41024e3 Mon Sep 17 00:00:00 2001 From: ComradeBlin Date: Sun, 22 Dec 2024 01:44:52 +0100 Subject: [PATCH 04/26] Update Gcore apikey format I managed to mis-write the format in my previous commit --- global/certbot-dns-plugins.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global/certbot-dns-plugins.json b/global/certbot-dns-plugins.json index ce8da80..a090d02 100644 --- a/global/certbot-dns-plugins.json +++ b/global/certbot-dns-plugins.json @@ -212,7 +212,7 @@ "package_name": "certbot-dns-gcore", "version": "~=0.1.8", "dependencies": "", - "credentials": "dns_gcore_api_key = 0123456789abcdef0123456789abcdef01234567", + "credentials": "dns_gcore_apitoken = 0123456789abcdef0123456789abcdef01234567", "full_plugin_name": "dns-gcore" }, "godaddy": { From f1c97c7c36db1471feb5044e51da23a821f764c5 Mon Sep 17 00:00:00 2001 From: dim145 Date: Fri, 3 Jan 2025 00:39:29 +0100 Subject: [PATCH 05/26] fix: add missing group_by clause for access_list get --- backend/internal/access-list.js | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/internal/access-list.js b/backend/internal/access-list.js index 41c975e..10743bf 100644 --- a/backend/internal/access-list.js +++ b/backend/internal/access-list.js @@ -258,6 +258,7 @@ const internalAccessList = { }) .where('access_list.is_deleted', 0) .andWhere('access_list.id', data.id) + .groupBy('access_list.id') .allowGraph('[owner,items,clients,proxy_hosts.[certificate,access_list.[clients,items]]]') .first(); From 5a234bb88ccbef3e051f5331845d103319a518b6 Mon Sep 17 00:00:00 2001 From: Jamie Curnow Date: Tue, 7 Jan 2025 08:13:04 +1000 Subject: [PATCH 06/26] Fix incorrect test folder in ci results --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 224138b..66ed7cb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -128,7 +128,7 @@ pipeline { sh 'docker-compose down --remove-orphans --volumes -t 30 || true' } unstable { - dir(path: 'testing/results') { + dir(path: 'test/results') { archiveArtifacts(allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml') } } @@ -161,7 +161,7 @@ pipeline { sh 'docker-compose down --remove-orphans --volumes -t 30 || true' } unstable { - dir(path: 'testing/results') { + dir(path: 'test/results') { archiveArtifacts(allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml') } } @@ -199,7 +199,7 @@ pipeline { sh 'docker-compose down --remove-orphans --volumes -t 30 || true' } unstable { - dir(path: 'testing/results') { + dir(path: 'test/results') { archiveArtifacts(allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml') } } From 9687e9e450eaf7370f9c17dbfbdd4e2cbf4032d3 Mon Sep 17 00:00:00 2001 From: Jamie Curnow Date: Tue, 7 Jan 2025 10:30:08 +1000 Subject: [PATCH 07/26] Use previous version of powerdns image, newer version is broken --- docker/docker-compose.ci.yml | 2 +- docker/docker-compose.dev.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/docker-compose.ci.yml b/docker/docker-compose.ci.yml index bb68858..022f281 100644 --- a/docker/docker-compose.ci.yml +++ b/docker/docker-compose.ci.yml @@ -40,7 +40,7 @@ services: - ca.internal pdns: - image: pschiffe/pdns-mysql + image: pschiffe/pdns-mysql:4.8 volumes: - '/etc/localtime:/etc/localtime:ro' environment: diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml index 50ca555..5abe057 100644 --- a/docker/docker-compose.dev.yml +++ b/docker/docker-compose.dev.yml @@ -132,7 +132,7 @@ services: - 8128:3128 pdns: - image: pschiffe/pdns-mysql + image: pschiffe/pdns-mysql:4.8 container_name: npm2dev.pdns volumes: - '/etc/localtime:/etc/localtime:ro' @@ -218,7 +218,7 @@ services: env_file: - ci.env ports: - - 9000:9000 + - 9000:9000 depends_on: - authentik-redis - db-postgres From 080bd0b7497361f098f76d116ebdcfce368a822c Mon Sep 17 00:00:00 2001 From: Julian Gassner Date: Wed, 4 Dec 2024 03:45:56 +0100 Subject: [PATCH 08/26] Added status of certificates to the certificate list and show on which domain names the certificates are in use --- backend/internal/certificate.js | 6 +++ backend/models/certificate.js | 39 ++++++++++++++++++- frontend/js/app/dashboard/main.js | 4 +- .../js/app/nginx/certificates/list/item.ejs | 16 +++++++- .../js/app/nginx/certificates/list/item.js | 22 ++++++++--- .../js/app/nginx/certificates/list/main.ejs | 1 + frontend/js/app/nginx/certificates/main.js | 4 +- frontend/js/app/user/form.ejs | 24 ++++++------ frontend/js/app/user/form.js | 2 +- frontend/js/i18n/messages.json | 5 ++- 10 files changed, 96 insertions(+), 27 deletions(-) diff --git a/backend/internal/certificate.js b/backend/internal/certificate.js index 34b8fdf..f2e845a 100644 --- a/backend/internal/certificate.js +++ b/backend/internal/certificate.js @@ -313,6 +313,9 @@ const internalCertificate = { .where('is_deleted', 0) .andWhere('id', data.id) .allowGraph('[owner]') + .allowGraph('[proxy_hosts]') + .allowGraph('[redirection_hosts]') + .allowGraph('[dead_hosts]') .first(); if (access_data.permission_visibility !== 'all') { @@ -464,6 +467,9 @@ const internalCertificate = { .where('is_deleted', 0) .groupBy('id') .allowGraph('[owner]') + .allowGraph('[proxy_hosts]') + .allowGraph('[redirection_hosts]') + .allowGraph('[dead_hosts]') .orderBy('nice_name', 'ASC'); if (access_data.permission_visibility !== 'all') { diff --git a/backend/models/certificate.js b/backend/models/certificate.js index 534d927..294d6de 100644 --- a/backend/models/certificate.js +++ b/backend/models/certificate.js @@ -4,7 +4,6 @@ const db = require('../db'); const helpers = require('../lib/helpers'); const Model = require('objection').Model; -const User = require('./user'); const now = require('./now_helper'); Model.knex(db); @@ -68,6 +67,11 @@ class Certificate extends Model { } static get relationMappings () { + const ProxyHost = require('./proxy_host'); + const DeadHost = require('./dead_host'); + const User = require('./user'); + const RedirectionHost = require('./redirection_host'); + return { owner: { relation: Model.HasOneRelation, @@ -79,6 +83,39 @@ class Certificate extends Model { modify: function (qb) { qb.where('user.is_deleted', 0); } + }, + proxy_hosts: { + relation: Model.HasManyRelation, + modelClass: ProxyHost, + join: { + from: 'certificate.id', + to: 'proxy_host.certificate_id' + }, + modify: function (qb) { + qb.where('proxy_host.is_deleted', 0); + } + }, + dead_hosts: { + relation: Model.HasManyRelation, + modelClass: DeadHost, + join: { + from: 'certificate.id', + to: 'dead_host.certificate_id' + }, + modify: function (qb) { + qb.where('dead_host.is_deleted', 0); + } + }, + redirection_hosts: { + relation: Model.HasManyRelation, + modelClass: RedirectionHost, + join: { + from: 'certificate.id', + to: 'redirection_host.certificate_id' + }, + modify: function (qb) { + qb.where('redirection_host.is_deleted', 0); + } } }; } diff --git a/frontend/js/app/dashboard/main.js b/frontend/js/app/dashboard/main.js index c2e82f8..4765d06 100644 --- a/frontend/js/app/dashboard/main.js +++ b/frontend/js/app/dashboard/main.js @@ -50,8 +50,7 @@ module.exports = Mn.View.extend({ onRender: function () { let view = this; - if (typeof view.stats.hosts === 'undefined') { - Api.Reports.getHostStats() + Api.Reports.getHostStats() .then(response => { if (!view.isDestroyed()) { view.stats.hosts = response; @@ -61,7 +60,6 @@ module.exports = Mn.View.extend({ .catch(err => { console.log(err); }); - } }, /** diff --git a/frontend/js/app/nginx/certificates/list/item.ejs b/frontend/js/app/nginx/certificates/list/item.ejs index 9a0d6b2..179a819 100644 --- a/frontend/js/app/nginx/certificates/list/item.ejs +++ b/frontend/js/app/nginx/certificates/list/item.ejs @@ -33,6 +33,13 @@ <%- formatDbDate(expires_on, 'Do MMMM YYYY, h:mm a') %> + + <% if (active_domain_names().length > 0) { %> + <%- i18n('certificates', 'in-use') %> + <% } else { %> + <%- i18n('certificates', 'inactive') %> + <% } %> + <% if (canManage) { %> -<% } %> +<% } %> \ No newline at end of file diff --git a/frontend/js/app/nginx/certificates/list/item.js b/frontend/js/app/nginx/certificates/list/item.js index 7fa1c68..b9a927a 100644 --- a/frontend/js/app/nginx/certificates/list/item.js +++ b/frontend/js/app/nginx/certificates/list/item.js @@ -44,14 +44,24 @@ module.exports = Mn.View.extend({ }, }, - templateContext: { - canManage: App.Cache.User.canManage('certificates'), - isExpired: function () { - return moment(this.expires_on).isBefore(moment()); - }, - dns_providers: dns_providers + templateContext: function () { + return { + canManage: App.Cache.User.canManage('certificates'), + isExpired: function () { + return moment(this.expires_on).isBefore(moment()); + }, + dns_providers: dns_providers, + active_domain_names: function () { + const { proxy_hosts = [], redirect_hosts = [], dead_hosts = [] } = this; + return [...proxy_hosts, ...redirect_hosts, ...dead_hosts].reduce((acc, host) => { + acc.push(...(host.domain_names || [])); + return acc; + }, []); + } + }; }, + initialize: function () { this.listenTo(this.model, 'change', this.render); } diff --git a/frontend/js/app/nginx/certificates/list/main.ejs b/frontend/js/app/nginx/certificates/list/main.ejs index aa49a27..329b584 100644 --- a/frontend/js/app/nginx/certificates/list/main.ejs +++ b/frontend/js/app/nginx/certificates/list/main.ejs @@ -3,6 +3,7 @@ <%- i18n('str', 'name') %> <%- i18n('all-hosts', 'cert-provider') %> <%- i18n('str', 'expires') %> + <%- i18n('str', 'status') %> <% if (canManage) { %>   <% } %> diff --git a/frontend/js/app/nginx/certificates/main.js b/frontend/js/app/nginx/certificates/main.js index 8956276..3f9f022 100644 --- a/frontend/js/app/nginx/certificates/main.js +++ b/frontend/js/app/nginx/certificates/main.js @@ -74,7 +74,7 @@ module.exports = Mn.View.extend({ e.preventDefault(); let query = this.ui.query.val(); - this.fetch(['owner'], query) + this.fetch(['owner','proxy_hosts', 'dead_hosts', 'redirection_hosts'], query) .then(response => this.showData(response)) .catch(err => { this.showError(err); @@ -89,7 +89,7 @@ module.exports = Mn.View.extend({ onRender: function () { let view = this; - view.fetch(['owner']) + view.fetch(['owner','proxy_hosts', 'dead_hosts', 'redirection_hosts']) .then(response => { if (!view.isDestroyed()) { if (response && response.length) { diff --git a/frontend/js/app/user/form.ejs b/frontend/js/app/user/form.ejs index aeb268f..9ba8443 100644 --- a/frontend/js/app/user/form.ejs +++ b/frontend/js/app/user/form.ejs @@ -1,10 +1,10 @@ -