changeset 2101:ad0a9ef64827 ssltesting tip

Https.renew_ssl
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 15 Dec 2025 23:05:49 -0700
parents 665d227f06f3
children
files host/test/test_renew_ssl.luan src/luan/host/Https.luan
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/test/test_renew_ssl.luan	Mon Dec 15 23:05:49 2025 -0700
@@ -0,0 +1,19 @@
+local Luan = require "luan:Luan.luan"
+local error = Luan.error
+local do_file = Luan.do_file or error()
+local Io = require "luan:Io.luan"
+local uri = Io.uri or error()
+local Logging = require "luan:logging/Logging.luan"
+local logger = Logging.logger "test_https"
+
+
+local Https = require "classpath:luan/host/Https.luan"
+
+local domain = "https.me.luan.software"
+local site_dir = uri("file:local")
+local luanhost_dir = uri("file:..")
+local dry_run = true
+
+site_dir.exists() or error()
+
+Https.renew_ssl(0,domain,site_dir,luanhost_dir,dry_run)
--- a/src/luan/host/Https.luan	Mon Dec 15 22:45:11 2025 -0700
+++ b/src/luan/host/Https.luan	Mon Dec 15 23:05:49 2025 -0700
@@ -10,6 +10,8 @@
 local starts_with = String.starts_with or error()
 local Thread = require "luan:Thread.luan"
 local try_synchronized = Thread.try_synchronized or error()
+local Time = require "luan:Time.luan"
+local time_now = Time.now or error()
 local Http = require "luan:http/Http.luan"
 local Logging = require "luan:logging/Logging.luan"
 local logger = Logging.logger "Https"
@@ -186,4 +188,14 @@
 	end
 end
 
+function Https.renew_ssl(renewal_period,domain,site_dir,luanhost_dir,dry_run)
+	local files = get_files(domain,site_dir)
+	files.csr_file.exists() or error "no CSR file"
+	if time_now() - files.csr_file.last_modified() < renewal_period then
+		sys_logger.info "not yet"
+		return
+	end
+	sys_logger.info "not implemented"
+end
+
 return Https