Skip to content

Commit

Permalink
cert logging
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Jan 8, 2025
1 parent c41805a commit 8f74d17
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ creds-localhost.edn
\#*\#
.\#*
.~*
.letsencrypt
.letsencrypt
.https/certificates
5 changes: 3 additions & 2 deletions src/modular/webserver/https/letsencrypt.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns modular.webserver.https.letsencrypt
(:require
[taoensso.timbre :as timbre :refer [info error]]
[babashka.fs :as fs]
[babashka.process :refer [shell]]))

Expand Down Expand Up @@ -34,8 +35,7 @@
[{:keys [path domain _email ]
:or {path ".letsencrypt"}
:as letsencrypt_opts}
{:keys [certificate
password]
{:keys [certificate password]
:or {certificate ".https-certificates/keystore.p12"
password "123456789"}
:as https_opts}]
Expand All @@ -58,6 +58,7 @@
(str "letsencrypt file does not exist: " letsencrypt-fullchain-pem))
(assert (fs/exists? letsencrypt-privkey-pem)
(str "letsencrypt file does not exist: " letsencrypt-privkey-pem))
(info "creating certificate path: " certificate-path)
(fs/create-dirs certificate-path)
(shell {:dir dir}
"openssl" "pkcs12"
Expand Down
12 changes: 6 additions & 6 deletions src/modular/webserver/https/proxy.clj
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
(defn certificate-get-handler [{:keys [letsencrypt https] :as config}]
(fn [_req]
(info "certificate-get started..")
(let [r (renew-cert letsencrypt)]
(info "result: " r)
(response/response "certificate-get started!"))))
(renew-cert letsencrypt)
(info "certificate-get finished..")
(response/response "certificate-get started!")))

(defn certificate-import-handler [{:keys [letsencrypt https] :as config}]
(fn [_req]
(info "certificate-convert started..")
(let [r (convert-cert letsencrypt https)]
(info "result: " r)
(response/response "certificate-import started!"))))
(convert-cert letsencrypt https)
(info "certificate-convert finished.")
(response/response "certificate-import started!")))

(defn start-proxy
"http server on port 80 that redirects all traffic to 443, except
Expand Down

0 comments on commit 8f74d17

Please sign in to comment.