mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-31 15:53:33 +00:00 
			
		
		
		
	Removes explicit privkeytype check and adds passphrase error
This commit is contained in:
		| @@ -615,18 +615,26 @@ const internalCertificate = { | |||||||
| 	checkPrivateKey: (private_key) => { | 	checkPrivateKey: (private_key) => { | ||||||
| 		return tempWrite(private_key, '/tmp') | 		return tempWrite(private_key, '/tmp') | ||||||
| 			.then((filepath) => { | 			.then((filepath) => { | ||||||
| 				let key_type = private_key.includes('-----BEGIN RSA') ? 'rsa' : 'ec'; | 				return new Promise((resolve, reject) => { | ||||||
| 				return utils.exec('openssl ' + key_type + ' -in ' + filepath + ' -check -noout 2>&1 ') | 					const failTimeout = setTimeout(() => { | ||||||
| 					.then((result) => { | 						reject(new error.ValidationError('Result Validation Error: Validation timed out. This could be due to the key being passphrase-protected.')); | ||||||
| 						if (!result.toLowerCase().includes('key ok') && !result.toLowerCase().includes('key valid') ) { | 					}, 10000); | ||||||
| 							throw new error.ValidationError('Result Validation Error: ' + result); | 					utils | ||||||
| 						} | 						.exec('openssl pkey -in ' + filepath + ' -check -noout 2>&1 ') | ||||||
| 						fs.unlinkSync(filepath); | 						.then((result) => { | ||||||
| 						return true; | 							clearTimeout(failTimeout); | ||||||
| 					}).catch((err) => { | 							if (!result.toLowerCase().includes('key is valid')) { | ||||||
| 						fs.unlinkSync(filepath); | 								reject(new error.ValidationError('Result Validation Error: ' + result)); | ||||||
| 						throw new error.ValidationError('Certificate Key is not valid (' + err.message + ')', err); | 							} | ||||||
| 					}); | 							fs.unlinkSync(filepath); | ||||||
|  | 							resolve(true); | ||||||
|  | 						}) | ||||||
|  | 						.catch((err) => { | ||||||
|  | 							clearTimeout(failTimeout); | ||||||
|  | 							fs.unlinkSync(filepath); | ||||||
|  | 							reject(new error.ValidationError('Certificate Key is not valid (' + err.message + ')', err)); | ||||||
|  | 						}); | ||||||
|  | 				}); | ||||||
| 			}); | 			}); | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -129,6 +129,9 @@ | |||||||
|                     </div> |                     </div> | ||||||
|                 <% } else if (provider === 'other') { %> |                 <% } else if (provider === 'other') { %> | ||||||
|                     <!-- Other --> |                     <!-- Other --> | ||||||
|  |                     <div class="col-sm-12 col-md-12"> | ||||||
|  |                         <div class="text-blue mb-4"><i class="fe fe-alert-triangle"></i> <%= i18n('ssl', 'passphrase-protection-support-info') %></div> | ||||||
|  |                     </div> | ||||||
|                     <div class="col-sm-12 col-md-12"> |                     <div class="col-sm-12 col-md-12"> | ||||||
|                         <div class="form-group"> |                         <div class="form-group"> | ||||||
|                             <label class="form-label"><%- i18n('str', 'name') %> <span class="form-required">*</span></label> |                             <label class="form-label"><%- i18n('str', 'name') %> <span class="form-required">*</span></label> | ||||||
|   | |||||||
| @@ -112,7 +112,8 @@ | |||||||
|       "stored-as-plaintext-info": "This data will be stored as plaintext in the database and in a file!", |       "stored-as-plaintext-info": "This data will be stored as plaintext in the database and in a file!", | ||||||
|       "propagation-seconds": "Propagation Seconds", |       "propagation-seconds": "Propagation Seconds", | ||||||
|       "propagation-seconds-info": "Leave empty to use the plugins default value. Number of seconds to wait for DNS propagation.", |       "propagation-seconds-info": "Leave empty to use the plugins default value. Number of seconds to wait for DNS propagation.", | ||||||
|       "processing-info": "Processing... This might take a few minutes." |       "processing-info": "Processing... This might take a few minutes.", | ||||||
|  |       "passphrase-protection-support-info": "Key files protected with a passphrase are not supported." | ||||||
|     }, |     }, | ||||||
|     "proxy-hosts": { |     "proxy-hosts": { | ||||||
|       "title": "Proxy Hosts", |       "title": "Proxy Hosts", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user