Install Lets Encrypt on windows

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

Moderator: leecollings

Post Reply
foscolino
Posts: 20
Joined: Monday 02 November 2020 18:38
Target OS: Windows
Domoticz version: 2.20
Location: Italy
Contact:

Install Lets Encrypt on windows

Post by foscolino »

Hi,
Is there a guide to install Lets Encrypt on windows 10?
In the wiki I have find only linux installation :(
https://www.domoticz.com/wiki/Native_se ... ts_Encrypt
zicht
Posts: 272
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: Install Lets Encrypt on windows

Post by zicht »

Hi

Haven't found a manual.
You can install certbot. (python implementation also for windows)
You can run certbot from lua .... But it has to be done with max permissions.
You can use tasksched for that :

Code: Select all

cmd=('schtasks /run /tn "Certbot"')
  os.execute(cmd)
Where Certbot is the tasksched task name

You will need to open port 80 for authentication purpose when the bot runs, thats just how it works. Makr sure during the process no other application is running on port 80. The certbot will start a small authenication server and the process will fail when the port is in use,
This can be done with windows firewall like this :

Code: Select all

 os.execute('netsh advfirewall firewall add rule name="DOMO" dir=in action=allow protocol=TCP localport=80')
and after remove it again

Code: Select all

 os.execute('netsh advfirewall firewall delete rule name="DOMO"')
if all worked as designed the certbot directory will contain a couple of new files that needs to be in the cert.
You can read that with io.open in lua.

Code: Select all

path="C:\\Certbot\\live\\site or domain name\\fullchain.pem"
   open = io.open
   file = open(path, "rb") 		-- r read mode and b binary mode
   spacer = file:read "*a" 		-- *a or *all reads the whole file
   file:close()
you may need to add some more data on the file like DH parameters ( static data) or priv key (new rolling data)
I am not an expert on that one.

Just read the right files, put the data in a string and write the cert file.

Code: Select all

path="C:\\Program Files (x86)\\Domoticz\\server_cert.pem"
   open = io.open
   file = open(path, "w+") 		
   file:write(result.."\n")		
   file:close()
i am not a coder, just a simple guy that reads and combines other peoples code. Thats how i created the above.
Hope it helps others.
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
foscolino
Posts: 20
Joined: Monday 02 November 2020 18:38
Target OS: Windows
Domoticz version: 2.20
Location: Italy
Contact:

Re: Install Lets Encrypt on windows

Post by foscolino »

Hi zicht, thank you very much!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest