The officially official Devuan Forum!

You are not logged in.

#726 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 04:15:04

Ok; I had forgotten... you need to set up group access to live and archive:

# chmod g+rx /etc/letsencrypt/{live,archive}

#727 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 04:07:38

Hmm please show output of

# namei -om /etc/letsencrypt/live/realupnow.com/fullchain.pem

#728 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 04:01:49

If you are logged in as root then you won't need sudo.
Something else is wrong.
Can you copy&paste actually command and error?

#729 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 03:56:47

Right. The "#" prompt is normally the signal for commands that needs to be run as root.

#730 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 03:41:13

Ah, my mistake. The user is www-data... so perhaps the full sequence should be:

# addgroup ssl-cert
# chgrp ssl-cert /etc/letsencrypt/{live,archive}
# adduser www-data ssl-cert

And then you may verify access by getting no complaints from:

# runuser -u www-data cat /etc/letsencrypt/live/realupnow.com/fullchain.pem > /dev/null

#731 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 03:27:32

Next, the server block needs to include a couple of ssl directives, in particular ssl_certificate and ssl_certificate_key
with the full pathnames for the ssl certificate and key.

Your certificate and chain have been saved at:
/etc/letsencrypt/live/realupnow.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/realupnow.com/privkey.pem

Note now that nginx run as user www-data, and that it needs access to those files. If your setup includes group ssl-cert for /etc/letsencrypt/live and /etc/letsencrypt/archive then the easy step is to add nginx to that group:

# adduser nginx ssl-cert

and then you are almost there...

#732 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 03:23:36

Yes, if it comforts you. I wouldn't smile.
And yes, you need to change the nginx configuration accordingly.

(I would rather keep in mind that I've choosen my own root and adapt instructions where needed)

#733 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 03:06:09

Next, according to the manual the listen directive should look like:

listen 443 ssl;

and if you want it to include a "default_server" (which you don't smile) then that should be mentioned before the ssl tag rather than after it.

#734 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 02:58:09

Great. The ssl configuration can be merged with the plain http configration into a single "server {...}" block. That would bring the advantage of certainly sharing the "location {..}" blocks which are where you declare service the points.

But if you, as is customary nowawdays, primarily want to only provide https service, and hev the http service merely redirect to corresponding https service, then you would certainly have separate "server {..}" blocks.

#735 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 02:42:07

It doesn't matter too much; some editors provide indentation and "block" support for files ending in .conf which could be an argument for renaming, but the name is not important; only that the link has to point to the actual file.

The pathnames used in sites-enabled/ have the additional significance that nginx will process them in alphabetical order, and if many, the first ono is taken as "the default service" if it needs that. Since you have only one there is no potential of confusion.

In short: it's up to you smile but make sure the link is valid.

#736 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 02:06:44

You seem to still want the local names in the DNS setup to include the base domain name, and you have now defined resolution for www.realupnow.com.realupnow.com

The record should only have www and not www.realupnow.com

The local name will get realupnow.com appended automagically.

#737 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 01:30:05

To follow current sysadmin style, your nginx service configuration should be a main file /etc/nginx/sites-available/realupnow.conf and optionally a side file like /etc/nginx/snippets/ssl.conf, plus the link /etc/nginx/sites-enabled/realupnow.conf pointing to ../sites-available/realupnow.conf.

I don't see a direct need to change the main configuration in /etc/nginx/nginx.conf or /etc/nginx/nginx.conf.d/* but I might be wrong in that.

#738 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 01:22:10

No. apparently certbot includes some bogus advice that might be useful for some apache2 setups but certainly not relevant for you. It's just that the certbot developers have had their "we must do it all" hats on and try to make the tool do much more than just preparing the certificate.

With "certonly --webroot" option you avoid that but obviously the program will still insist with bogus (though technically harmless) instructions.

#739 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 01:08:32

You will need a certificate that includes both realupnow.com and www.realupnow.com so that's a new certificate; you don't want to keep the existing.

You still need to update your nginx configuration both so that it also services www.realupnow.com, and that it offers https access as well (to both domain names).

You may do the first by adding www.realupnow.com to the server_name directive (space separated).

The second, adding ssl, has a number of bits to it; perhaps the easiest is to search for that techrepublic howto ("setup ssl for nginx" might find it?) and pick knowledge from it.

#740 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-02 00:01:44

Nope. It only declares the resolution for the domain itself, without local host.

If their web gui allows, you could declare a resolution for "*" to mean "any local domain" and that would include "ralph" as well as "www" as well as "thisisagoodplacetobe" etc. Usually though "*" does not include local domain names with "." in (which is fine here I guess).

#741 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-01 23:04:04

Yes, or edit it so it says "www" instead of "realupnow.com" and then it will define the resolution for "www.realupnow.com" smile

#742 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-01 22:51:37

You reported the setting

A Record 	realupnow.com    66.172.90.106   Automatic

That setting is for a host with local name  realupnow.com within your domain realupnow.com and it therefore defines the FQDN realupnow.com.realupnow.com.

Maybe you get confused by the fact that the local name looks the same as the domain name?

#743 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-01 22:38:36

Or possibly a caching issue. Check the authoritative service with

dig realupnow.com @dns1.registrar-servers.com

#744 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-01 22:16:49

Great.

Your dns setup defines 2 FQDN, namely realupnow.com (by the @ line), and realupnow.com.realupnow.com (by the other line).

As I understand it, you want to provide several services:
     1. http://realupnow.com
     2. http://www.realupnow.com
     3. https://realupnow.com
     4. https://www.realupnow.com
but don't really care for http://realupnow.com.realupnow.com, which is serviced now.

That means firstly that your DNS setup must define the resolution for www.realupnow.com
(and rather not for realupnow.com.realupnow.com)

Secondly nginx needs to accept two alternative server names, and it also should use both plain http on port 80 and http over ssl on port 443.

For the latter, you need to locate where certbot has put the ssl credentials (as I mentioned before) and add that to the nginx configuration. (I think www.techrepublic.com has a good article for that).
(Also, keep in mind that by convention, nginx runs as user www-data)

#745 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-01 06:38:14

Yes, the http service is not accessible (from outside).

If you are sure there shouldn't be any blocking, then you could run

# tcpdump -n -i eth0

on the service host to see connection attempts for port 80.

But maybe best to get some sleep too smile

#746 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-01 06:15:48

I think it's better to change the "-w" argument to /var/www/realupnow.com since your nginx is already set up to serve from that root path.

#747 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-01 05:35:28

If webroot is /var/www/html is it expecting /realupnow.com/index.html to be there?

Because I have it at /var/www/realupnow.com/index.html

No, but the "webroot path" needs to coincide with the served "root path".

  • certbot will put its file at $webroot/.well-known/acme-challenge/BLAH (i.e. using its $webroot), and

  • the "external" host will get it from http://realupnow.com/.well-known/acme-challenge/BLAH

    which nginx will want to find at $root/.well-known/acme-challenge/BLAH (i.e., using its $root).

Re firewall, I'm not totally clear about your setup. With the Internet to the left, and your service host to the right, I currently understand it as:

      Internet --- 66.172.90.106 = router ---- 192.168.50.4 = host

If that is the case, you'd make 2 rules:
   1 http blank 192.168.50.4 80 tcp
   2 https blank 192.168.50.4 443 tcp
("blank" means to leave the field blank)

Doing so will open those two ports for connection from the Internet.

#748 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-01 05:03:05

Yes the DNS is all fine.

Now there seems to be some firewall to penetrate;  you'll need to allow incoming TCP connections for ports 80 (http) and 443 (https).

It might also be good if it responds to ICMP requests (aka ping).

#749 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-01 04:49:37

If your host ("the static IP") is directly on the Internet then that should do.

It needs to be an IP address that an "external" host can use for accessing your HTTP service.

Assuming you can suffer an amount of ads, you could check your externally visible IP address at https://whatismyipaddress.com/

#750 Re: Hardware & System Configuration » [SOLVED] Good nginx ssl instructions » 2023-01-01 04:14:53

Looks better. Though that IP address is a s.c. private address that is not usable across the Internet. I.e., only hosts on your network can use that IP address.

It will not be something that Let's Encrypt's server can use.

Board footer

Forum Software