Skip to content

Commit 0d9da2b

Browse files
committed
merge upstream
1 parent 395909c commit 0d9da2b

File tree

15 files changed

+45
-258
lines changed

15 files changed

+45
-258
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ RUN ln -s /app/password-reset.js /usr/local/bin/password-reset.js && \
5050
ln -s /app/index.js /usr/local/bin/index.js
5151

5252
ENV NODE_ENV=production \
53-
DB_SQLITE_FILE=/data/database.sqlite
53+
NODE_CONFIG_DIR=/data/etc/npm \
54+
DB_SQLITE_FILE=/data/etc/npm/database.sqlite
5455

5556
WORKDIR /app
5657
ENTRYPOINT ["start.sh"]

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ so that the barrier for entry here is low.
4646
- Only use TLSv1.2 and TLSv1.3
4747
- Uses OCSP Stapling
4848
- Needs manual migration if you use custom certificates, just upload the CA/Intermediate Certificate (file name: `chain.pem`) in the `/opt/npm/tls/custom/npm-[certificate-id]` folder
49+
- fixed dnspod plugin
50+
- Needs manual migration, please delete all dnspod certs and recreate them OR you manually change the credentialsfile (see [here](https://github.com/ZoeyVid/nginx-proxy-manager/blob/develop/global/certbot-dns-plugins.js) for the template)
4951
- Smaller then the original
5052
- Runs the admin interface on port 81 with https
5153
- Default page runs also with https
@@ -64,18 +66,18 @@ so that the barrier for entry here is low.
6466
- Auto database vacuum (only sqlite) (FULLCLEAN=true)
6567
- Auto certbot old certs clean (FULLCLEAN=true)
6668
- Passwort reset (only sqlite) (`docker exec -it nginx-proxy-manager password-reset.js USER_EMAIL PASSWORD`)
69+
- TLS supported for MariaDB/MySQL, please set the `DB_MYSQL_TLS` env to true. If you use self signed certificates you can upload them for example to `/data/etc/npm/ca.crt` and set the `DB_MYSQL_CA` to `/data/etc/npm/ca.crt` (not tested)
6770

6871
## Soon
69-
- disabling IPv4/IPv6
70-
- MariaDB/MySQL TLS support (if requested)
72+
- disabling IPv4/IPv6 ([1](https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/40-dynamic.sh) / [2](https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/50-ipv6.sh) / nginx templates (nginx.js lines 200-300))
7173
- support changing the PUID/PGID (maybe)
7274
- more
7375

7476
## migration
7577
- **NOTE: migrating back to the original is not possible**, so make first a **backup** before migration, so you can use the backup to switch back
7678
- if you use custom certificates, you need to upload the CA/Intermediate Certificate (file name: `chain.pem`) in the `/opt/npm/tls/custom/npm-[certificate-id]` folder
7779
- some buttons have changed, check if they are still correct
78-
- please delete all dnspod certs and recreate them
80+
- please delete all dnspod certs and recreate them OR you manually change the credentialsfile (see [here](https://github.com/ZoeyVid/nginx-proxy-manager/blob/develop/global/certbot-dns-plugins.js) for the template)
7981
- changing the PUID/PGID is not supported (since it would break running in network_mode host)
8082

8183
# Use as webserver

backend/db.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const config = require('./lib/config');
22

33
if (!config.has('database')) {
4-
throw new Error('Database config does not exist! Please read the instructions: https://nginxproxymanager.com/setup/');
4+
throw new Error('Database config does not exist! Please read the instructions: https://nginxproxymanager.com/setup');
55
}
66

77
function generateDbConfig() {
@@ -16,7 +16,8 @@ function generateDbConfig() {
1616
user: cfg.user,
1717
password: cfg.password,
1818
database: cfg.name,
19-
port: cfg.port
19+
port: cfg.port,
20+
ssl: cfg.tls,
2021
},
2122
migrations: {
2223
tableName: 'migrations'

backend/internal/certificate.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const https = require('https');
44
const tempWrite = require('temp-write');
55
const moment = require('moment');
66
const logger = require('../logger').ssl;
7-
const config = require('../lib/config');
87
const error = require('../lib/error');
98
const utils = require('../lib/utils');
109
const certificateModel = require('../models/certificate');
@@ -16,8 +15,8 @@ const archiver = require('archiver');
1615
const path = require('path');
1716
const { isArray } = require('lodash');
1817

19-
const letsencryptConfig = '/data/tls/certbot/config.ini';
20-
const certbotCommand = 'certbot --config-dir /data/tls/certbot';
18+
const certbotConfig = '/data/tls/certbot/config.ini';
19+
const certbotCommand = 'certbot --config-dir /data/tls/certbot';
2120

2221
function omissions() {
2322
return ['is_deleted'];

backend/lib/config.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ const fs = require('fs');
22
const NodeRSA = require('node-rsa');
33
const logger = require('../logger').global;
44

5-
const keysFile = '/data/keys.json';
5+
const keysFile = '/data/etc/npm/keys.json';
66

77
let instance = null;
88

99
// 1. Load from config file first (not recommended anymore)
1010
// 2. Use config env variables next
1111
const configure = () => {
12-
const filename = (process.env.NODE_CONFIG_DIR || './config') + '/' + (process.env.NODE_ENV || 'default') + '.json';
12+
const filename = (process.env.NODE_CONFIG_DIR || '/data/etc/npm') + '/' + (process.env.NODE_ENV || 'default') + '.json';
1313
if (fs.existsSync(filename)) {
1414
let configData;
1515
try {
@@ -29,6 +29,8 @@ const configure = () => {
2929
const envMysqlHost = process.env.DB_MYSQL_HOST || null;
3030
const envMysqlUser = process.env.DB_MYSQL_USER || null;
3131
const envMysqlName = process.env.DB_MYSQL_NAME || null;
32+
const envMysqlTls = process.env.DB_MYSQL_TLS || null;
33+
const envMysqlCa = process.env.DB_MYSQL_CA || '/etc/ssl/certs/ca-certificates.crt';
3234
if (envMysqlHost && envMysqlUser && envMysqlName) {
3335
// we have enough mysql creds to go with mysql
3436
logger.info('Using MySQL configuration');
@@ -40,13 +42,14 @@ const configure = () => {
4042
user: envMysqlUser,
4143
password: process.env.DB_MYSQL_PASSWORD,
4244
name: envMysqlName,
45+
ssl: envMysqlTls ? { ca: fs.readFileSync(envMysqlCa) } : false,
4346
},
4447
keys: getKeys(),
4548
};
4649
return;
4750
}
4851

49-
const envSqliteFile = process.env.DB_SQLITE_FILE || '/data/database.sqlite';
52+
const envSqliteFile = process.env.DB_SQLITE_FILE || '/data/etc/npm/database.sqlite';
5053
logger.info(`Using Sqlite: ${envSqliteFile}`);
5154
instance = {
5255
database: {

docker/rootfs/bin/common.sh

Lines changed: 0 additions & 42 deletions
This file was deleted.

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/00-all.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/10-npmuser.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/20-paths.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/30-ownership.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)