Certificate Authority work

This commit is contained in:
Jamie Curnow
2021-07-29 17:45:14 +10:00
parent ae00ab09e4
commit 339ee13346
35 changed files with 737 additions and 136 deletions

View File

@@ -7,7 +7,11 @@
"created_on",
"modified_on",
"name",
"acme2_url"
"acmesh_server",
"ca_bundle",
"max_domains",
"is_wildcard_supported",
"is_setup"
],
"properties": {
"id": {
@@ -27,10 +31,25 @@
"minLength": 1,
"maxLength": 100
},
"acme2_url": {
"acmesh_server": {
"type": "string",
"minLength": 8,
"minLength": 2,
"maxLength": 255
},
"ca_bundle": {
"type": "string",
"minLength": 0,
"maxLength": 255
},
"max_domains": {
"type": "integer",
"minimum": 1
},
"is_wildcard_supported": {
"type": "boolean"
},
"is_setup": {
"type": "boolean"
}
}
}

View File

@@ -49,6 +49,9 @@
"type": "integer",
"minimum": 0
},
"certificate_authority": {
"$ref": "#/components/schemas/CertificateAuthorityObject"
},
"dns_provider_id": {
"type": "integer",
"minimum": 0

View File

@@ -37,10 +37,14 @@
"value": {
"result": {
"id": 1,
"created_on": 1602588511,
"modified_on": 1602588511,
"name": "Let's Encrypt",
"acme2_url": "https://acme-v02.api.letsencrypt.org/directory"
"created_on": 1627531400,
"modified_on": 1627531400,
"name": "ZeroSSL",
"acmesh_server": "zerossl",
"ca_bundle": "",
"max_domains": 10,
"is_wildcard_supported": true,
"is_setup": false
}
}
}

View File

@@ -46,10 +46,14 @@
"value": {
"result": {
"id": 1,
"created_on": 1602588511,
"modified_on": 1602588511,
"name": "Let's Encrypt",
"acme2_url": "https://acme-v02.api.letsencrypt.org/directory"
"created_on": 1627531400,
"modified_on": 1627531400,
"name": "ZeroSSL",
"acmesh_server": "zerossl",
"ca_bundle": "",
"max_domains": 10,
"is_wildcard_supported": true,
"is_setup": false
}
}
}

View File

@@ -64,17 +64,25 @@
"items": [
{
"id": 1,
"created_on": 1602588511,
"modified_on": 1602588511,
"name": "Let's Encrypt",
"acme2_url": "https://acme-v02.api.letsencrypt.org/directory"
"created_on": 1627531400,
"modified_on": 1627531400,
"name": "ZeroSSL",
"acmesh_server": "zerossl",
"ca_bundle": "",
"max_domains": 10,
"is_wildcard_supported": true,
"is_setup": false
},
{
"id": 2,
"created_on": 1602588511,
"modified_on": 1602588511,
"name": "Let's Encrypt (Staging)",
"acme2_url": "https://acme-staging-v02.api.letsencrypt.org/directory"
"created_on": 1627531400,
"modified_on": 1627531400,
"name": "Let's Encrypt",
"acmesh_server": "https://acme-v02.api.letsencrypt.org/directory",
"ca_bundle": "",
"max_domains": 10,
"is_wildcard_supported": true,
"is_setup": false
}
]
}

View File

@@ -32,11 +32,15 @@
"default": {
"value": {
"result": {
"id": 3,
"created_on": 1602588900,
"modified_on": 1602588900,
"name": "Boulder",
"acme2_url": "https://boulder.local/directory"
"id": 1,
"created_on": 1627531400,
"modified_on": 1627531400,
"name": "ZeroSSL",
"acmesh_server": "zerossl",
"ca_bundle": "",
"max_domains": 10,
"is_wildcard_supported": true,
"is_setup": false
}
}
}

View File

@@ -56,7 +56,11 @@ CREATE TABLE IF NOT EXISTS `certificate_authority`
created_on INTEGER NOT NULL DEFAULT 0,
modified_on INTEGER NOT NULL DEFAULT 0,
name TEXT NOT NULL,
acme2_url TEXT NOT NULL,
acmesh_server TEXT NOT NULL DEFAULT "",
is_setup INTEGER NOT NULL DEFAULT 0,
ca_bundle TEXT NOT NULL DEFAULT "",
is_wildcard_supported INTEGER NOT NULL DEFAULT 0, -- specific to each CA, acme v1 doesn't usually have wildcards
max_domains INTEGER NOT NULL DEFAULT 5, -- per request
is_deleted INTEGER NOT NULL DEFAULT 0
);

View File

@@ -36,20 +36,51 @@ INSERT INTO `certificate_authority` (
created_on,
modified_on,
name,
acme2_url
acmesh_server,
is_wildcard_supported,
max_domains
) VALUES (
strftime('%s', 'now'),
strftime('%s', 'now'),
"Let's Encrypt",
"https://acme-v02.api.letsencrypt.org/directory"
"ZeroSSL",
"zerossl",
1,
10
), (
strftime('%s', 'now'),
strftime('%s', 'now'),
"Let's Encrypt (Staging)",
"https://acme-staging-v02.api.letsencrypt.org/directory"
"Let's Encrypt",
"https://acme-v02.api.letsencrypt.org/directory",
1,
10
), (
strftime('%s', 'now'),
strftime('%s', 'now'),
"Buypass Go SSL",
"https://api.buypass.com/acme/directory",
0,
5
), (
strftime('%s', 'now'),
strftime('%s', 'now'),
"Let's Encrypt (Testing)",
"https://acme-staging-v02.api.letsencrypt.org/directory",
1,
10
), (
strftime('%s', 'now'),
strftime('%s', 'now'),
"Buypass Go SSL (Testing)",
"https://api.test4.buypass.no/acme/directory",
0,
5
), (
strftime('%s', 'now'),
strftime('%s', 'now'),
"SSL.com",
"ssl.com",
0,
10
);
-- migrate:down
-- Not allowed to go down from initial