mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-11-04 01:15:14 +00:00 
			
		
		
		
	Compare commits
	
		
			9 Commits
		
	
	
		
			929ac3bd7c
			...
			bump-freed
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					c2965789a0 | ||
| 
						 | 
					d499e2bfef | ||
| 
						 | 
					2f9e062718 | ||
| 
						 | 
					edbed1af90 | ||
| 
						 | 
					8497022e41 | ||
| 
						 | 
					fa2c814fcb | ||
| 
						 | 
					d96a3987c0 | ||
| 
						 | 
					fe2d8895d6 | ||
| 
						 | 
					5bdc05878f | 
							
								
								
									
										10
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							@@ -43,7 +43,7 @@ pipeline {
 | 
			
		||||
					steps {
 | 
			
		||||
						script {
 | 
			
		||||
							// Defaults to the Branch name, which is applies to all branches AND pr's
 | 
			
		||||
							buildxPushTags = "-t docker.io/jc21/${IMAGE}:github-${BRANCH_LOWER}"
 | 
			
		||||
							buildxPushTags = "-t docker.io/nginxproxymanager/${IMAGE}-dev:${BRANCH_LOWER}"
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
@@ -203,7 +203,13 @@ pipeline {
 | 
			
		||||
					}
 | 
			
		||||
					steps {
 | 
			
		||||
						script {
 | 
			
		||||
							npmGithubPrComment("Docker Image for build ${BUILD_NUMBER} is available on [DockerHub](https://cloud.docker.com/repository/docker/jc21/${IMAGE}) as `jc21/${IMAGE}:github-${BRANCH_LOWER}`\n\n**Note:** ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.", true)
 | 
			
		||||
							npmGithubPrComment("""Docker Image for build ${BUILD_NUMBER} is available on
 | 
			
		||||
[DockerHub](https://cloud.docker.com/repository/docker/nginxproxymanager/${IMAGE}-dev)
 | 
			
		||||
as `nginxproxymanager/${IMAGE}-dev:${BRANCH_LOWER}`
 | 
			
		||||
 | 
			
		||||
**Note:** ensure you backup your NPM instance before testing this image! Especially if there are database changes
 | 
			
		||||
**Note:** this is a different docker image namespace than the official image
 | 
			
		||||
""", true)
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<p align="center">
 | 
			
		||||
	<img src="https://nginxproxymanager.com/github.png">
 | 
			
		||||
	<br><br>
 | 
			
		||||
	<img src="https://img.shields.io/badge/version-2.12.0-green.svg?style=for-the-badge">
 | 
			
		||||
	<img src="https://img.shields.io/badge/version-2.12.1-green.svg?style=for-the-badge">
 | 
			
		||||
	<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
 | 
			
		||||
		<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
 | 
			
		||||
	</a>
 | 
			
		||||
 
 | 
			
		||||
@@ -209,6 +209,7 @@ const internalCertificate = {
 | 
			
		||||
										.patchAndFetchById(certificate.id, {
 | 
			
		||||
											expires_on: moment(cert_info.dates.to, 'X').format('YYYY-MM-DD HH:mm:ss')
 | 
			
		||||
										})
 | 
			
		||||
										.then(utils.omitRow(omissions()))
 | 
			
		||||
										.then((saved_row) => {
 | 
			
		||||
											// Add cert data for audit log
 | 
			
		||||
											saved_row.meta = _.assign({}, saved_row.meta, {
 | 
			
		||||
@@ -732,29 +733,29 @@ const internalCertificate = {
 | 
			
		||||
 | 
			
		||||
		return utils.exec('openssl x509 -in ' + certificate_file + ' -subject -noout')
 | 
			
		||||
			.then((result) => {
 | 
			
		||||
				// Examples:
 | 
			
		||||
				// subject=CN = *.jc21.com
 | 
			
		||||
				// subject=CN = something.example.com
 | 
			
		||||
				const regex = /(?:subject=)?[^=]+=\s+(\S+)/gim;
 | 
			
		||||
				const match = regex.exec(result);
 | 
			
		||||
 | 
			
		||||
				if (typeof match[1] === 'undefined') {
 | 
			
		||||
					throw new error.ValidationError('Could not determine subject from certificate: ' + result);
 | 
			
		||||
				if (match && typeof match[1] !== 'undefined') {
 | 
			
		||||
					certData['cn'] = match[1];
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				certData['cn'] = match[1];
 | 
			
		||||
			})
 | 
			
		||||
			.then(() => {
 | 
			
		||||
				return utils.exec('openssl x509 -in ' + certificate_file + ' -issuer -noout');
 | 
			
		||||
			})
 | 
			
		||||
 | 
			
		||||
			.then((result) => {
 | 
			
		||||
				// Examples:
 | 
			
		||||
				// issuer=C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
 | 
			
		||||
				// issuer=C = US, O = Let's Encrypt, CN = E5
 | 
			
		||||
				// issuer=O = NginxProxyManager, CN = NginxProxyManager Intermediate CA","O = NginxProxyManager, CN = NginxProxyManager Intermediate CA
 | 
			
		||||
				const regex = /^(?:issuer=)?(.*)$/gim;
 | 
			
		||||
				const match = regex.exec(result);
 | 
			
		||||
 | 
			
		||||
				if (typeof match[1] === 'undefined') {
 | 
			
		||||
					throw new error.ValidationError('Could not determine issuer from certificate: ' + result);
 | 
			
		||||
				if (match && typeof match[1] !== 'undefined') {
 | 
			
		||||
					certData['issuer'] = match[1];
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				certData['issuer'] = match[1];
 | 
			
		||||
			})
 | 
			
		||||
			.then(() => {
 | 
			
		||||
				return utils.exec('openssl x509 -in ' + certificate_file + ' -dates -noout');
 | 
			
		||||
@@ -829,18 +830,18 @@ const internalCertificate = {
 | 
			
		||||
	requestLetsEncryptSsl: (certificate) => {
 | 
			
		||||
		logger.info('Requesting Let\'sEncrypt certificates for Cert #' + certificate.id + ': ' + certificate.domain_names.join(', '));
 | 
			
		||||
 | 
			
		||||
		const cmd = certbotCommand + ' certonly ' +
 | 
			
		||||
			'--config "' + letsencryptConfig + '" ' +
 | 
			
		||||
		const cmd = `${certbotCommand} certonly ` +
 | 
			
		||||
			`--config '${letsencryptConfig}' ` +
 | 
			
		||||
			'--work-dir "/tmp/letsencrypt-lib" ' +
 | 
			
		||||
			'--logs-dir "/tmp/letsencrypt-log" ' +
 | 
			
		||||
			'--cert-name "npm-' + certificate.id + '" ' +
 | 
			
		||||
			`--cert-name "npm-${certificate.id}" ` +
 | 
			
		||||
			'--agree-tos ' +
 | 
			
		||||
			'--authenticator webroot ' +
 | 
			
		||||
			'--email "' + certificate.meta.letsencrypt_email + '" ' +
 | 
			
		||||
			`--email '${certificate.meta.letsencrypt_email}' ` +
 | 
			
		||||
			'--preferred-challenges "dns,http" ' +
 | 
			
		||||
			'--domains "' + certificate.domain_names.join(',') + '" ' +
 | 
			
		||||
			(letsencryptStaging ? '--staging' : '') +
 | 
			
		||||
			(letsencryptServer !== null ? `--server '${letsencryptServer}'` : '');
 | 
			
		||||
			`--domains "${certificate.domain_names.join(',')}" ` +
 | 
			
		||||
			(letsencryptServer !== null ? `--server '${letsencryptServer}' ` : '') +
 | 
			
		||||
			(letsencryptStaging && letsencryptServer === null ? '--staging ' : '');
 | 
			
		||||
 | 
			
		||||
		logger.info('Command:', cmd);
 | 
			
		||||
 | 
			
		||||
@@ -871,25 +872,26 @@ const internalCertificate = {
 | 
			
		||||
		const hasConfigArg = certificate.meta.dns_provider !== 'route53';
 | 
			
		||||
 | 
			
		||||
		let mainCmd = certbotCommand + ' certonly ' +
 | 
			
		||||
			'--config "' + letsencryptConfig + '" ' +
 | 
			
		||||
			`--config '${letsencryptConfig}' ` +
 | 
			
		||||
			'--work-dir "/tmp/letsencrypt-lib" ' +
 | 
			
		||||
			'--logs-dir "/tmp/letsencrypt-log" ' +
 | 
			
		||||
			'--cert-name "npm-' + certificate.id + '" ' +
 | 
			
		||||
			`--cert-name 'npm-${certificate.id}' ` +
 | 
			
		||||
			'--agree-tos ' +
 | 
			
		||||
			'--email "' + certificate.meta.letsencrypt_email + '" ' +
 | 
			
		||||
			'--domains "' + certificate.domain_names.join(',') + '" ' +
 | 
			
		||||
			'--authenticator ' + dnsPlugin.full_plugin_name + ' ' +
 | 
			
		||||
			`--email '${certificate.meta.letsencrypt_email}' ` +
 | 
			
		||||
			`--domains '${certificate.domain_names.join(',')}' ` +
 | 
			
		||||
			`--authenticator '${dnsPlugin.full_plugin_name}' ` +
 | 
			
		||||
			(
 | 
			
		||||
				hasConfigArg
 | 
			
		||||
					? '--' + dnsPlugin.full_plugin_name + '-credentials "' + credentialsLocation + '"'
 | 
			
		||||
					? `--${dnsPlugin.full_plugin_name}-credentials '${credentialsLocation}' `
 | 
			
		||||
					: ''
 | 
			
		||||
			) +
 | 
			
		||||
			(
 | 
			
		||||
				certificate.meta.propagation_seconds !== undefined
 | 
			
		||||
					? ' --' + dnsPlugin.full_plugin_name + '-propagation-seconds ' + certificate.meta.propagation_seconds
 | 
			
		||||
					? `--${dnsPlugin.full_plugin_name}-propagation-seconds '${certificate.meta.propagation_seconds}' `
 | 
			
		||||
					: ''
 | 
			
		||||
			) +
 | 
			
		||||
			(letsencryptStaging ? ' --staging' : '');
 | 
			
		||||
			(letsencryptServer !== null ? `--server '${letsencryptServer}' ` : '') +
 | 
			
		||||
			(letsencryptStaging && letsencryptServer === null ? '--staging ' : '');
 | 
			
		||||
 | 
			
		||||
		// Prepend the path to the credentials file as an environment variable
 | 
			
		||||
		if (certificate.meta.dns_provider === 'route53') {
 | 
			
		||||
@@ -966,14 +968,15 @@ const internalCertificate = {
 | 
			
		||||
		logger.info('Renewing Let\'sEncrypt certificates for Cert #' + certificate.id + ': ' + certificate.domain_names.join(', '));
 | 
			
		||||
 | 
			
		||||
		const cmd = certbotCommand + ' renew --force-renewal ' +
 | 
			
		||||
			'--config "' + letsencryptConfig + '" ' +
 | 
			
		||||
			`--config '${letsencryptConfig}' ` +
 | 
			
		||||
			'--work-dir "/tmp/letsencrypt-lib" ' +
 | 
			
		||||
			'--logs-dir "/tmp/letsencrypt-log" ' +
 | 
			
		||||
			'--cert-name "npm-' + certificate.id + '" ' +
 | 
			
		||||
			`--cert-name 'npm-${certificate.id}' ` +
 | 
			
		||||
			'--preferred-challenges "dns,http" ' +
 | 
			
		||||
			'--no-random-sleep-on-renew ' +
 | 
			
		||||
			'--disable-hook-validation ' +
 | 
			
		||||
			(letsencryptStaging ? '--staging' : '');
 | 
			
		||||
			(letsencryptServer !== null ? `--server '${letsencryptServer}' ` : '') +
 | 
			
		||||
			(letsencryptStaging && letsencryptServer === null ? '--staging ' : '');
 | 
			
		||||
 | 
			
		||||
		logger.info('Command:', cmd);
 | 
			
		||||
 | 
			
		||||
@@ -998,13 +1001,14 @@ const internalCertificate = {
 | 
			
		||||
		logger.info(`Renewing Let'sEncrypt certificates via ${dnsPlugin.name} for Cert #${certificate.id}: ${certificate.domain_names.join(', ')}`);
 | 
			
		||||
 | 
			
		||||
		let mainCmd = certbotCommand + ' renew --force-renewal ' +
 | 
			
		||||
			'--config "' + letsencryptConfig + '" ' +
 | 
			
		||||
			`--config "${letsencryptConfig}" ` +
 | 
			
		||||
			'--work-dir "/tmp/letsencrypt-lib" ' +
 | 
			
		||||
			'--logs-dir "/tmp/letsencrypt-log" ' +
 | 
			
		||||
			'--cert-name "npm-' + certificate.id + '" ' +
 | 
			
		||||
			`--cert-name 'npm-${certificate.id}' ` +
 | 
			
		||||
			'--disable-hook-validation ' +
 | 
			
		||||
			'--no-random-sleep-on-renew ' +
 | 
			
		||||
			(letsencryptStaging ? ' --staging' : '');
 | 
			
		||||
			(letsencryptServer !== null ? `--server '${letsencryptServer}' ` : '') +
 | 
			
		||||
			(letsencryptStaging && letsencryptServer === null ? '--staging ' : '');
 | 
			
		||||
 | 
			
		||||
		// Prepend the path to the credentials file as an environment variable
 | 
			
		||||
		if (certificate.meta.dns_provider === 'route53') {
 | 
			
		||||
@@ -1030,12 +1034,13 @@ const internalCertificate = {
 | 
			
		||||
		logger.info('Revoking Let\'sEncrypt certificates for Cert #' + certificate.id + ': ' + certificate.domain_names.join(', '));
 | 
			
		||||
 | 
			
		||||
		const mainCmd = certbotCommand + ' revoke ' +
 | 
			
		||||
			'--config "' + letsencryptConfig + '" ' +
 | 
			
		||||
			`--config '${letsencryptConfig}' ` +
 | 
			
		||||
			'--work-dir "/tmp/letsencrypt-lib" ' +
 | 
			
		||||
			'--logs-dir "/tmp/letsencrypt-log" ' +
 | 
			
		||||
			'--cert-path "/etc/letsencrypt/live/npm-' + certificate.id + '/fullchain.pem" ' +
 | 
			
		||||
			`--cert-path '/etc/letsencrypt/live/npm-${certificate.id}/fullchain.pem' ` +
 | 
			
		||||
			'--delete-after-revoke ' +
 | 
			
		||||
			(letsencryptStaging ? '--staging' : '');
 | 
			
		||||
			(letsencryptServer !== null ? `--server '${letsencryptServer}' ` : '') +
 | 
			
		||||
			(letsencryptStaging && letsencryptServer === null ? '--staging ' : '');
 | 
			
		||||
 | 
			
		||||
		// Don't fail command if file does not exist
 | 
			
		||||
		const delete_credentialsCmd = `rm -f '/etc/letsencrypt/credentials/credentials-${certificate.id}' || true`;
 | 
			
		||||
 
 | 
			
		||||
@@ -181,7 +181,9 @@ const internalNginx = {
 | 
			
		||||
	 * @param   {Object}  host
 | 
			
		||||
	 * @returns {Promise}
 | 
			
		||||
	 */
 | 
			
		||||
	generateConfig: (host_type, host) => {
 | 
			
		||||
	generateConfig: (host_type, host_row) => {
 | 
			
		||||
		// Prevent modifying the original object:
 | 
			
		||||
		let host             = JSON.parse(JSON.stringify(host_row));
 | 
			
		||||
		const nice_host_type = internalNginx.getFileFriendlyHostType(host_type);
 | 
			
		||||
 | 
			
		||||
		if (config.debug()) {
 | 
			
		||||
 
 | 
			
		||||
@@ -45,11 +45,13 @@
 | 
			
		||||
			"type": "object",
 | 
			
		||||
			"additionalProperties": false,
 | 
			
		||||
			"properties": {
 | 
			
		||||
				"letsencrypt_email": {
 | 
			
		||||
					"type": "string"
 | 
			
		||||
				"certificate": {
 | 
			
		||||
					"type": "string",
 | 
			
		||||
					"minLength": 1
 | 
			
		||||
				},
 | 
			
		||||
				"letsencrypt_agree": {
 | 
			
		||||
					"type": "boolean"
 | 
			
		||||
				"certificate_key": {
 | 
			
		||||
					"type": "string",
 | 
			
		||||
					"minLength": 1
 | 
			
		||||
				},
 | 
			
		||||
				"dns_challenge": {
 | 
			
		||||
					"type": "boolean"
 | 
			
		||||
@@ -60,17 +62,18 @@
 | 
			
		||||
				"dns_provider_credentials": {
 | 
			
		||||
					"type": "string"
 | 
			
		||||
				},
 | 
			
		||||
				"letsencrypt_agree": {
 | 
			
		||||
					"type": "boolean"
 | 
			
		||||
				},
 | 
			
		||||
				"letsencrypt_certificate": {
 | 
			
		||||
					"type": "object"
 | 
			
		||||
				},
 | 
			
		||||
				"letsencrypt_email": {
 | 
			
		||||
					"type": "string"
 | 
			
		||||
				},
 | 
			
		||||
				"propagation_seconds": {
 | 
			
		||||
					"type": "integer",
 | 
			
		||||
					"minimum": 0
 | 
			
		||||
				},
 | 
			
		||||
				"certificate": {
 | 
			
		||||
					"type": "string",
 | 
			
		||||
					"minLength": 1
 | 
			
		||||
				},
 | 
			
		||||
				"certificate_key": {
 | 
			
		||||
					"type": "string",
 | 
			
		||||
					"minLength": 1
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,9 +23,7 @@
 | 
			
		||||
		"locations",
 | 
			
		||||
		"hsts_enabled",
 | 
			
		||||
		"hsts_subdomains",
 | 
			
		||||
		"certificate",
 | 
			
		||||
		"use_default_location",
 | 
			
		||||
		"ipv6"
 | 
			
		||||
		"certificate"
 | 
			
		||||
	],
 | 
			
		||||
	"additionalProperties": false,
 | 
			
		||||
	"properties": {
 | 
			
		||||
@@ -151,12 +149,6 @@
 | 
			
		||||
					"$ref": "./access-list-object.json"
 | 
			
		||||
				}
 | 
			
		||||
			]
 | 
			
		||||
		},
 | 
			
		||||
		"use_default_location": {
 | 
			
		||||
			"type": "boolean"
 | 
			
		||||
		},
 | 
			
		||||
		"ipv6": {
 | 
			
		||||
			"type": "boolean"
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,7 @@
 | 
			
		||||
		},
 | 
			
		||||
		"forward_scheme": {
 | 
			
		||||
			"type": "string",
 | 
			
		||||
			"enum": ["http", "https"]
 | 
			
		||||
			"enum": ["auto", "http", "https"]
 | 
			
		||||
		},
 | 
			
		||||
		"forward_domain_name": {
 | 
			
		||||
			"description": "Domain Name",
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@
 | 
			
		||||
		"value": {
 | 
			
		||||
			"description": "Value in almost any form",
 | 
			
		||||
			"example": "congratulations",
 | 
			
		||||
			"oneOf": [
 | 
			
		||||
			"anyOf": [
 | 
			
		||||
				{
 | 
			
		||||
					"type": "string",
 | 
			
		||||
					"minLength": 1
 | 
			
		||||
@@ -46,7 +46,10 @@
 | 
			
		||||
		},
 | 
			
		||||
		"meta": {
 | 
			
		||||
			"description": "Extra metadata",
 | 
			
		||||
			"example": {},
 | 
			
		||||
			"example": {
 | 
			
		||||
				"redirect": "http://example.com",
 | 
			
		||||
				"html": "<h1>404</h1>"
 | 
			
		||||
			},
 | 
			
		||||
			"type": "object"
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -94,9 +94,7 @@
 | 
			
		||||
									"avatar": "",
 | 
			
		||||
									"roles": ["admin"]
 | 
			
		||||
								},
 | 
			
		||||
								"certificate": null,
 | 
			
		||||
								"use_default_location": true,
 | 
			
		||||
								"ipv6": true
 | 
			
		||||
								"certificate": null
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					},
 | 
			
		||||
 
 | 
			
		||||
@@ -79,9 +79,7 @@
 | 
			
		||||
									"nickname": "Admin",
 | 
			
		||||
									"avatar": "",
 | 
			
		||||
									"roles": ["admin"]
 | 
			
		||||
								},
 | 
			
		||||
								"use_default_location": true,
 | 
			
		||||
								"ipv6": true
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					},
 | 
			
		||||
 
 | 
			
		||||
@@ -129,9 +129,7 @@
 | 
			
		||||
									"roles": ["admin"]
 | 
			
		||||
								},
 | 
			
		||||
								"certificate": null,
 | 
			
		||||
								"access_list": null,
 | 
			
		||||
								"use_default_location": true,
 | 
			
		||||
								"ipv6": true
 | 
			
		||||
								"access_list": null
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					},
 | 
			
		||||
 
 | 
			
		||||
@@ -114,9 +114,7 @@
 | 
			
		||||
									"avatar": "//www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?default=mm",
 | 
			
		||||
									"roles": ["admin"]
 | 
			
		||||
								},
 | 
			
		||||
								"access_list": null,
 | 
			
		||||
								"use_default_location": true,
 | 
			
		||||
								"ipv6": true
 | 
			
		||||
								"access_list": null
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					},
 | 
			
		||||
 
 | 
			
		||||
@@ -114,9 +114,7 @@
 | 
			
		||||
									"avatar": "",
 | 
			
		||||
									"roles": ["admin"]
 | 
			
		||||
								},
 | 
			
		||||
								"certificate": null,
 | 
			
		||||
								"use_default_location": true,
 | 
			
		||||
								"ipv6": true
 | 
			
		||||
								"certificate": null
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					},
 | 
			
		||||
 
 | 
			
		||||
@@ -99,9 +99,7 @@
 | 
			
		||||
									"nickname": "Admin",
 | 
			
		||||
									"avatar": "",
 | 
			
		||||
									"roles": ["admin"]
 | 
			
		||||
								},
 | 
			
		||||
								"use_default_location": true,
 | 
			
		||||
								"ipv6": true
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					},
 | 
			
		||||
 
 | 
			
		||||
@@ -129,9 +129,7 @@
 | 
			
		||||
									"roles": ["admin"]
 | 
			
		||||
								},
 | 
			
		||||
								"certificate": null,
 | 
			
		||||
								"access_list": null,
 | 
			
		||||
								"use_default_location": true,
 | 
			
		||||
								"ipv6": true
 | 
			
		||||
								"access_list": null
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					},
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,8 @@
 | 
			
		||||
			"name": "settingID",
 | 
			
		||||
			"schema": {
 | 
			
		||||
				"type": "string",
 | 
			
		||||
				"minLength": 1
 | 
			
		||||
				"minLength": 1,
 | 
			
		||||
				"enum": ["default-site"]
 | 
			
		||||
			},
 | 
			
		||||
			"required": true,
 | 
			
		||||
			"description": "Setting ID",
 | 
			
		||||
@@ -31,10 +32,21 @@
 | 
			
		||||
					"minProperties": 1,
 | 
			
		||||
					"properties": {
 | 
			
		||||
						"value": {
 | 
			
		||||
							"$ref": "../../../components/setting-object.json#/properties/value"
 | 
			
		||||
							"type": "string",
 | 
			
		||||
							"minLength": 1,
 | 
			
		||||
							"enum": ["congratulations", "404", "444", "redirect", "html"]
 | 
			
		||||
						},
 | 
			
		||||
						"meta": {
 | 
			
		||||
							"$ref": "../../../components/setting-object.json#/properties/meta"
 | 
			
		||||
							"type": "object",
 | 
			
		||||
							"additionalProperties": false,
 | 
			
		||||
							"properties": {
 | 
			
		||||
								"redirect": {
 | 
			
		||||
									"type": "string"
 | 
			
		||||
								},
 | 
			
		||||
								"html": {
 | 
			
		||||
									"type": "string"
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 
 | 
			
		||||
@@ -194,7 +194,7 @@
 | 
			
		||||
	"freedns": {
 | 
			
		||||
		"name": "FreeDNS",
 | 
			
		||||
		"package_name": "certbot-dns-freedns",
 | 
			
		||||
		"version": "~=0.1.0",
 | 
			
		||||
		"version": "~=0.2.0",
 | 
			
		||||
		"dependencies": "",
 | 
			
		||||
		"credentials": "dns_freedns_username = myremoteuser\ndns_freedns_password = verysecureremoteuserpassword",
 | 
			
		||||
		"full_plugin_name": "dns-freedns"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										62
									
								
								test/cypress/e2e/api/FullCertProvision.cy.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								test/cypress/e2e/api/FullCertProvision.cy.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,62 @@
 | 
			
		||||
/// <reference types="cypress" />
 | 
			
		||||
 | 
			
		||||
describe('Full Certificate Provisions', () => {
 | 
			
		||||
	let token;
 | 
			
		||||
 | 
			
		||||
	before(() => {
 | 
			
		||||
		cy.getToken().then((tok) => {
 | 
			
		||||
			token = tok;
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	it('Should be able to create new http certificate', function() {
 | 
			
		||||
		cy.task('backendApiPost', {
 | 
			
		||||
			token: token,
 | 
			
		||||
			path:  '/api/nginx/certificates',
 | 
			
		||||
			data:  {
 | 
			
		||||
				domain_names: [
 | 
			
		||||
					'website1.example.com'
 | 
			
		||||
				],
 | 
			
		||||
				meta: {
 | 
			
		||||
					letsencrypt_email: 'admin@example.com',
 | 
			
		||||
					letsencrypt_agree: true,
 | 
			
		||||
					dns_challenge: false
 | 
			
		||||
				},
 | 
			
		||||
				provider: 'letsencrypt'
 | 
			
		||||
			}
 | 
			
		||||
		}).then((data) => {
 | 
			
		||||
			cy.validateSwaggerSchema('post', 201, '/nginx/certificates', data);
 | 
			
		||||
			expect(data).to.have.property('id');
 | 
			
		||||
			expect(data.id).to.be.greaterThan(0);
 | 
			
		||||
			expect(data.provider).to.be.equal('letsencrypt');
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	it('Should be able to create new DNS certificate with Powerdns', function() {
 | 
			
		||||
		cy.task('backendApiPost', {
 | 
			
		||||
			token: token,
 | 
			
		||||
			path:  '/api/nginx/certificates',
 | 
			
		||||
			data:  {
 | 
			
		||||
				domain_names: [
 | 
			
		||||
					'website2.example.com'
 | 
			
		||||
				],
 | 
			
		||||
				meta: {
 | 
			
		||||
					letsencrypt_email: "admin@example.com",
 | 
			
		||||
					dns_challenge: true,
 | 
			
		||||
					dns_provider: 'powerdns',
 | 
			
		||||
					dns_provider_credentials: 'dns_powerdns_api_url = http://ns1.pdns:8081\r\ndns_powerdns_api_key = npm',
 | 
			
		||||
					letsencrypt_agree: true,
 | 
			
		||||
					propagation_seconds: 5,
 | 
			
		||||
				},
 | 
			
		||||
				provider: 'letsencrypt'
 | 
			
		||||
			}
 | 
			
		||||
		}).then((data) => {
 | 
			
		||||
			cy.validateSwaggerSchema('post', 201, '/nginx/certificates', data);
 | 
			
		||||
			expect(data).to.have.property('id');
 | 
			
		||||
			expect(data.id).to.be.greaterThan(0);
 | 
			
		||||
			expect(data.provider).to.be.equal('letsencrypt');
 | 
			
		||||
			expect(data.meta.dns_provider).to.be.equal('powerdns');
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/// <reference types="cypress" />
 | 
			
		||||
 | 
			
		||||
describe('Hosts endpoints', () => {
 | 
			
		||||
describe('Proxy Hosts endpoints', () => {
 | 
			
		||||
	let token;
 | 
			
		||||
 | 
			
		||||
	before(() => {
 | 
			
		||||
							
								
								
									
										124
									
								
								test/cypress/e2e/api/Settings.cy.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								test/cypress/e2e/api/Settings.cy.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,124 @@
 | 
			
		||||
/// <reference types="cypress" />
 | 
			
		||||
 | 
			
		||||
describe('Settings endpoints', () => {
 | 
			
		||||
	let token;
 | 
			
		||||
 | 
			
		||||
	before(() => {
 | 
			
		||||
		cy.getToken().then((tok) => {
 | 
			
		||||
			token = tok;
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	it('Get all settings', function() {
 | 
			
		||||
		cy.task('backendApiGet', {
 | 
			
		||||
			token: token,
 | 
			
		||||
			path:  '/api/settings',
 | 
			
		||||
		}).then((data) => {
 | 
			
		||||
			cy.validateSwaggerSchema('get', 200, '/settings', data);
 | 
			
		||||
			expect(data.length).to.be.greaterThan(0);
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	it('Get default-site setting', function() {
 | 
			
		||||
		cy.task('backendApiGet', {
 | 
			
		||||
			token: token,
 | 
			
		||||
			path:  '/api/settings/default-site',
 | 
			
		||||
		}).then((data) => {
 | 
			
		||||
			cy.validateSwaggerSchema('get', 200, '/settings/{settingID}', data);
 | 
			
		||||
			expect(data).to.have.property('id');
 | 
			
		||||
			expect(data.id).to.be.equal('default-site');
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	it('Default Site congratulations', function() {
 | 
			
		||||
		cy.task('backendApiPut', {
 | 
			
		||||
			token: token,
 | 
			
		||||
			path:  '/api/settings/default-site',
 | 
			
		||||
			data: {
 | 
			
		||||
				value: 'congratulations',
 | 
			
		||||
			},
 | 
			
		||||
		}).then((data) => {
 | 
			
		||||
			cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
 | 
			
		||||
			expect(data).to.have.property('id');
 | 
			
		||||
			expect(data.id).to.be.equal('default-site');
 | 
			
		||||
			expect(data).to.have.property('value');
 | 
			
		||||
			expect(data.value).to.be.equal('congratulations');
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	it('Default Site 404', function() {
 | 
			
		||||
		cy.task('backendApiPut', {
 | 
			
		||||
			token: token,
 | 
			
		||||
			path:  '/api/settings/default-site',
 | 
			
		||||
			data: {
 | 
			
		||||
				value: '404',
 | 
			
		||||
			},
 | 
			
		||||
		}).then((data) => {
 | 
			
		||||
			cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
 | 
			
		||||
			expect(data).to.have.property('id');
 | 
			
		||||
			expect(data.id).to.be.equal('default-site');
 | 
			
		||||
			expect(data).to.have.property('value');
 | 
			
		||||
			expect(data.value).to.be.equal('404');
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	it('Default Site 444', function() {
 | 
			
		||||
		cy.task('backendApiPut', {
 | 
			
		||||
			token: token,
 | 
			
		||||
			path:  '/api/settings/default-site',
 | 
			
		||||
			data: {
 | 
			
		||||
				value: '444',
 | 
			
		||||
			},
 | 
			
		||||
		}).then((data) => {
 | 
			
		||||
			cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
 | 
			
		||||
			expect(data).to.have.property('id');
 | 
			
		||||
			expect(data.id).to.be.equal('default-site');
 | 
			
		||||
			expect(data).to.have.property('value');
 | 
			
		||||
			expect(data.value).to.be.equal('444');
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	it('Default Site redirect', function() {
 | 
			
		||||
		cy.task('backendApiPut', {
 | 
			
		||||
			token: token,
 | 
			
		||||
			path:  '/api/settings/default-site',
 | 
			
		||||
			data: {
 | 
			
		||||
				value: 'redirect',
 | 
			
		||||
				meta: {
 | 
			
		||||
					redirect: 'https://www.google.com',
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		}).then((data) => {
 | 
			
		||||
			cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
 | 
			
		||||
			expect(data).to.have.property('id');
 | 
			
		||||
			expect(data.id).to.be.equal('default-site');
 | 
			
		||||
			expect(data).to.have.property('value');
 | 
			
		||||
			expect(data.value).to.be.equal('redirect');
 | 
			
		||||
			expect(data).to.have.property('meta');
 | 
			
		||||
			expect(data.meta).to.have.property('redirect');
 | 
			
		||||
			expect(data.meta.redirect).to.be.equal('https://www.google.com');
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	it('Default Site html', function() {
 | 
			
		||||
		cy.task('backendApiPut', {
 | 
			
		||||
			token: token,
 | 
			
		||||
			path:  '/api/settings/default-site',
 | 
			
		||||
			data: {
 | 
			
		||||
				value: 'html',
 | 
			
		||||
				meta: {
 | 
			
		||||
					html: '<p>hello world</p>'
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		}).then((data) => {
 | 
			
		||||
			cy.validateSwaggerSchema('put', 200, '/settings/{settingID}', data);
 | 
			
		||||
			expect(data).to.have.property('id');
 | 
			
		||||
			expect(data.id).to.be.equal('default-site');
 | 
			
		||||
			expect(data).to.have.property('value');
 | 
			
		||||
			expect(data.value).to.be.equal('html');
 | 
			
		||||
			expect(data).to.have.property('meta');
 | 
			
		||||
			expect(data.meta).to.have.property('html');
 | 
			
		||||
			expect(data.meta.html).to.be.equal('<p>hello world</p>');
 | 
			
		||||
		});
 | 
			
		||||
	});
 | 
			
		||||
});
 | 
			
		||||
@@ -7,7 +7,7 @@ const BackendApi = function(config, token) {
 | 
			
		||||
 | 
			
		||||
	this.axios = axios.create({
 | 
			
		||||
		baseURL: config.baseUrl,
 | 
			
		||||
		timeout: 5000,
 | 
			
		||||
		timeout: 90000,
 | 
			
		||||
	});
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user