Add cert to docker container

My domain is: nielsonnetwork.asuscomm.com

My web server is (include version): Apache2

The operating system my web server runs on is (include version): DietPi (Bullseye)

I can login to a root shell on my machine (yes or no, or I don't know): Yes

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): 1.12

So here is my question. i have my cert working fine for all items in the WWW folder. i was messing around with using docker for the first time and set up a website that runs on port 3000 (so id connect to nielsonnetwork.asuscomm.com:3000) how would i get my existing cert to work with this?

Setup an Apache VirtualHost for that port and use the same cert config as used for your port 443 VirtualHost. Access it using https://(domain):3000

Open that port in your router and configure that port's path to your docker container

Is that what you mean?

3 Likes

OR
Do you mean...
How can I get that cert into my docker container?

3 Likes
<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName nielsonnetwork.asuscomm.com

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/nielsonnetwork.asuscomm.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nielsonnetwork.asuscomm.com/privkey.pem
</VirtualHost>
<VirtualHost *:3000>
        ServerName nielsonnetwork.asuscomm.com

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/nielsonnetwork.asuscomm.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nielsonnetwork.asuscomm.com/privkey.pem
</VirtualHost>

</IfModule>

this is what my conf file looks like. The 443 site runs, but the 3000 site gives me this error

An error occurred during a connection to nielsonnetwork.asuscomm.com:3000. SSL received a record that exceeded the maximum permissible length.

Error code: SSL_ERROR_RX_RECORD_TOO_LONG

The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the website owners to inform them of this problem.

sorry if this seems obvious, im newer to certs

This is not so much a "cert" issue as an Apache configuration issue. That said, what does this show

apachectl -t -D DUMP_VHOSTS
3 Likes

Neither of those two server blocks has a document root statement.
[if you showed the whole block]

2 Likes
VirtualHost configuration:
*:443                  nielsonnetwork.asuscomm.com (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
*:80                   nielsonnetwork.asuscomm.com (/etc/apache2/sites-enabled/000-default.conf:2)
*:3000                 is a NameVirtualHost
         default server nielsonnetwork.asuscomm.com (/etc/apache2/sites-enabled/000-default-le-ssl.conf:9)
         port 3000 namevhost nielsonnetwork.asuscomm.com (/etc/apache2/sites-enabled/000-default-le-ssl.conf:9)
         port 3000 namevhost nielsonnetwork.asuscomm.com (/etc/apache2/sites-enabled/pingvin-share.conf:2)

That's a name:port overlap - NOT GOOD
[something Apache allows us to do without warning]

3 Likes

i forgot i created a new conf file, ill delete it

2 Likes

deleted it and restarted apache, no change.

VirtualHost configuration:
*:443                  nielsonnetwork.asuscomm.com (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
*:3000                 nielsonnetwork.asuscomm.com (/etc/apache2/sites-enabled/000-default-le-ssl.conf:9)
*:80                   nielsonnetwork.asuscomm.com (/etc/apache2/sites-enabled/000-default.conf:2)

Is this the only Apache you have running? Or do you have one in a Docker Container and one outside it?

2 Likes

i totally forget docker installs its own stuff.

Yes i have one in docker and one outside of it.

You have to sort out which ports go to where. Check out a docker forum.

3 Likes

port 3000 goes to my container, ill go look at docker forums. thank you

1 Like