HTTPS mode for VirtualHost
Posted by: Riyad (102.113.198.---)
Date: December 29, 2023 06:12PM

The HTTPS mode for virtualHost does not seem to work in my case for WAMPServer 3.3.3. When clicking on the HTTPS mode for VirtualHost --> Hostname, a shell opens which says Error in batch file to create certificates. Press enter to continue. I would like to know how to be able to at least create a certificate manually in WAMP to get the system working. This would help a lot.

If anyone has a solution for me, a help would be highly appreciated.

Thanks

Options: ReplyQuote
Re: HTTPS mode for VirtualHost
Posted by: Otomatic (Moderator)
Date: December 30, 2023 09:27AM

What is the Apache version?

This batch file corresponds to lines 54 to 90 of the C:\wamp64\scripts\changeToHttps.php file.

To obtain more information, you can uncomment (delete the // at the beginning) line 96 ( //error_log(......); ) and then restart the creation of the https VirtualHost.
The results and the error will then be in the file:
c:\wamp64\logs\php_error.log

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: HTTPS mode for VirtualHost
Posted by: Riyad (102.113.198.---)
Date: December 31, 2023 06:44AM

Greetings Otomatic,

Special thanks to you and the whole WAMP Server team, I have been using the software for more than 10 years now and it did its job perfectly.
With reference to my error, I recently upgraded from WAMP 3.3.1 to WAMP 3.3.3. I also upgraded the Apache from 2.4.37 to 2.4.58. The PHP version is 8.3.1. For the virtualhost, when HTTPS mode was activated, 3 files were created in C:\wamp64\bin\Certs\Server, namely: Server.csr, Server.key, Server.rnd. I wanted to create a `test.localhost`. It seems that the c:\wamp64\bin\Certs/Cacerts/Certificat.crt file is missing. Also there is no `test.localhost.*` files created in `c:\wamp64\bin\Certs/Server/` Folder.

If you have any clues on how to solve, this would help. Thanks.

Note: Please find below the log from php_error when the line 96 of changeToHttps.php was uncommented.

--- File cleaned up by Wampserver ---
--- on 2023-12-31 05:05
[31-Dec-2023 05:08:18 UTC] result= 0 file(s) copied.
result_code=1
output=Array
(
[0] =>
[1] => C:\wamp64\scripts>Rem Wampserver installation variables
[2] =>
[3] => C:\wamp64\scripts>set installdir=c:\wamp64
[4] =>
[5] => C:\wamp64\scripts>set apachever=2.4.58
[6] =>
[7] => C:\wamp64\scripts>set OPENSSL_CONF=c:\wamp64\bin\apache\apache2.4.58\conf\openssl.cnf
[8] =>
[9] => C:\wamp64\scripts>set DIRCERTS=c:\wamp64\bin\Certs
[10] =>
[11] => C:\wamp64\scripts>cd /D c:\wamp64\bin\apache\apache2.4.58\bin
[12] =>
[13] => c:\wamp64\bin\apache\apache2.4.58\bin>set /P PASSWORD= 0<..\..\..\Certs\Other\Password.txt
[14] =>
[15] => c:\wamp64\bin\apache\apache2.4.58\bin>Rem 6- ServerName of the local site for which you want the keys
[16] =>
[17] => c:\wamp64\bin\apache\apache2.4.58\bin>set SERVLOCAL=test.localhost
[18] =>
[19] => c:\wamp64\bin\apache\apache2.4.58\bin>Rem 7- Random number (Different seed - 1677 may be changed)
[20] =>
[21] => c:\wamp64\bin\apache\apache2.4.58\bin>if exist c:\wamp64\bin\Certs\Server\Server.rnd del c:\wamp64\bin\Certs\Server\Server.rnd
[22] =>
[23] => c:\wamp64\bin\apache\apache2.4.58\bin>openssl rand -out c:\wamp64\bin\Certs/Server/Server.rnd -base64 1677
[24] =>
[25] => c:\wamp64\bin\apache\apache2.4.58\bin>Rem 8- Private RSA key.
[26] =>
[27] => c:\wamp64\bin\apache\apache2.4.58\bin>if exist c:\wamp64\bin\Certs\Server\Server.key del c:\wamp64\bin\Certs\Server\Server.key
[28] =>
[29] => c:\wamp64\bin\apache\apache2.4.58\bin>openssl genrsa -out c:\wamp64\bin\Certs/Server/Server.key -rand c:\wamp64\bin\Certs/Server/Server.rnd 4096
[30] =>
[31] => c:\wamp64\bin\apache\apache2.4.58\bin>Rem 9- Signing request for ServerName certificate
[32] =>
[33] => c:\wamp64\bin\apache\apache2.4.58\bin>Rem /C=FR : Country -- /ST=Paris : State or r�gion -- /L=Paris : City
[34] =>
[35] => c:\wamp64\bin\apache\apache2.4.58\bin>Rem /O=Otomatic & Cie : Organisation -- /CN=nom du site local
[36] =>
[37] => c:\wamp64\bin\apache\apache2.4.58\bin>if exist c:\wamp64\bin\Certs\Server\Server.csr del c:\wamp64\bin\Certs\Server\Server.csr
[38] =>
[39] => c:\wamp64\bin\apache\apache2.4.58\bin>openssl req -new -sha256 -key c:\wamp64\bin\Certs/Server/Server.key -out c:\wamp64\bin\Certs/Server/Server.csr -subj "/C=FR/ST=Paris/L=Paris/O=Otomatic & Cie/OU=Wampserver/CN=test.localhost"
[40] =>
[41] => c:\wamp64\bin\apache\apache2.4.58\bin>Rem 10- Signature request for server certificate.
[42] =>
[43] => c:\wamp64\bin\apache\apache2.4.58\bin>if exist c:\wamp64\bin\Certs\Server\Server.crt del c:\wamp64\bin\Certs\Server\Server.crt
[44] =>
[45] => c:\wamp64\bin\apache\apache2.4.58\bin>openssl x509 -req -days 4383 -sha256 -in c:\wamp64\bin\Certs/Server/Server.csr -CA c:\wamp64\bin\Certs/Cacerts/Certificat.crt -CAkey c:\wamp64\bin\Certs/Cacerts/Certificat.key -CAcreateserial -out c:\wamp64\bin\Certs/Server/Server.crt
[46] =>
[47] => c:\wamp64\bin\apache\apache2.4.58\bin>openssl x509 -outform der -in c:\wamp64\bin\Certs/Server/Server.crt -out c:\wamp64\bin\Certs/Server/Server.der
[48] =>
[49] => c:\wamp64\bin\apache\apache2.4.58\bin>openssl x509 -inform DER -outform PEM -in c:\wamp64\bin\Certs/Server/Server.der -out c:\wamp64\bin\Certs/Server/Server.pem
[50] =>
[51] => c:\wamp64\bin\apache\apache2.4.58\bin>openssl crl2pkcs7 -nocrl -certfile c:\wamp64\bin\Certs/Cacerts/Certificat.crt -certfile c:\wamp64\bin\Certs/Server/Server.crt -out c:\wamp64\bin\Certs/Server/test.localhost.p7b
[52] =>
[53] => c:\wamp64\bin\apache\apache2.4.58\bin>if exist c:\wamp64\bin\Certs\Server\test.localhost.pfx del c:\wamp64\bin\Certs\Server\test.localhost.pfx
[54] =>
[55] => c:\wamp64\bin\apache\apache2.4.58\bin>openssl pkcs12 -export -nodes -in c:\wamp64\bin\Certs/Cacerts/Certificat.crt -inkey c:\wamp64\bin\Certs/Server/Server.key-out c:\wamp64\bin\Certs/Server/test.localhost.pfx -descert -name "test.localhost" -password pass:
[56] =>
[57] => c:\wamp64\bin\apache\apache2.4.58\bin>Rem
[58] =>
[59] => c:\wamp64\bin\apache\apache2.4.58\bin>Rem 11- Client certificate.
[60] =>
[61] => c:\wamp64\bin\apache\apache2.4.58\bin>Rem Nota : A password will be requested unless the final option is -password pass:MyPass
[62] =>
[63] => c:\wamp64\bin\apache\apache2.4.58\bin>openssl pkcs12 -nodes -export -in c:\wamp64\bin\Certs/Server/Server.crt -inkey c:\wamp64\bin\Certs/Server/Server.key -out c:\wamp64\bin\Certs/Site/test.localhost.pfx -clcerts -descert -name "Client test.localhost Certificate" -password pass:
[64] =>
[65] => c:\wamp64\bin\apache\apache2.4.58\bin>Rem 12- Copy of keys
[66] =>
[67] => c:\wamp64\bin\apache\apache2.4.58\bin>copy /Y c:\wamp64\bin\Certs\Server\Server.crt c:\wamp64\bin\Certs\Site\test.localhost.crt
[68] => The system cannot find the file specified.
[69] =>
[70] => c:\wamp64\bin\apache\apache2.4.58\bin>copy /Y c:\wamp64\bin\Certs\Server\Server.key c:\wamp64\bin\Certs\Site\test.localhost.key
[71] => 0 file(s) copied.
)

Options: ReplyQuote
Re: HTTPS mode for VirtualHost
Posted by: Otomatic (Moderator)
Date: December 31, 2023 10:44AM

I've carried out a full-scale test by creating a VirtualHost with ServerName test.localhost

In your log, there's a problem with reading the password which doesn't appear in element [63] where we have:
-descert -name "Client test.localhost Certificate" -password pass:
when we should have:
-descert -name "Client test.localhost Certificate" -password pass:MyPass

The password does not appear in element [55] either.

This password is the %PASSWORD% variable, which comes from batch element [13]:
set /P PASSWORD= <..\..\..\Certs\Other\Password.txt
And the contents of the Password.txt file must be: MyPass

This content was created when the Wamp parameter "Wampserver ready to support https" was set to On by the line in another batch file:
@echo MyPass> .\Other\Password.txt
set /P PASSWORD= <.\Other\Password.txt
It would therefore appear that the Certs\Other\Password.txt file is empty, whereas it should contain MyPass.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: HTTPS mode for VirtualHost
Posted by: neojor80 (---.digimobil.es)
Date: January 07, 2024 11:37AM

Hello, It doesn't appear in the menu to enable HTTPS, I can see. 3.3.3 but what the help says is not the same as what it shows me in the menu. What should I do to make it work?
Thank you

Options: ReplyQuote
Re: HTTPS mode for VirtualHost
Posted by: Otomatic (Moderator)
Date: January 07, 2024 12:11PM

Hi,

> Hello, It doesn't appear in the menu to enable HTTPS

Because, when you installed the 3.3.3 (or 3.3.2) update, you answered Yes to the question :

Quote

This update installs "Wampserver HTTPS SSL support"
If you already have HTTPS support and to avoid any harmful interaction with "Wampserver HTTPS SSL mode", it is preferable to hide the possibility of installing "Wampserver HTTPS SSL support
Answering Yes only hides it temporarily. You can always unmask later.
Do you want to hide "Wampserver HTTPS SSL support

So, in wampmanager.conf put: UseWampHttps = "on"

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.