Skip to content

feat: add support for selecting SSL key type (ECDSA/RSA) #4218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e6ec74c
feat: add support for selecting SSL key type (ECDSA/RSA)
mnr73 Dec 9, 2024
8e9e033
fix indent: tab to space
mnr73 Dec 9, 2024
891877a
fix ssl key-type certificate
mnr73 Dec 11, 2024
2723de2
add ssl_ecdh_curve for more compatibility
mnr73 Dec 11, 2024
5e7b69c
add update cipher suites
mnr73 Dec 11, 2024
95a94a4
add elliptic-curve
mnr73 Dec 11, 2024
111fc28
Revert "add elliptic-curve"
mnr73 Dec 11, 2024
04b3608
remove elliptic-curve from certbot command options
mnr73 Dec 11, 2024
cb79556
add ssl_key_type in swagger
mnr73 Dec 12, 2024
eb5c51a
add support more cipher suites
mnr73 Dec 12, 2024
2e45444
change ssl_ciphers for more compatibility
mnr73 Dec 12, 2024
5ba7363
fix ssl cipher bug
mnr73 Dec 13, 2024
f386f6b
remove elliptic-curve
mnr73 Dec 13, 2024
32e0784
support more cipher suites
mnr73 Dec 21, 2024
f68c1b7
add Diffie-Hellman Parameters to cipher suites
mnr73 Dec 21, 2024
1353937
fix copy address
mnr73 Dec 21, 2024
04636b7
add feature: set default server
mnr73 Dec 21, 2024
5dc78df
fix messages indent: convert to space
mnr73 Dec 22, 2024
c6d884d
fix indent
mnr73 Dec 22, 2024
ad36fb5
show select ssl key type just for create new ssl
mnr73 Jan 1, 2025
65f971f
add migration names and combine ssl key migrations
mnr73 Jan 1, 2025
a121cb1
remove unnecessary whitespace
mnr73 Jan 1, 2025
d3a5fac
make ssl_key_type optional
mnr73 Jan 1, 2025
2cab405
Merge branch 'fix-bugs' into develop
mnr73 Jan 1, 2025
101afa0
remove default_server from certificate object
mnr73 Jan 3, 2025
408eab8
remove unesessary default values
mnr73 Jan 4, 2025
c135880
Revert "remove default_server from certificate object"
mnr73 Jan 4, 2025
f34cb59
Revert "remove unesessary default values"
mnr73 Jan 4, 2025
3856b6b
remove default server from certificate object
mnr73 Jan 8, 2025
08f95a9
Merge remote-tracking branch 'upstream/develop' into develop
mnr73 Feb 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: add support for selecting SSL key type (ECDSA/RSA)
Added the ability to specify the SSL key type (ECDSA or RSA) for each site in the Nginx Proxy Manager. This enhancement is particularly useful for environments with IoT devices that have limitations with specific key types, such as RSA-only support. The implementation includes:

- Backend support for storing and validating the `ssl_key_type` field.
- Swagger schema updated to validate the new input.
- Frontend update to allow users to select the SSL key type via a dropdown menu.

This feature ensures greater flexibility and compatibility in managing SSL certificates for diverse setups.
  • Loading branch information
mnr73 committed Dec 9, 2024
commit e6ec74c2f77fba5ce1b253f3d811696749c2b49b
5 changes: 5 additions & 0 deletions backend/internal/certificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@ const internalCertificate = {

const cmd = `${certbotCommand} certonly ` +
`--config '${letsencryptConfig}' ` +
`--key-type '${certificate.ssl_key_type}' ` +
'--work-dir "/tmp/letsencrypt-lib" ' +
'--logs-dir "/tmp/letsencrypt-log" ' +
`--cert-name "npm-${certificate.id}" ` +
Expand Down Expand Up @@ -873,6 +874,7 @@ const internalCertificate = {

let mainCmd = certbotCommand + ' certonly ' +
`--config '${letsencryptConfig}' ` +
`--key-type '${certificate.ssl_key_type}' ` +
'--work-dir "/tmp/letsencrypt-lib" ' +
'--logs-dir "/tmp/letsencrypt-log" ' +
`--cert-name 'npm-${certificate.id}' ` +
Expand Down Expand Up @@ -969,6 +971,7 @@ const internalCertificate = {

const cmd = certbotCommand + ' renew --force-renewal ' +
`--config '${letsencryptConfig}' ` +
`--key-type '${certificate.ssl_key_type}' ` +
'--work-dir "/tmp/letsencrypt-lib" ' +
'--logs-dir "/tmp/letsencrypt-log" ' +
`--cert-name 'npm-${certificate.id}' ` +
Expand Down Expand Up @@ -1002,6 +1005,7 @@ const internalCertificate = {

let mainCmd = certbotCommand + ' renew --force-renewal ' +
`--config "${letsencryptConfig}" ` +
`--key-type '${certificate.ssl_key_type}' ` +
'--work-dir "/tmp/letsencrypt-lib" ' +
'--logs-dir "/tmp/letsencrypt-log" ' +
`--cert-name 'npm-${certificate.id}' ` +
Expand Down Expand Up @@ -1035,6 +1039,7 @@ const internalCertificate = {

const mainCmd = certbotCommand + ' revoke ' +
`--config '${letsencryptConfig}' ` +
`--key-type '${certificate.ssl_key_type}' ` +
'--work-dir "/tmp/letsencrypt-lib" ' +
'--logs-dir "/tmp/letsencrypt-log" ' +
`--cert-path '/etc/letsencrypt/live/npm-${certificate.id}/fullchain.pem' ` +
Expand Down
39 changes: 39 additions & 0 deletions backend/migrations/20241209062244_ssl_key_type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const migrate_name = 'identifier_for_migrate';
const logger = require('../logger').migrate;

/**
* Migrate
*
* @see http://knexjs.org/#Schema
*
* @param {Object} knex
* @param {Promise} Promise
* @returns {Promise}
*/
exports.up = function (knex) {

logger.info(`[${migrate_name}] Migrating Up...`);

return knex.schema.alterTable('proxy_host', (table) => {
table.enum('ssl_key_type', ['ecdsa', 'rsa']).defaultTo('ecdsa').notNullable();
}).then(() => {
logger.info(`[${migrate_name}] Column 'ssl_key_type' added to table 'proxy_host'`);
});
};

/**
* Undo Migrate
*
* @param {Object} knex
* @param {Promise} Promise
* @returns {Promise}
*/
exports.down = function (knex) {
logger.info(`[${migrate_name}] Migrating Down...`);

return knex.schema.alterTable('proxy_host', (table) => {
table.dropColumn('ssl_key_type');
}).then(() => {
logger.info(`[${migrate_name}] Column 'ssl_key_type' removed from table 'proxy_host'`);
});
};
6 changes: 6 additions & 0 deletions backend/schema/components/proxy-host-object.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"locations",
"hsts_enabled",
"hsts_subdomains",
"ssl_key_type",
"certificate"
],
"additionalProperties": false,
Expand Down Expand Up @@ -149,6 +150,11 @@
"$ref": "./access-list-object.json"
}
]
},
"ssl_key_type": {
"type": "string",
"enum": ["ecdsa", "rsa"],
"description": "Type of SSL key (either ecdsa or rsa)"
}
}
}
3 changes: 3 additions & 0 deletions backend/schema/paths/nginx/proxy-hosts/hostID/put.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
},
"locations": {
"$ref": "../../../../components/proxy-host-object.json#/properties/locations"
},
"ssl_key_type": {
"$ref": "../../../../components/proxy-host-object.json#/properties/ssl_key_type"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions backend/schema/paths/nginx/proxy-hosts/post.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
},
"locations": {
"$ref": "../../../components/proxy-host-object.json#/properties/locations"
},
"ssl_key_type": {
"$ref": "../../../components/proxy-host-object.json#/properties/ssl_key_type"
}
}
}
Expand Down
1 change: 0 additions & 1 deletion docker/dev/letsencrypt.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
text = True
non-interactive = True
webroot-path = /data/letsencrypt-acme-challenge
key-type = ecdsa
elliptic-curve = secp384r1
preferred-chain = ISRG Root X1
server =
1 change: 0 additions & 1 deletion docker/rootfs/etc/letsencrypt.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
text = True
non-interactive = True
webroot-path = /data/letsencrypt-acme-challenge
key-type = ecdsa
elliptic-curve = secp384r1
preferred-chain = ISRG Root X1
9 changes: 9 additions & 0 deletions frontend/js/app/nginx/proxy/form.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@
</select>
</div>
</div>
<div class="col-sm-12 col-md-12">
<div class="form-group">
<label class="form-label"><%- i18n('all-hosts', 'ssl-key-type') %></label>
<select name="ssl_key_type" class="form-control custom-select">
<option value="ecdsa" data-data="{&quot;id&quot;:&quot;ecdsa&quot;}" <%- ssl_key_type == 'ecdsa' ? 'selected' : '' %>>ECDSA</option>
<option value="rsa" data-data="{&quot;id&quot;:&quot;rsa&quot;}" <%- ssl_key_type == 'rsa' ? 'selected' : '' %>>RSA</option>
</select>
</div>
</div>
<div class="col-sm-6 col-md-6">
<div class="form-group">
<label class="custom-switch">
Expand Down
1 change: 1 addition & 0 deletions frontend/js/i18n/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"block-exploits": "Block Common Exploits",
"caching-enabled": "Cache Assets",
"ssl-certificate": "SSL Certificate",
"ssl-key-type": "SSL Key Type",
"none": "None",
"new-cert": "Request a new SSL Certificate",
"with-le": "with Let's Encrypt",
Expand Down
1 change: 1 addition & 0 deletions frontend/js/models/dead-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const model = Backbone.Model.extend({
modified_on: null,
domain_names: [],
certificate_id: 0,
ssl_key_type: 'ecdsa',
ssl_forced: false,
http2_support: false,
hsts_enabled: false,
Expand Down
1 change: 1 addition & 0 deletions frontend/js/models/proxy-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const model = Backbone.Model.extend({
forward_port: null,
access_list_id: 0,
certificate_id: 0,
ssl_key_type: 'ecdsa',
ssl_forced: false,
hsts_enabled: false,
hsts_subdomains: false,
Expand Down
1 change: 1 addition & 0 deletions frontend/js/models/redirection-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const model = Backbone.Model.extend({
forward_domain_name: '',
preserve_path: true,
certificate_id: 0,
ssl_key_type: 'ecdsa',
ssl_forced: false,
hsts_enabled: false,
hsts_subdomains: false,
Expand Down