Hostname and SSL

Sidular

Verified User
Joined
Feb 20, 2023
Messages
16
Location
Canada
I'm almost definitely doing something wrong here. Been trying to generate an SSL for the server, and it keeps giving me the below error.

[root@da1785 ~]# cd /usr/local/directadmin/scripts
[root@da1785 scripts]# ./letsencrypt.sh request_single `da1785.doroyal.com -f` 4096
-bash: da1785.doroyal.com: command not found
Domain does not exist on the system. Unable to find 4096 in /etc/virtual/domainowners, and domain is not set as hostname (servername) in DirectAdmin configuration. Exiting...
no valid domain found - exiting
[root@da1785 scripts]#

To my knowledge, however, the hostname is set up correctly, and fully resolves to the server. (works without ssl)
IKLhmX7.png


Currently, my WHMCS panel is unable to send mail due to what appears to be an issue related to SSL. Keeps timing out when trying to send. I figured enabling SSL for the panel would fix this, but it does not.

Tried the following.

cd /usr/local/directadmin/scripts
./letsencrypt.sh request_single `hostname -f` 4096

cd /usr/local/directadmin/custombuild
./build rewrite_confs

In the directadmin.conf file, the following exists
servername=da1785.doroyal.com
ssl_redirect_host=da1785.doroyal.com


What am I doing wrong?
 
Code:
./letsencrypt.sh request_single `da1785.doroyal.com -f` 4096
What does that -f do? Normally it only needs to be:
./letsencrypt.sh request_single da1785.doroyal.com 4096
no quotes, no other things needed, which already might solve the issue of the "command not found".

So try again the correct way.

If it still throws the same error, add the domain name doroyal.com as domain in your admin account under user level.
 
Code:
./letsencrypt.sh request_single `da1785.doroyal.com -f` 4096
What does that -f do? Normally it only needs to be:
./letsencrypt.sh request_single da1785.doroyal.com 4096
no quotes, no other things needed, which already might solve the issue of the "command not found".

So try again the correct way.

If it still throws the same error, add the domain name doroyal.com as domain in your admin account under user level.
I was following the directions from the DirectAdmin Doc.
https://docs.directadmin.com/webservices/ssl/service-ssls-and-le.html

The "correct way" seems to have worked! Thanks a ton, Richard.

Any idea why the official docs have the -f flag?
 
I was following the directions from the DirectAdmin Doc.
Not really, as it says there "hostname -f" which means it will detect the hostname for you, not that you have to fill in your hostname yourself there.
However, I do agree that it's confusing and one could think that one has to put in the real hostname there.

That is also the answer why the quotation marks and the -f is in there. ;)

You're welcome, glad you got it fixed!
 
The command is meant to be copied exactly:

./letsencrypt.sh request_single `hostname -f` 4096

i.e. don't substitute anything.

The backticks (`) here are used in bash to execute that command and parameters and insert the output of the of that execution in that spot.

It's essentially running

hostname -f

And then replacing `hostname -f` with the output of that into the full command line.

This could also be written as

./letsencrypt.sh request_single $(hostname -f) 4096

If you wanted to use or are more familiar with subshells.
 
you can report that error
It's not an error, as explained, but it might be made more clear in the docs that one does not need to fill in the hostname, lots of people are not aware of these kind of shell things.

Now it says:
We've written the script in such a manner that you can also set up SSL for your hostname and all services in one simple command for your hostname e.g.,:
And e.g. means "for example" if I'm not mistaken, which also gives the impression that one can put in the real hostname there.

So there is certainly room for a bit of improvement in the docs to make more clear that it's either hostname or the 'hostname -f' to fill in there.
@scriptkitty? Maybe something for you?
 
Back
Top