Monday, December 19, 2022

Auto-renew Let’s Encrypt SSL certificates using crontab

Usually we renew certificates with certbot --apache in CentOS, and the problem is if you have ton of domains, then how to fix it. 

We can use an automatic code with cron job.

to try it, you can use these codes first:

(base) [root@diomain ~]# certbot renew --apache

Saving debug log to /var/log/letsencrypt/letsencrypt.log


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Processing /etc/letsencrypt/renewal/diomain.fr.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Certificate not yet due for renewal


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

The following certificates are not due for renewal yet:

  /etc/letsencrypt/live/diomain.fr/fullchain.pem expires on 2023-03-20 (skipped)

No renewals were attempted.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(base) [root@diomain ~]# certbot certificates

Saving debug log to /var/log/letsencrypt/letsencrypt.log


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Found the following certs:

  Certificate Name: diomain.com

    Serial Number: 331cb1d6f8f48cf90e65992cd1c0fdc57b2

    Key Type: RSA

    Domains: diomain.fr

    Expiry Date: 2023-03-20 01:39:17+00:00 (VALID: 89 days)

    Certificate Path: /etc/letsencrypt/live/diomain.fr/fullchain.pem

    Private Key Path: /etc/letsencrypt/live/diomain.fr/privkey.pem

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


If you haven't problem, now you can create it with webmin or use this manual command

crontab -e

0 0 20 2,4,6,8,10,12 * certbot renew --apache

we can assume that validation of certificate is 90 days so we must renew it in two months.
The command description is Cron will work at time: 0 minutes: 0 date: 20 month: 2/4/6/8/10/12 weekdays: */all



Thursday, December 15, 2022

Solve error shaka player or DRM or Widevine at Chromium in Raspberry pi

 If you have ever tried to load streaming live tv (indihome tv) or Netflix, Amazon Prime, HBO, Spotify, or the many other streaming services on your Raspberry Pi, you will find that they fail to function. Such as shaka player not support .....

This is because the Raspberry Pi does not come with the Widevine DRM software installed by default.

So you must update first Raspi, and install libwidevinecdm0

pi@pi:~ $ sudo apt update

............

pi@pi:~ $ sudo apt full-upgrade

............

pi@pi:~ $ sudo apt install libwidevinecdm0

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following packages were automatically installed and are no longer required:

  lxplug-volume python-colorzero

Use 'sudo apt autoremove' to remove them.

The following NEW packages will be installed:

  libwidevinecdm0

0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

Need to get 5,990 kB of archives.

After this operation, 8,901 kB of additional disk space will be used.

Get:1 http://archive.raspberrypi.org/debian buster/main armhf libwidevinecdm0 armhf 4.10.2252.0-1 [5,990 kB]

Fetched 5,990 kB in 37s (162 kB/s)                                             

Selecting previously unselected package libwidevinecdm0.

(Reading database ... 104862 files and directories currently installed.)

Preparing to unpack .../libwidevinecdm0_4.10.2252.0-1_armhf.deb ...

Unpacking libwidevinecdm0 (4.10.2252.0-1) ...

Setting up libwidevinecdm0 (4.10.2252.0-1) ...

pi@pi:~ $ 



How to check the free space of SD card in Raspberry Pi

 pi@pi:~ $ df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/root       7.0G  5.9G  773M  89% /

devtmpfs        406M     0  406M   0% /dev

tmpfs           438M     0  438M   0% /dev/shm

tmpfs           438M   45M  394M  11% /run

tmpfs           5.0M  4.0K  5.0M   1% /run/lock

tmpfs           438M     0  438M   0% /sys/fs/cgroup

/dev/mmcblk0p1  253M   28M  226M  11% /boot

tmpfs            88M     0   88M   0% /run/user/1000

/dev/sda1        15G   15G  373M  98% /media/pi/3633-6436