How do I configure certbot certificates on Tomcat for HTTPS?









up vote
0
down vote

favorite












I've been trying to configure SSL for Tomcat 8.5 server on the school I work to use HTTPS protocol. Since we haven't buy a certificate with a CA, I used certbot to get a free one. I did some configuration and my Tomcat is serving on HTTP but not yet on HTTPS, and there are no errors on the logs. Here is what I did.



-The Tomcat 8.5 is installed on Windows server 2012. It has worked perfectly for 2 years serving applications on regular HTTP.

-Certbot does not support Windows, therefore, I had to install Ubuntu 16.04 on a VM.
-I installed certboot successfully on Ubuntu.
-I used the folowing command to get my certbot certificates:



sudo certbot certonly --preferred-challenges http --manual -d theDomainOfMySchool.com


-After succeeding the ACME challenge, I got these 4 .pem files: cert1.pem, chain1.pem, fullchain1.pem and privkey1.pem.



-All 4 files are clear text in base64 like this extract I’m pasting here:



-----BEGIN CERTIFICATE-----
MIIFYTCCBEmgAwIBAgISAwyxKh7NQWpNnH6w2enPbOlxMA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD


-After fighting a while with permissions to copy the 4 files from /etc/letsencrypt/archive, I placed them in the folder of my Tomcat server in Windows.
-I configured Tomcat with the following nodes on server.xml:



<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="conf/cert/certbot_gallery/privkey1.pem"
certificateFile="conf/cert/certbot_gallery/cert1.pem"
certificateChainFile="conf/cert/certbot_gallery/chain1.pem"
type="RSA" />
</SSLHostConfig>
</Connector>

<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


-When I start my Tomcat, there are no errors on the logs.



-The server starts fine and serves on HTTP with no problem.



-When I try to access the applications through HTTPS I get ERR_CONNECTION_RESET on the browser.



What am I doing wrong. Are this kind of certificates not suitable for this Tomcat connector? Am I missing any configuration?



Thank you all.










share|improve this question





















  • Note LetsEncrypt.org which certbot uses is a CA. The fact it doesn't charge money differs from some other CAs, but it is still a CA.
    – dave_thompson_085
    Nov 11 at 23:34















up vote
0
down vote

favorite












I've been trying to configure SSL for Tomcat 8.5 server on the school I work to use HTTPS protocol. Since we haven't buy a certificate with a CA, I used certbot to get a free one. I did some configuration and my Tomcat is serving on HTTP but not yet on HTTPS, and there are no errors on the logs. Here is what I did.



-The Tomcat 8.5 is installed on Windows server 2012. It has worked perfectly for 2 years serving applications on regular HTTP.

-Certbot does not support Windows, therefore, I had to install Ubuntu 16.04 on a VM.
-I installed certboot successfully on Ubuntu.
-I used the folowing command to get my certbot certificates:



sudo certbot certonly --preferred-challenges http --manual -d theDomainOfMySchool.com


-After succeeding the ACME challenge, I got these 4 .pem files: cert1.pem, chain1.pem, fullchain1.pem and privkey1.pem.



-All 4 files are clear text in base64 like this extract I’m pasting here:



-----BEGIN CERTIFICATE-----
MIIFYTCCBEmgAwIBAgISAwyxKh7NQWpNnH6w2enPbOlxMA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD


-After fighting a while with permissions to copy the 4 files from /etc/letsencrypt/archive, I placed them in the folder of my Tomcat server in Windows.
-I configured Tomcat with the following nodes on server.xml:



<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="conf/cert/certbot_gallery/privkey1.pem"
certificateFile="conf/cert/certbot_gallery/cert1.pem"
certificateChainFile="conf/cert/certbot_gallery/chain1.pem"
type="RSA" />
</SSLHostConfig>
</Connector>

<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


-When I start my Tomcat, there are no errors on the logs.



-The server starts fine and serves on HTTP with no problem.



-When I try to access the applications through HTTPS I get ERR_CONNECTION_RESET on the browser.



What am I doing wrong. Are this kind of certificates not suitable for this Tomcat connector? Am I missing any configuration?



Thank you all.










share|improve this question





















  • Note LetsEncrypt.org which certbot uses is a CA. The fact it doesn't charge money differs from some other CAs, but it is still a CA.
    – dave_thompson_085
    Nov 11 at 23:34













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I've been trying to configure SSL for Tomcat 8.5 server on the school I work to use HTTPS protocol. Since we haven't buy a certificate with a CA, I used certbot to get a free one. I did some configuration and my Tomcat is serving on HTTP but not yet on HTTPS, and there are no errors on the logs. Here is what I did.



-The Tomcat 8.5 is installed on Windows server 2012. It has worked perfectly for 2 years serving applications on regular HTTP.

-Certbot does not support Windows, therefore, I had to install Ubuntu 16.04 on a VM.
-I installed certboot successfully on Ubuntu.
-I used the folowing command to get my certbot certificates:



sudo certbot certonly --preferred-challenges http --manual -d theDomainOfMySchool.com


-After succeeding the ACME challenge, I got these 4 .pem files: cert1.pem, chain1.pem, fullchain1.pem and privkey1.pem.



-All 4 files are clear text in base64 like this extract I’m pasting here:



-----BEGIN CERTIFICATE-----
MIIFYTCCBEmgAwIBAgISAwyxKh7NQWpNnH6w2enPbOlxMA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD


-After fighting a while with permissions to copy the 4 files from /etc/letsencrypt/archive, I placed them in the folder of my Tomcat server in Windows.
-I configured Tomcat with the following nodes on server.xml:



<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="conf/cert/certbot_gallery/privkey1.pem"
certificateFile="conf/cert/certbot_gallery/cert1.pem"
certificateChainFile="conf/cert/certbot_gallery/chain1.pem"
type="RSA" />
</SSLHostConfig>
</Connector>

<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


-When I start my Tomcat, there are no errors on the logs.



-The server starts fine and serves on HTTP with no problem.



-When I try to access the applications through HTTPS I get ERR_CONNECTION_RESET on the browser.



What am I doing wrong. Are this kind of certificates not suitable for this Tomcat connector? Am I missing any configuration?



Thank you all.










share|improve this question













I've been trying to configure SSL for Tomcat 8.5 server on the school I work to use HTTPS protocol. Since we haven't buy a certificate with a CA, I used certbot to get a free one. I did some configuration and my Tomcat is serving on HTTP but not yet on HTTPS, and there are no errors on the logs. Here is what I did.



-The Tomcat 8.5 is installed on Windows server 2012. It has worked perfectly for 2 years serving applications on regular HTTP.

-Certbot does not support Windows, therefore, I had to install Ubuntu 16.04 on a VM.
-I installed certboot successfully on Ubuntu.
-I used the folowing command to get my certbot certificates:



sudo certbot certonly --preferred-challenges http --manual -d theDomainOfMySchool.com


-After succeeding the ACME challenge, I got these 4 .pem files: cert1.pem, chain1.pem, fullchain1.pem and privkey1.pem.



-All 4 files are clear text in base64 like this extract I’m pasting here:



-----BEGIN CERTIFICATE-----
MIIFYTCCBEmgAwIBAgISAwyxKh7NQWpNnH6w2enPbOlxMA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD


-After fighting a while with permissions to copy the 4 files from /etc/letsencrypt/archive, I placed them in the folder of my Tomcat server in Windows.
-I configured Tomcat with the following nodes on server.xml:



<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="conf/cert/certbot_gallery/privkey1.pem"
certificateFile="conf/cert/certbot_gallery/cert1.pem"
certificateChainFile="conf/cert/certbot_gallery/chain1.pem"
type="RSA" />
</SSLHostConfig>
</Connector>

<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


-When I start my Tomcat, there are no errors on the logs.



-The server starts fine and serves on HTTP with no problem.



-When I try to access the applications through HTTPS I get ERR_CONNECTION_RESET on the browser.



What am I doing wrong. Are this kind of certificates not suitable for this Tomcat connector? Am I missing any configuration?



Thank you all.







ssl https tomcat8 certbot






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 17:11









Miguel Escalera

13




13











  • Note LetsEncrypt.org which certbot uses is a CA. The fact it doesn't charge money differs from some other CAs, but it is still a CA.
    – dave_thompson_085
    Nov 11 at 23:34

















  • Note LetsEncrypt.org which certbot uses is a CA. The fact it doesn't charge money differs from some other CAs, but it is still a CA.
    – dave_thompson_085
    Nov 11 at 23:34
















Note LetsEncrypt.org which certbot uses is a CA. The fact it doesn't charge money differs from some other CAs, but it is still a CA.
– dave_thompson_085
Nov 11 at 23:34





Note LetsEncrypt.org which certbot uses is a CA. The fact it doesn't charge money differs from some other CAs, but it is still a CA.
– dave_thompson_085
Nov 11 at 23:34













1 Answer
1






active

oldest

votes

















up vote
0
down vote













Solved! As it turns out, I'm an as$. The configuration on my server.xml is wrong. The connector for Http11NioProtocol should use the port 443 (which is the default for HTTPS), instead of 8443.
The rest of the configuration and the request of the certs on certboot is OK.



I think the use of 8443 is in case that your Tomcat is behind Apache or something else. Since I'm using directly, and only, Tomcat, the connector port should be 443.
Also, make sure that your firewall allows 443 port.






share|improve this answer




















  • Partly Tomcat can be behind something else and partly it can be on Unix where using ports below 1024 (both 80 and 443) requires either running java as root which can be dangerous or enabling capability which doesn't work on all systems and can be a bit complicated for unlearned users.
    – dave_thompson_085
    Nov 11 at 23:31










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251171%2fhow-do-i-configure-certbot-certificates-on-tomcat-for-https%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Solved! As it turns out, I'm an as$. The configuration on my server.xml is wrong. The connector for Http11NioProtocol should use the port 443 (which is the default for HTTPS), instead of 8443.
The rest of the configuration and the request of the certs on certboot is OK.



I think the use of 8443 is in case that your Tomcat is behind Apache or something else. Since I'm using directly, and only, Tomcat, the connector port should be 443.
Also, make sure that your firewall allows 443 port.






share|improve this answer




















  • Partly Tomcat can be behind something else and partly it can be on Unix where using ports below 1024 (both 80 and 443) requires either running java as root which can be dangerous or enabling capability which doesn't work on all systems and can be a bit complicated for unlearned users.
    – dave_thompson_085
    Nov 11 at 23:31














up vote
0
down vote













Solved! As it turns out, I'm an as$. The configuration on my server.xml is wrong. The connector for Http11NioProtocol should use the port 443 (which is the default for HTTPS), instead of 8443.
The rest of the configuration and the request of the certs on certboot is OK.



I think the use of 8443 is in case that your Tomcat is behind Apache or something else. Since I'm using directly, and only, Tomcat, the connector port should be 443.
Also, make sure that your firewall allows 443 port.






share|improve this answer




















  • Partly Tomcat can be behind something else and partly it can be on Unix where using ports below 1024 (both 80 and 443) requires either running java as root which can be dangerous or enabling capability which doesn't work on all systems and can be a bit complicated for unlearned users.
    – dave_thompson_085
    Nov 11 at 23:31












up vote
0
down vote










up vote
0
down vote









Solved! As it turns out, I'm an as$. The configuration on my server.xml is wrong. The connector for Http11NioProtocol should use the port 443 (which is the default for HTTPS), instead of 8443.
The rest of the configuration and the request of the certs on certboot is OK.



I think the use of 8443 is in case that your Tomcat is behind Apache or something else. Since I'm using directly, and only, Tomcat, the connector port should be 443.
Also, make sure that your firewall allows 443 port.






share|improve this answer












Solved! As it turns out, I'm an as$. The configuration on my server.xml is wrong. The connector for Http11NioProtocol should use the port 443 (which is the default for HTTPS), instead of 8443.
The rest of the configuration and the request of the certs on certboot is OK.



I think the use of 8443 is in case that your Tomcat is behind Apache or something else. Since I'm using directly, and only, Tomcat, the connector port should be 443.
Also, make sure that your firewall allows 443 port.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 at 20:29









Miguel Escalera

13




13











  • Partly Tomcat can be behind something else and partly it can be on Unix where using ports below 1024 (both 80 and 443) requires either running java as root which can be dangerous or enabling capability which doesn't work on all systems and can be a bit complicated for unlearned users.
    – dave_thompson_085
    Nov 11 at 23:31
















  • Partly Tomcat can be behind something else and partly it can be on Unix where using ports below 1024 (both 80 and 443) requires either running java as root which can be dangerous or enabling capability which doesn't work on all systems and can be a bit complicated for unlearned users.
    – dave_thompson_085
    Nov 11 at 23:31















Partly Tomcat can be behind something else and partly it can be on Unix where using ports below 1024 (both 80 and 443) requires either running java as root which can be dangerous or enabling capability which doesn't work on all systems and can be a bit complicated for unlearned users.
– dave_thompson_085
Nov 11 at 23:31




Partly Tomcat can be behind something else and partly it can be on Unix where using ports below 1024 (both 80 and 443) requires either running java as root which can be dangerous or enabling capability which doesn't work on all systems and can be a bit complicated for unlearned users.
– dave_thompson_085
Nov 11 at 23:31

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251171%2fhow-do-i-configure-certbot-certificates-on-tomcat-for-https%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto