Okay, so after playing with this for far longer than we should have to, we've come up with a solution that will survive reboots :)
First of all, we need to generate the correct certificate file including the entire chain of intermediate certificates except for the root certificate. The structure will be similar to this:
... there might be some metadata in here, or not ...
-----BEGIN CERTIFICATE-----
end-entity certificate, the one given to you by your CA
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE----- --|
-----END CERTIFICATE----- | certificate chain between your end-entity
... |-- cert and the root certificate,
-----BEGIN CERTIFICATE----- | excluding both
-----END CERTIFICATE----- --|
To make this simpler and more consistent, i’ll work through an example with a certificate for webmail.example.com
. Substitute this for your own domain wherever applicable.
You can get the correct chain from checking your site on https://whatsmychaincert.com: Under “Test Your Server”, enter your UTM’s public hostname and press Test. Most likely, you’ll get an error:
Click the This
link to download the correct certificate chain (the website explains how this works, if you’re curious). I’ll save it as webmail.example.com.chain.crt
.
Now, concatenate your end-entity certificate with the certificate chain. If you don’t know where to find your end-entity certificate, you can get it off your UTM appliance like so:
$ scp loginuser@<utm>:/var/confd/certs/host.cert host.crt
To create the correct certificate chain:
$ cat host.crt webmail.example.com.chain.crt > webmail.example.com.crt
This step will make sense a little bit later. Basically we need to replace all 0a
characters (line feed) in the webmail.example.com.crt
file with the \n
string:
$ sed ':a;N;$!ba;s/\n/\\n/g' webmail.example.com.crt
> webmail.example.com-prepared.crt
Next, ssh into your UTM box:
$ ssh loginuser@utm
$ sudo su - root
# cc
Now you’re in the Confd-Client of the UTM appliance. To modify the certificate, we need to figure out its REF-id in the system. The easiest way I know of is to find a reference to it somewhere in the object tree. In my case, it was used under webadmin/cert$
:
127.0.0.1 MAIN > webadmin
127.0.0.1 MAIN webadmin > cert$
webmail.example.com [REF_CaHosWebmailexa]
That REF_
string is the key to the certificate we want to modify. Yours will most likely be different. Now, re-enter the confd-client:
127.0.0.1 MAIN webadmin/cert (REF:ca->host_key_cert) > exit
# cc
Open the certificate object behind that REF_
key. For that we need to enter OBJS
mode (replace REF_CaHosWebmailexa
with the REF key):
127.0.0.1 MAIN > OBJS
127.0.0.1 OBJS > ca
127.0.0.1 OBJS ca > REF_CaHosWebmailexa
Now for the tricky part. Enter certificate=""
, but dont press [Enter] yet.
127.0.0.1 OBJS ca [REF_CaHosWebmailexa] > certificate=""
Move the cursor in between the two quotes. Now, from the webmail.example.com-prepared.crt
file we created earlier, copy the first line without the newline character at the end (i.e. everything from the beginning until, and including, the last dash of END CERTIFICATE-----
). Paste it into the terminal. The input line should look like this now (dont press [Enter] yet):
<.........\n-----END CERTIFICATE-----"
Add a \n
to the end:
<.........\n-----END CERTIFICATE-----\n"
Now press [Enter]. Check the certificate
property of the object again: It should look exactly like the original webmail.example.com.crt
certificate file opened in a text editor (except for the very first line). If it looks good, commit the change by entering w
: (or abort with Ctrl+C if not)
127.0.0.1 OBJS ca [REF_CaHosWebmailexa] > w
The certificate should immediately be applied and loaded into the web server. Check https://whatsmychaincert.com again: the certificate chain should now be correct and it will survive reboots as well \o/
Of course, if you ever change the certificate in the WebAdmin UI, you will have to do this again.
The UTM software really should save the certificates in the configuration data this way by default, with all the intermediate certs attached, but for some reason it doesn't ...
Am I right if I say that this issue still isn' t fixed?
It is great that there are workarounds like for example provided by PatMaN93, but I prefer to not login into the terminal (I don't want to mess with Sophos or do things that you shoudn't be doing).
For that reason, I'm asking, after seeying so many topics on the Sophos comunnity, is it still not fixed?
Because I'm sorry but I'm not going to mess in the terminal, although I really do want my certificate to work.
And this is a real old problem, witch, in my honest opinion, should be fixed by now - right??
It is not fixed. Below is the response I received from support on the case that I opened.
From: Sophos Support
Sent: 2017-Jan-17 01:41 PM
Based on what you are saying in your last message it sound like you are hitting a known issue where the UTM does not provide the full certificate chain for requests made to WebAdmin or User Portal in the event intermediate certificates are used. There is a workaround for this issue, which is what was mentioned in the community thread you linked. From the backend of the UTM we can append the WebAdmin CA and intermediate CA(s) in one pem file and copy it to /var/sec/chroot-httpd/etc/httpd/WebAdminCertCA.pem. The downside to this workaround is that it would need to be re-applied after each firmware upgrade.
In the long run the general solution would be to implement a mechanism to handle intermediate certificates through the standard workflow although unfortunately I do not have any ETA on a formal solution. In the meantime though this workaround should get you up and running and is relatively easily applied after any upgrade of the UTM firmware.
Okay then, that is unfortunate.
Well, I hope they fix it soon!!
Thank you
This thread goes back 3 years and there are other posts about this same issue from 5 years ago. Looks to me like they have no intention of ever fixing it.
Too bad...
Aren't there many other users having this problem? - I gues not
How do other people use they own certificates then?? - I gues they don't...
I think the point is, while it is a shortcoming of the product, it is just not that hard (in many cases) to concatenate the certs together to create a cert with the full chain and import that into Sophos. I have seen some have a lot of issues with it, and I have no idea what causes it. However, using a free certificate (startcom IIRC) I had to do this and it was pretty straightforward at the time. I've since switched (6 months or so) to Let's Encrypt certs and it is also working fine, no concatenation needed. So, YMMV.
darrellr said:... it is just not that hard (in many cases) to concatenate the certs together to create a cert with the full chain and import that into Sophos. ...
Yeah, so I did this, but it did't work. Although Sonos did import all of the certificates.
I also had Let's Encrypt, but same there. YMMV indeed.
Too bad you can only fix this by loggin into the terminal as root and edit some files.
Just for now I use a PC, so the certificate is working. Only on Android (and other mobiles) I have the problem.
Luckely I also have a free Cloudflare account, so Cloudflares provides a certificate that is working ;-)
(and since Cloudflare dous recognise the certificate, it is truely safe)
darrellr said:... it is just not that hard (in many cases) to concatenate the certs together to create a cert with the full chain and import that into Sophos. ...
Yeah, so I did this, but it did't work. Although Sonos did import all of the certificates.
I also had Let's Encrypt, but same there. YMMV indeed.
Too bad you can only fix this by loggin into the terminal as root and edit some files.
Just for now I use a PC, so the certificate is working. Only on Android (and other mobiles) I have the problem.
Luckely I also have a free Cloudflare account, so Cloudflares provides a certificate that is working ;-)
(and since Cloudflare dous recognise the certificate, it is truely safe)
I did not have to do anything special to get LetsEncrypt work. With the startcom cert, firefox complained about the missing cert, but IE and Chrome filled in the gap in the background just fine. You do have to be careful with concatenating and I had to use a linux console to get it done properly. I could not make Windows work, nor could I copy/paste. But it really wasn't difficult. Maybe I just got lucky.