enabling https on domoticz

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
neoathome
Posts: 3
Joined: Friday 08 January 2021 13:56
Target OS: Linux
Domoticz version:
Contact:

enabling https on domoticz

Post by neoathome »

Hi folks,

I've installed domoticz on a Ubuntu 20.04 through snap store and everything works great!! :D Now I'd like to enable ssl access to domoticz but i can't find any working guide or google entry which works.
One guide I found here: https://snapcraft.io/install/domoticz-gm/ubuntu:

There they talk about following commands:

$ sudo snap set domoticz-gm ports.https=444
$ sudo snap set domoticz-gm ports.http=8090

....

but these doesn' work.

Did anyone enable https for domoticz installed on ubuntu 20.04??

Regards,

Alex
foxmulder06
Posts: 11
Joined: Sunday 31 May 2020 18:29
Target OS: Linux
Domoticz version: 2020.2
Location: FRANCE
Contact:

Re: enabling https on domoticz

Post by foxmulder06 »

Hi,

Just search on GOOGLE "domoticz https" and you will get the official Domoticz Wiki with the responses:

https://www.domoticz.com/wiki/Native_HT ... SL_support



Domoticz now has native HTTPS / SSL support since Version 2.2563 (June 14th 2015)

The https port is defined in /etc/init.d/domoticz.sh

DAEMON_ARGS="$DAEMON_ARGS -www 8080 -loglevel=normal"
DAEMON_ARGS="$DAEMON_ARGS -sslwww 443"
DAEMON_ARGS="$DAEMON_ARGS -log /var/log/domoticz.log"

-sslwww port (for example, -sslwww 443). https runs by default. Set port to 0 to ensure https socket won't be open.

-sslcert file_path (for example, -sslcert "D:\server_cert.pem" or -sslcert /opt/domoticz/server_cert.pem)

If no –sslcert parameter is provided, Domoticz will use a default SSL certificate "server_cert.pem" from its installation folder (emitted for domoticz.com). This default certificate will generate a security warning in your browser. But don't care. Accept the certificate and this browser won't bother you anymore.

Domoticz should be now available on https://my_domain_name.com

To access the system from outside your network, don't forget in your box/router to forwarding/NAT the ssl port (ie 443) to your system.

Procedure to generate a self certificate : https://www.domoticz.com/wiki/Native_se ... ts_Encrypt
_____________________________________
Pascal
neoathome
Posts: 3
Joined: Friday 08 January 2021 13:56
Target OS: Linux
Domoticz version:
Contact:

Re: enabling https on domoticz

Post by neoathome »

Thanks foar your answer but I know this article too. Thats's why I wrote "installed via snap store...."
If you do so, you won't have this domoticz.sh :-)

Here a Output from the described directory:

$ cd /etc/init.d/
mqtt@lip-smart-01:/etc/init.d$ ls -l
total 132
-rwxr-xr-x 1 root root 3740 Apr 1 2020 apparmor
-rwxr-xr-x 1 root root 2964 Dec 6 2019 apport
-rwxr-xr-x 1 root root 1071 Jul 24 2018 atd
-rwxr-xr-x 1 root root 1232 Mar 27 2020 console-setup.sh
-rwxr-xr-x 1 root root 3059 Feb 11 2020 cron
-rwxr-xr-x 1 root root 937 Feb 4 2020 cryptdisks
-rwxr-xr-x 1 root root 896 Feb 4 2020 cryptdisks-early
-rwxr-xr-x 1 root root 3152 Sep 30 2019 dbus
-rwxr-xr-x 1 root root 985 Nov 13 00:15 grub-common
-rwxr-xr-x 1 root root 3809 Jul 28 2019 hwclock.sh
-rwxr-xr-x 1 root root 2638 Dec 13 2019 irqbalance
-rwxr-xr-x 1 root root 1503 May 11 2020 iscsid
-rwxr-xr-x 1 root root 1479 Nov 27 2019 keyboard-setup.sh
-rwxr-xr-x 1 root root 2044 Feb 19 2020 kmod
-rwxr-xr-x 1 root root 695 Jan 28 2020 lvm2
-rwxr-xr-x 1 root root 586 Jan 28 2020 lvm2-lvmpolld
-rwxr-xr-x 1 root root 3323 Mar 3 2020 mosquitto
-rwxr-xr-x 1 root root 2827 Jan 9 2020 multipath-tools
-rwxr-xr-x 1 root root 2503 May 11 2020 open-iscsi
-rwxr-xr-x 1 root root 1846 Mar 9 2020 open-vm-tools
-rwxr-xr-x 1 root root 1366 Mar 23 2020 plymouth
-rwxr-xr-x 1 root root 752 Mar 23 2020 plymouth-log
-rwxr-xr-x 1 root root 924 Feb 13 2020 procps
-rwxr-xr-x 1 root root 4417 Oct 15 2019 rsync
-rwxr-xr-x 1 root root 2864 Mar 7 2019 rsyslog
-rwxr-xr-x 1 root root 1222 Apr 3 2017 screen-cleanup
-rwxr-xr-x 1 root root 3939 May 29 2020 ssh
-rwxr-xr-x 1 root root 6872 Apr 22 2020 udev
-rwxr-xr-x 1 root root 2083 Jan 21 2020 ufw
-rwxr-xr-x 1 root root 1391 Apr 14 2020 unattended-upgrades
-rwxr-xr-x 1 root root 1306 Apr 2 2020 uuidd

root@lip-smart-01:~# find / -name domoticz.sh
root@lip-smart-01:~#

NOTHING FOUND ON MY SYSTEM
foxmulder06
Posts: 11
Joined: Sunday 31 May 2020 18:29
Target OS: Linux
Domoticz version: 2020.2
Location: FRANCE
Contact:

Re: enabling https on domoticz

Post by foxmulder06 »

Hi,

The file "domoticz.sh" is fully part of the TGZ file, example = "domoticz_linux_x86_64.tgz" for 64 bits

Extract it in your home directory and you will find the file immediately ! example: /home/domotique/domoticz

So, If you get this file to setup Domoticz, the file is there, at ROOT level...



Question: How do you setup Domoticz ? do you follow the documentation ?

Thanks

________________

This is my automatic installation Shell script, that setup my home directory path + SSL port + LOG activation "all in one" + setup INIT.D process :D

Tested for UBUNTU V18.04 LTS !
-----------------------------------------------------

# Configuration locale
echo " "
echo "- Edition automatique du fichier /home/domotique/domoticz.sh"
echo " 1) Changement de la variable USERNAME=pi par USERNAME=<$USER de la session courante> ..."
echo " "
sed -i 's/USERNAME=pi.*/USERNAME='$USER'/' ~/domoticz/domoticz.sh

echo "* Verification du changement:"
cat ~/domoticz/domoticz.sh | grep "^USERNAME="
echo " "

echo " 2) Changement du port HTTPS, de 443 vers 8081..."
echo " "
sed -i 's/DAEMON_ARGS="$DAEMON_ARGS -sslwww 443.*/DAEMON_ARGS="$DAEMON_ARGS -sslwww 8081"/' ~/domoticz/domoticz.sh

echo "* Verification du changement:"
cat ~/domoticz/domoticz.sh | grep "sslwww"
echo " "

echo " 3) Activation du fichier de LOG DOMOTICZ..."
echo " "
sed -i 's!#DAEMON_ARGS="$DAEMON_ARGS -log /tmp/domoticz.txt".*!DAEMON_ARGS="$DAEMON_ARGS -log /tmp/domoticz.log"!' ~/domoticz/domoticz.sh

echo "* Verification du changement:"
cat ~/domoticz/domoticz.sh | grep "domoticz.log"
echo " "


# Configuration du demarrage automatique du Daemon DOMOTICZ au boot.
sudo cp ~/domoticz/domoticz.sh /etc/init.d
sudo chmod +x /etc/init.d/domoticz.sh
sudo update-rc.d domoticz.sh defaults
_____________________________________
Pascal
User avatar
waltervl
Posts: 5905
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: enabling https on domoticz

Post by waltervl »

neoathome wrote: Friday 08 January 2021 18:03 Thanks foar your answer but I know this article too. Thats's why I wrote "installed via snap store...."
You better remove this domoticz installation (make a backup of the domoticz.db) and install it the right way.
The next time you do something non standard you will have the same issue. The snap store also notes that the snap install is not endorsed by the Domoticz community....
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
neoathome
Posts: 3
Joined: Friday 08 January 2021 13:56
Target OS: Linux
Domoticz version:
Contact:

Re: enabling https on domoticz

Post by neoathome »

Good morning,

thanks for your answers. I made it the the first time and becaus it was running for me it was ok and the installation was quite easy :-)

I will install it again and do it in the right way. :-)

Thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest