Ver Fonte

Add manual entry for refreshing certs

Joachim M. Giæver há 4 anos atrás
pai
commit
12d2ed9f4f
2 ficheiros alterados com 15 adições e 1 exclusões
  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: