merge upstream

Signed-off-by: Zoey <zoey@z0ey.de>
This commit is contained in:
Zoey 2024-10-11 12:03:56 +02:00
parent 19c5fe2a87
commit 13f3f0d2f0
No known key found for this signature in database
GPG key ID: 02A3919EB4F67328
19 changed files with 28 additions and 138 deletions

View file

@ -70,7 +70,7 @@ RUN apk upgrade --no-cache -a && \
FROM zoeyvid/nginx-quic:347-python
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
COPY rootfs /
COPY --from=zoeyvid/certbot-docker:53 /usr/local /usr/local
COPY --from=zoeyvid/certbot-docker:58 /usr/local /usr/local
COPY --from=zoeyvid/curl-quic:419 /usr/local/bin/curl /usr/local/bin/curl
ARG CRS_VER=v4.7.0

View file

@ -97,7 +97,7 @@ const internalNginx = {
reload: () => {
return internalNginx.test().then(() => {
try {
utils.exec('certbot-ocsp-fetcher.sh -c /data/tls/certbot -o /data/tls/certbot/live --quiet --no-reload-webserver || true');
utils.exec('certbot-ocsp-fetcher.sh -c /data/tls/certbot -o /data/tls/certbot/live --no-reload-webserver --quiet || true');
} catch {
// do nothing
}

View file

@ -3,7 +3,7 @@ module.exports = function (req, res, next) {
res.set({
'Access-Control-Allow-Origin': req.headers.origin,
'Access-Control-Allow-Credentials': true,
'Access-Control-Allow-Methods': 'OPTIONS, GET, POST',
'Access-Control-Allow-Methods': 'OPTIONS, GET, POST, PUT',
'Access-Control-Allow-Headers': 'Content-Type, Cache-Control, Pragma, Expires, Authorization, X-Dataset-Total, X-Dataset-Offset, X-Dataset-Limit',
'Access-Control-Max-Age': 5 * 60,
'Access-Control-Expose-Headers': 'X-Dataset-Total, X-Dataset-Offset, X-Dataset-Limit',

View file

@ -30,12 +30,11 @@
"license": "MIT",
"devDependencies": {
"@apidevtools/swagger-parser": "10.1.0",
"chalk": "4.1.2",
"@eslint/js": "9.12.0",
"eslint": "9.12.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.2.1",
"globals": "15.11.0",
"nodemon": "2.0.22",
"prettier": "3.3.3"
},
"scripts": {

View file

@ -198,7 +198,7 @@ router
});
/**
* Renew LE Certs
* Renew certbot Certs
*
* /api/nginx/certificates/123/renew
*/
@ -227,7 +227,7 @@ router
});
/**
* Download LE Certs
* Download certbot Certs
*
* /api/nginx/certificates/123/download
*/

View file

@ -72,7 +72,7 @@
"description": "Domain Names separated by a comma",
"type": "array",
"minItems": 1,
"maxItems": 100,
"maxItems": 99,
"uniqueItems": true,
"items": {
"type": "string",

View file

@ -17,9 +17,9 @@
"$ref": "../common.json#/properties/user_id"
},
"incoming_port": {
"type": "integer",
"minimum": 1,
"maximum": 65535
"type": "string",
"pattern": "^([0-9]+|[0-9]+-[0-9]+)$",
"maxLength": 11
},
"forwarding_host": {
"anyOf": [

View file

@ -3,7 +3,6 @@ const refParser = require('@apidevtools/json-schema-ref-parser');
let compiledSchema = null;
module.exports = {
/**
* Compiles the schema, by dereferencing it, only once
* and returns the memory cached value
@ -26,16 +25,9 @@ module.exports = {
* @returns string|null
*/
getValidationSchema: (path, method) => {
if (compiledSchema !== null &&
typeof compiledSchema.paths[path] !== 'undefined' &&
typeof compiledSchema.paths[path][method] !== 'undefined' &&
typeof compiledSchema.paths[path][method].requestBody !== 'undefined' &&
typeof compiledSchema.paths[path][method].requestBody.content !== 'undefined' &&
typeof compiledSchema.paths[path][method].requestBody.content['application/json'] !== 'undefined' &&
typeof compiledSchema.paths[path][method].requestBody.content['application/json'].schema !== 'undefined'
) {
if (compiledSchema !== null && typeof compiledSchema.paths[path] !== 'undefined' && typeof compiledSchema.paths[path][method] !== 'undefined' && typeof compiledSchema.paths[path][method].requestBody !== 'undefined' && typeof compiledSchema.paths[path][method].requestBody.content !== 'undefined' && typeof compiledSchema.paths[path][method].requestBody.content['application/json'] !== 'undefined' && typeof compiledSchema.paths[path][method].requestBody.content['application/json'].schema !== 'undefined') {
return compiledSchema.paths[path][method].requestBody.content['application/json'].schema;
}
return null;
}
},
};

View file

@ -45,13 +45,13 @@
"current": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"maxLength": 99,
"example": "changeme"
},
"secret": {
"type": "string",
"minLength": 8,
"maxLength": 64,
"maxLength": 99,
"example": "mySuperN3wP@ssword!"
}
}

View file

@ -1,7 +1,7 @@
{
"openapi": "3.1.0",
"info": {
"title": "Nginx Proxy Manager API",
"title": "NPMplus API",
"version": "2.x.x"
},
"servers": [

View file

@ -1,5 +1,4 @@
const SwaggerParser = require('@apidevtools/swagger-parser');
const chalk = require('chalk');
const schema = require('./schema');
const log = console.log;
@ -7,10 +6,10 @@ schema.getCompiledSchema().then(async (swaggerJSON) => {
try {
const api = await SwaggerParser.validate(swaggerJSON);
console.log('API name: %s, Version: %s', api.info.title, api.info.version);
log(chalk.green(' Schema is valid'));
log(' Schema is valid');
} catch (e) {
console.error(e);
log(chalk.red('', e.message), '\n');
log('', e.message, '\n');
process.exit(1);
}
});

View file

@ -587,8 +587,9 @@ find /data/nginx -type f -name '*.conf' -not -path "/data/nginx/custom/*" -exec
find /data/nginx -type f -name '*.conf' -not -path "/data/nginx/custom/*" -exec sed -i "/ssl_stapling/d" {} \;
find /data/nginx -type f -name '*.conf' -not -path "/data/nginx/custom/*" -exec sed -i "/ssl_stapling_verify/d" {} \;
sed -i "/ssl_stapling/d" /data/nginx/default.conf
sed -i "/ssl_stapling_verify/d" /data/nginx/default.conf
if [ -s /data/nginx/default.conf ]; then sed -i "/ssl_stapling/d" /data/nginx/default.conf; fi
if [ -s /data/nginx/default.conf ]; then sed -i "/ssl_stapling_verify/d" /data/nginx/default.conf; fi
if [ ! -s /data/etc/modsecurity/modsecurity-default.conf ]; then
cp -van /usr/local/nginx/conf/conf.d/include/modsecurity.conf.example /data/etc/modsecurity/modsecurity-default.conf
@ -981,7 +982,7 @@ if [ "$PUID" != "0" ]; then
sed -i "s|user =.*|;user = root|" /data/php/83/php-fpm.d/www.conf
sed -i "s|group =.*|;group = root|" /data/php/83/php-fpm.d/www.conf
fi
sed -i "s|user root;|#user root;|g" /usr/local/nginx/conf/nginx.conf
sed -i "s|#\?user root;|#user root;|g" /usr/local/nginx/conf/nginx.conf
exec su-exec "$PUID:$PGID" launch.sh
else
find /proc/self/fd \

View file

@ -16,6 +16,8 @@ location = /fancyindex {
location /fancyindex/ {
alias /html/fancyindex/;
fancyindex off;
index off;
}

View file

@ -3,7 +3,7 @@ proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Accept-Encoding "";
#proxy_set_header Accept-Encoding "";
proxy_set_header Host $host;
proxy_set_header Early-Data $ssl_early_data;

View file

@ -3,7 +3,7 @@ proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Accept-Encoding "";
#proxy_set_header Accept-Encoding "";
proxy_set_header Host $host;
proxy_set_header Early-Data $ssl_early_data;

View file

@ -36,6 +36,7 @@ http {
tcp_nodelay on;
client_max_body_size 0;
client_body_buffer_size 512k;
reset_timedout_connection on;
gzip on;
gzip_vary on;

View file

@ -1,50 +0,0 @@
/// <reference types="Cypress" />
describe('Certificates endpoints', () => {
let token;
before(() => {
cy.getToken().then((tok) => {
token = tok;
});
});
it('Validate custom certificate', function() {
cy.task('backendApiPostFiles', {
token: token,
path: '/api/nginx/certificates/validate',
files: {
certificate: 'test.example.com.pem',
certificate_key: 'test.example.com-key.pem',
},
}).then((data) => {
cy.validateSwaggerSchema('post', 200, '/nginx/certificates/validate', data);
expect(data).to.have.property('certificate');
expect(data).to.have.property('certificate_key');
});
});
it('Request Certificate - CVE-2024-46256/CVE-2024-46257', function() {
cy.task('backendApiPost', {
token: token,
path: '/api/nginx/certificates',
data: {
domain_names: ['test.com"||echo hello-world||\\\\n test.com"'],
meta: {
dns_challenge: false,
letsencrypt_agree: true,
letsencrypt_email: 'admin@example.com',
},
provider: 'letsencrypt',
},
returnOnError: true,
}).then((data) => {
cy.validateSwaggerSchema('post', 400, '/nginx/certificates', data);
expect(data).to.have.property('error');
expect(data.error).to.have.property('message');
expect(data.error).to.have.property('code');
expect(data.error.code).to.equal(400);
expect(data.error.message).to.contain('data/domain_names/0 must match pattern');
});
});
});

View file

@ -1,28 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC1n9j9C5Bes1nd
qACDckERauxXVNKCnUlUM1buGBx1xc+j2e2Ar23wUJJuWBY18VfT8yqfqVDktO2w
rbmvZvLuPmXePOKbIKS+XXh+2NG9L5bDG9rwGFCRXnbQj+GWCdMfzx14+CR1IHge
Yz6Cv/Si2/LJPCh/CoBfM4hUQJON3lxAWrWBpdbZnKYMrxuPBRfW9OuzTbCVXToQ
oxRAHiOR9081Xn1WeoKr7kVBIa5UphlvWXa12w1YmUwJu7YndnJGIavLWeNCVc7Z
Eo+nS8Wr/4QWicatIWZXpVaEOPhRoeplQDxNWg5b/Q26rYoVd7PrCmRs7sVcH79X
zGONeH1PAgMBAAECggEAANb3Wtwl07pCjRrMvc7WbC0xYIn82yu8/g2qtjkYUJcU
ia5lQbYN7RGCS85Oc/tkq48xQEG5JQWNH8b918jDEMTrFab0aUEyYcru1q9L8PL6
YHaNgZSrMrDcHcS8h0QOXNRJT5jeGkiHJaTR0irvB526tqF3knbK9yW22KTfycUe
a0Z9voKn5xRk1DCbHi/nk2EpT7xnjeQeLFaTIRXbS68omkr4YGhwWm5OizoyEGZu
W0Zum5BkQyMr6kor3wdxOTG97ske2rcyvvHi+ErnwL0xBv0qY0Dhe8DpuXpDezqw
o72yY8h31Fu84i7sAj24YuE5Df8DozItFXQpkgbQ6QKBgQDPrufhvIFm2S/MzBdW
H8JxY7CJlJPyxOvc1NIl9RczQGAQR90kx52cgIcuIGEG6/wJ/xnGfMmW40F0DnQ+
N+oLgB9SFxeLkRb7s9Z/8N3uIN8JJFYcerEOiRQe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