From 75d3548bc7fedb0f72305710455c1f33f3127b02 Mon Sep 17 00:00:00 2001 From: Nasrullo Nurullaev <61620246+nasrullonurullaev@users.noreply.github.com> Date: Tue, 30 Jul 2024 17:04:16 +0500 Subject: [PATCH] Add --cert-name option for ability to change key-type (#290) --- install/win/sbin/docspace-ssl-setup.ps1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/install/win/sbin/docspace-ssl-setup.ps1 b/install/win/sbin/docspace-ssl-setup.ps1 index 101a22120c..1253428f9e 100644 --- a/install/win/sbin/docspace-ssl-setup.ps1 +++ b/install/win/sbin/docspace-ssl-setup.ps1 @@ -28,6 +28,7 @@ if ( -not $certbot_path ) exit } +$product = "docspace" $letsencrypt_root_dir = "$env:SystemDrive\Certbot\live" $app = Resolve-Path -Path ".\..\" $root_dir = "${app}\letsencrypt" @@ -48,16 +49,15 @@ if ( $args.Count -ge 2 ) else { $letsencrypt_mail = $args[0] -JOIN "," $letsencrypt_domain = $args[1] -JOIN "," - $letsencrypt_main_domain = $letsencrypt_domain.Split(',')[0] [void](New-Item -ItemType "directory" -Path "${root_dir}\Logs" -Force) - "certbot certonly --expand --webroot -w `"${root_dir}`" --key-type rsa --noninteractive --agree-tos --email ${letsencrypt_mail} -d ${letsencrypt_domain}" > "${app}\letsencrypt\Logs\le-start.log" - cmd.exe /c "certbot certonly --expand --webroot -w `"${root_dir}`" --key-type rsa --noninteractive --agree-tos --email ${letsencrypt_mail} -d ${letsencrypt_domain}" > "${app}\letsencrypt\Logs\le-new.log" + "certbot certonly --expand --webroot -w `"${root_dir}`" --key-type rsa --cert-name ${product} --noninteractive --agree-tos --email ${letsencrypt_mail} -d ${letsencrypt_domain}" > "${app}\letsencrypt\Logs\le-start.log" + cmd.exe /c "certbot certonly --expand --webroot -w `"${root_dir}`" --key-type rsa --cert-name ${product} --noninteractive --agree-tos --email ${letsencrypt_mail} -d ${letsencrypt_domain}" > "${app}\letsencrypt\Logs\le-new.log" - pushd "${letsencrypt_root_dir}\${letsencrypt_main_domain}" - $ssl_cert = (Resolve-Path -Path (Get-Item "${letsencrypt_root_dir}\${letsencrypt_main_domain}\fullchain.pem").Target).ToString().Replace('\', '/') - $ssl_key = (Resolve-Path -Path (Get-Item "${letsencrypt_root_dir}\${letsencrypt_main_domain}\privkey.pem").Target).ToString().Replace('\', '/') + pushd "${letsencrypt_root_dir}\${product}" + $ssl_cert = (Resolve-Path -Path (Get-Item "${letsencrypt_root_dir}\${product}\fullchain.pem").Target).ToString().Replace('\', '/') + $ssl_key = (Resolve-Path -Path (Get-Item "${letsencrypt_root_dir}\${product}\privkey.pem").Target).ToString().Replace('\', '/') popd } @@ -69,7 +69,7 @@ if ( $args.Count -ge 2 ) if ($letsencrypt_domain) { - $acl = Get-Acl -Path "$env:SystemDrive\Certbot\archive\${letsencrypt_main_domain}" + $acl = Get-Acl -Path "$env:SystemDrive\Certbot\archive\${product}" $acl.SetSecurityDescriptorSddlForm('O:LAG:S-1-5-21-4011186057-2202358572-2315966083-513D:PAI(A;;0x1200a9;;;WD)(A;;FA;;;SY)(A;OI;0x1200a9;;;LS)(A;;FA;;;BA)(A;;FA;;;LA)') Set-Acl -Path $acl.path -ACLObject $acl }