letsencrypt::Client method certificateInstall (protected)
<instance of letsencrypt::Client> certificateInstall
Defined in /usr/local/ns/tcl/letsencrypt/letsencrypt-procs.tcl
- Testcases:
- No testcase defined.
Source code: :log "<br>Generate the certificate under ${:sslpath}...<br>" set cert ${:replyText} #ns_log notice "Storing certificate under ${:sslpath}/${:domain}.cer" #:writeFile ${:sslpath}/${:domain}.pem ${:replyText} #puts "Converting the certificate to PEM format to ${:sslpath}/${:domain}.crt" #exec openssl x509 -inform der # -in ${:sslpath}/${:domain}.cer # -out ${:sslpath}/${:domain}.crt #set cert [:readFile ${:sslpath}/${:domain}.crt] # # Build certificate in the filesystem. Backup old file if necessary. # if {${:API} eq "production"} { set :certPemFile ${:sslpath}/${:domain}.pem } else { # # In the case, we use the staging interface, we never # want to overwrite non-staging certificates. # set :certPemFile ${:sslpath}/${:API}-${:domain}.pem } # Save certificate and private key in single file in directory # of nsssl module. :backup ${:certPemFile} ns_log notice "Combining certificate and private key to ${:certPemFile}" :writeFile ${:certPemFile} "${:certPrivKey}$cert" #ns_log notice "Deleting ${:domain}.cer and ${:domain}.crt under ${:sslpath}/" #file delete ${:sslpath}/${:domain}.cer #file delete ${:sslpath}/${:domain}.crt # # Get certificate chain; the Let's Encrypt certificates # are available from https://letsencrypt.org/certificates/ # the used certificate is the "Let’s Encrypt Authority X3 # (IdenTrust cross-signed)" # # One might as well add the following certificate to # complete the chain, but this does not seem necessary by # www.ssllabs.com # # https://www.identrust.com/certificates/trustid/root-download-x3.html # #set letsencrypt_intermediate https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem.txt #set letsencrypt_intermediate https://letsencrypt.org/certs/trustid-x3-root.pem.txt #:log "Obtaining certificate chain ... " #set d [ns_http run $letsencrypt_intermediate] #:log "returned HTTP status [dict get $d status]<br>" # #:writeFile -append ${:certPemFile} [dict get $d body] # # Add DH parameters # :log "Adding DH parameters to ${:certPemFile} (might take a while - wait for DONE message) ... " exec -ignorestderr -- openssl dhparam 2048 >> ${:certPemFile} 2> /dev/null :log " DONE<br><br>" :log "New certificate successfully installed in: <strong>${:certPemFile}</strong><br><br>"XQL Not present: Generic, PostgreSQL, Oracle