Sensor to show expiry date of SSL certificate

@anon43302295 & @xstrex:disappointed: I really sorry usually I tried to check several ties before posting but probably was really late for me yesterday I don’t checked correctly.

Your were absolute right, I was missing the “-b”, thanks for the help again

Hi, I’ve just set the sensor up but I’m getting a “command failed” error in the home-assistant.log:

ERROR (Thread-9) [homeassistant.components.sensor.command_line] Command failed: ssl-cert-check -b -c /etc/letsencrypt/live/rollo-home.duckdns.org/cert.pem | awk '{ print $NF }'

When I sudo to the homeassistant user (that is used to run HA) using:

sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate

and run the command from command line:

ssl-cert-check -b -c /etc/letsencrypt/live/rollo-home.duckdns.org/cert.pem | awk '{ print $NF }'

it correctly displays the remaining days

Could the error in the log be caused by the fact that the homeassistant user has /bin/false set as shell in /etc/passwd?

Thanks
T.

Do have solve this issue? I have the same issue after upgrade to .51

thanks
JP

Seems to work if run from a shellscript.

command: “sh /home/homeassistant/.homeassistant/scripts/ssl_expiry_days.sh”

I have the same problem:

2017-09-01 18:54:09 ERROR (Thread-6) [homeassistant.components.sensor.command_line] Command failed: ssl-cert-check -b -c /etc/letsencrypt/live/MYDOMAIN.duckdns.org/cert.pem | awk { print $NF }

Someone find a solution?

Check this… approach
Let it do automatically without user intervention.

2 Likes

This solution is https protocol?
At the and in my router i need to forward the port 80 to 443 or not?

It use DNS-01 Challenge, don’t need open port 80 or 443.

This simplify the things as explained in the post.

1 Like

Ok, thank you very much leviweb, i have the last question.

Now I have configured the raspberry Pi 3 with Homeassistant, Duckdns and LetsEncrypt. In my router the port 443 in forwarded to port 8123.

For use the ACME.SH I need to delete the port forwarding in my router, install the script and change the line html in configuration.yaml file, am I right.
It’s necessary to uninstall the Lentsencript software or script? If yes haw do this?

For use the ACME.SH I need to delete the port forwarding in my router, install the script and change the line html in configuration.yaml file, am I right.
It’s necessary to uninstall the Lentsencript software or script? If yes haw do this?

You don’t need any port forwarding to setup or use ACME.SH. (Suggest you remove unused port forwarding)
You need reconfigure HA to use cert created by ACME.SH.

ACME.SH replace Certbot or any other Client that issue certs from Let’s Encrypt. So you should (not must) deinstall the others client.

Grate tool. Thank you.

Sounds cool but getting this problem when doing apt-get
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

try: sudo apt-get install ssl-cert-check

duh, of course! Oops! Thank you for that! It is now working :slight_smile:

Kind of…

I have the problem where the sensor does not say any days it just has a dash -

It might only update once every 12 hours

Unfortunately it’s been like that for a few days :frowning:

00:04:59 ERROR (Thread-4) [homeassistant.components.sensor.command_line] Command failed: ssl-cert-check -b -c /etc/letsencrypt/live/BLAHBLAH.duckdns.org/cert.pem | awk { print $NF }

Hey.

i get

Cdture

What i miss here?

run the command via SSH

ssl-cert-check -b -c /etc/letsencrypt/live/yanir.duckdns.org/cert.pem | awk ‘{ print $NF }’

show 90 fine.

now i see the log show

2018-02-17 17:43:32 ERROR (Thread-18) [homeassistant.components.sensor.command_line] Command failed: ssl-cert-check -b -c /etc/letsencrypt/live/yanir.duckdns.org/cert.pem | awk { print $NF }

When on SSH, have you tried to run the command as the same user that’s running Home Assistant? If this fails, there is probably a permissions issue.

Via SSH work fine…