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)