Browse Source

Add manual entry for refreshing certs

Joachim M. Giæver 4 years ago
parent
commit
12d2ed9f4f
2 changed files with 15 additions and 1 deletions
  1. 8 1
      scripts/bin/certs-daemon
  2. 7 0
      snap/snapcraft.yaml

+ 8 - 1
scripts/bin/certs-daemon

@@ -3,11 +3,18 @@ source "${SNAP}/init"
 
 DOMAIN=`snapctl get domain`
 
+if [ "${USER}" != "root" ]; then
+    echo "Run as root!"
+    exit 1
+fi
+
+echo "See log (journal -exf --grep=${SNAP_NAME}) for result"
 if [ "${DOMAIN}" != "--not-set" ]; then
     snapctl is-connected certs
     if [ $? -ne 0 ]; then
         logger "${SNAP_NAME} is disconnected (uuid: ${UUID})"
-        logger "${SNAP_NAME} domain is set to '--not-set'"
+        logger "${SNAP_NAME} domain set to '--not-set'"
+        logger "See snap 'acme-sh' and connect acme-sh:certs"
         snapctl set domain="--not-set"
         exit 0
     fi

+ 7 - 0
snap/snapcraft.yaml

@@ -61,6 +61,13 @@ apps:
     plugs:
       - network
       - network-bind
+  refresh-certs:
+    command: bin/certs-daemon
+    slots:
+      - certs
+    plugs:
+      - network
+      - network-bind
 
 hooks:
   prepare-slot-certs: