Last active
November 2, 2023 10:01
-
-
Save unitycoder/ec217d20eecc2dfaf8d316acd8c3c5c5 to your computer and use it in GitHub Desktop.
Revisions
-
unitycoder revised this gist
Nov 2, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ foreach ($cert in $certs) { - Open firewall port for incoming TCP 4443 (if you want other computers from LAN to connect into your webserver) ### UNINSTALLING - **CommandPrompt** (as administrator): ```netsh http delete sslcert ipport=0.0.0.0:4443``` ### TROUBLESHOOTING > "SSL Certificate add failed, Error: 1312 A specified logon session does not exist. It may already have been terminated." -
unitycoder revised this gist
Nov 2, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ ### Using HTTPListener with HTTPS - **VS**: c# httplistener project, add ```listener.Prefixes.Add($"https://192.168.1.xxx:4443/");``` *or some other ip/port - **Browser**: Test connecting into it, error: "Secure Connection Failed : Error code: PR_CONNECT_RESET_ERROR" - **PowerShell** (as administrator) to get certhash using snippet below: ```powershell -
unitycoder revised this gist
Oct 31, 2023 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,12 +28,12 @@ foreach ($cert in $certs) { ### TROUBLESHOOTING > "SSL Certificate add failed, Error: 1312 A specified logon session does not exist. It may already have been terminated." Wrong certhash with netsh command. Try other ones from the returned list. > "The parameter is incorrect." Dont use ticks or quotes for appid='{...}' in netsh command > "Secure Connection Failed: Error code: Certificate type not approved for application., SEC_ERROR_INADEQUATE_CERT_TYPE" Used wrong appid taken from powershell list, use another one. -
unitycoder revised this gist
Oct 31, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ foreach ($cert in $certs) { ### OPTIONAL - Open firewall port for incoming TCP 4443 (if you want other computers from LAN to connect into your webserver) ### UNINSTALLING - netsh http delete sslcert ipport=0.0.0.0:4443 -
unitycoder revised this gist
Oct 31, 2023 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ ### Using HTTPListener with HTTPS - **VS**: c# httplistener project, add listener.Prefixes.Add($"https://192.168.1.xxx:4443/"); *or some other ip/port - **Browser**: Test connecting into it, error: "Secure Connection Failed : Error code: PR_CONNECT_RESET_ERROR" - **PowerShell** (as administrator) to get certhash using snippet below: -
unitycoder revised this gist
Oct 31, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ foreach ($cert in $certs) { ``` - Pick one of those (2nd one is usually the correct?) - "appid" is from your vs studio *.sln solution file, SolutionGuid = <here> - **CommandPrompt** (as administrator): ```netsh http add sslcert ipport=0.0.0.0:4443 certhash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx appid={xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}``` - **Browser** test reload: https://192.168.1.xxx:4443 - **Browser**: Warning about insecure cert (ERR_CERT_AUTHORITY_INVALID), press advanced, Accept and Continue - Done! -
unitycoder revised this gist
Oct 31, 2023 . 1 changed file with 8 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,20 @@ - **VS**: c# httplistener project, add listener.Prefixes.Add($"https://192.168.1.xxx:4443/"); *or some other ip/port - **Browser**: Test connecting into it, error: "Secure Connection Failed : Error code: PR_CONNECT_RESET_ERROR" - **PowerShell** (as administrator) to get certhash using snippet below: ```powershell $certs = Get-ChildItem -Path Cert:\LocalMachine\My foreach ($cert in $certs) { $thumbprint = $cert.Thumbprint $appid = [System.Guid]::NewGuid() Write-Host "Certificate certhash: $thumbprint" #Write-Host "Application ID (appid): $appid" } ``` - Pick one of those (2nd one is usually the correct?) - "appid" is from your vs studio *.sln solution file, SolutionGuid = <here> - **CommandPrompt** (as administrator): netsh http add sslcert ipport=0.0.0.0:4443 certhash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx appid={xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - **Browser** test reload: https://192.168.1.xxx:4443 - **Browser**: Warning about insecure cert (ERR_CERT_AUTHORITY_INVALID), press advanced, Accept and Continue - Done! -
unitycoder created this gist
Oct 31, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ - VS: c# httplistener project, add listener.Prefixes.Add($"https://192.168.1.xxx:4443/"); *or some other ip/port - Browser: Test connecting into it, error: "Secure Connection Failed : Error code: PR_CONNECT_RESET_ERROR" - PowerShell (as administrator) to get certhash using snippet below: $certs = Get-ChildItem -Path Cert:\LocalMachine\My foreach ($cert in $certs) { $thumbprint = $cert.Thumbprint $appid = [System.Guid]::NewGuid() Write-Host "Certificate certhash: $thumbprint" #Write-Host "Application ID (appid): $appid" } - Pick one of those (2nd one is usually the correct?) - "appid" is from your vs studio *.sln solution file, SolutionGuid = <here> - Command prompt (as administrator): netsh http add sslcert ipport=0.0.0.0:4443 certhash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx appid={xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - Browser test reload: https://192.168.1.xxx:4443 - Browser: Warning about insecure cert (ERR_CERT_AUTHORITY_INVALID), press advanced, Accept and Continue - Done! ### OPTIONAL - Open firewall port for incoming TCP 4443 (if you want other computers from LAN to connect) ### UNINSTALLING - netsh http delete sslcert ipport=0.0.0.0:4443 ### TROUBLESHOOTING > "SSL Certificate add failed, Error: 1312 A specified logon session does not exist. It may already have been terminated." wrong certhash with netsh command > "The parameter is incorrect." dont use ticks or quotes for appid='{...}' in netsh command > "Secure Connection Failed: Error code: Certificate type not approved for application., SEC_ERROR_INADEQUATE_CERT_TYPE" used wrong appid taken from powershell list, use another one.