-
Notifications
You must be signed in to change notification settings - Fork 3k
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
base: develop
Are you sure you want to change the base?
Changes from all commits
e6ec74c
8e9e033
891877a
2723de2
5e7b69c
95a94a4
111fc28
04b3608
cb79556
eb5c51a
2e45444
5ba7363
f386f6b
32e0784
f68c1b7
1353937
04636b7
5dc78df
c6d884d
ad36fb5
65f971f
a121cb1
d3a5fac
2cab405
101afa0
408eab8
c135880
f34cb59
3856b6b
08f95a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const migrate_name = 'identifier_for_migrate'; | ||
mnr73 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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'`); | ||
|
||
return knex.schema.alterTable('certificate', (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'`); | ||
|
||
return knex.schema.alterTable('certificate', (table) => { | ||
table.dropColumn('ssl_key_type'); | ||
}); | ||
}).then(() => { | ||
logger.info(`[${migrate_name}] Column 'ssl_key_type' removed from table 'proxy_host'`); | ||
}); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const migrate_name = 'default_server'; | ||
const logger = require('../logger').migrate; | ||
|
||
/** | ||
* Migrate Up | ||
* | ||
* @param {Object} knex | ||
* @param {Promise} Promise | ||
* @returns {Promise} | ||
*/ | ||
exports.up = function (knex) { | ||
logger.info(`[${migrate_name}] Migrating Up...`); | ||
|
||
// Add default_server column to proxy_host table | ||
return knex.schema.table('proxy_host', (table) => { | ||
table.boolean('default_server').notNullable().defaultTo(false); | ||
}) | ||
.then(() => { | ||
logger.info(`[${migrate_name}] Column 'default_server' added to 'proxy_host' table`); | ||
}); | ||
}; | ||
|
||
/** | ||
* Migrate Down | ||
* | ||
* @param {Object} knex | ||
* @param {Promise} Promise | ||
* @returns {Promise} | ||
*/ | ||
exports.down = function (knex) { | ||
logger.info(`[${migrate_name}] Migrating Down...`); | ||
|
||
// Remove default_server column from proxy_host table | ||
return knex.schema.table('proxy_host', (table) => { | ||
table.dropColumn('default_server'); | ||
}) | ||
.then(() => { | ||
logger.info(`[${migrate_name}] Column 'default_server' removed from 'proxy_host' table`); | ||
}); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
text = True | ||
non-interactive = True | ||
webroot-path = /data/letsencrypt-acme-challenge | ||
key-type = ecdsa | ||
elliptic-curve = secp384r1 | ||
preferred-chain = ISRG Root X1 | ||
server = |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
text = True | ||
non-interactive = True | ||
webroot-path = /data/letsencrypt-acme-challenge | ||
key-type = ecdsa | ||
elliptic-curve = secp384r1 | ||
preferred-chain = ISRG Root X1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# intermediate configuration. tweak to your needs. | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384'; | ||
ssl_ciphers "ALL:RC4-SHA:AES128-SHA:AES256-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:AES256-GCM-SHA384:AES128-GCM-SHA256:RSA-AES256-CBC-SHA:RC4-MD5:DES-CBC3-SHA:AES256-SHA:RC4-SHA:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384"; | ||
ssl_prefer_server_ciphers off; | ||
ssl_ecdh_curve X25519:prime256v1:secp384r1; | ||
ssl_dhparam /etc/ssl/certs/dhparam.pem; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be achieved using the S6 init scripts instead of adding another layer of initialization. However this might not be required here at all... Can this file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if generate this file in build time. it's be same for all user that use this and i think this is a security problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok maybe, but why would it be different for all users when they are all using the same docker image? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The DH parameter file is used for secure key exchange, and having the same file for all users can compromise security. It’s recommended to generate a unique file per instance to ensure the security of each user’s connection. |
||
|
||
FILE="/etc/ssl/certs/dhparam.pem" | ||
|
||
if [ ! -f "$FILE" ]; then | ||
echo "the $FILE does not exist, creating..." | ||
openssl dhparam -out "$FILE" 2048 | ||
else | ||
echo "the $FILE already exists, skipping..." | ||
fi | ||
|
||
echo "run default script" | ||
exec /init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default server thing doesn't work. Here's some thoughts:
./backend/templates/default.conf
sets the default site already, so turning it on for any host always causes an error and makes it "Offline" even when passing yourcheckDefaultServerNotExist
test belowThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that when I try to connect to the server with an IoT device, the connection fails. After some research, I found this command:
openssl s_client -connect :443
However, this command returns no response.
When I add a default server to one of the Nginx host configurations, everything works correctly. The above command returns a response, and the IoT device can connect to all the hosts configured in Nginx Proxy Manager.
so i add this feature and its work without any problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Well it was implemented by another contributor a long time ago, that the default HTTPS host returns a bad cipher/ssl cert or something like that. There was a very good reason for that at the time.
The default-site config doesn't apply to HTTPS though, since any certificate assigned to that would always be invalid for a catch-all domain.
Is there no other way you can fetch the ciphers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that the certificate for a default server would always be invalid. However, I haven't found any other solution. Even when I manually configured Nginx (before switching to Nginx Proxy Manager), I spent a week troubleshooting this issue. Without setting a default server in one of the configurations, IoT devices simply cannot connect.
I believe this issue might be related to how SNI is handled.