Procházet zdrojové kódy

added cert-check and cert-renew-all

tags/v2.0.0
Robin Thoni před 8 roky
rodič
revize
0880585e07
3 změnil soubory, kde provedl 50 přidání a 1 odebrání
  1. 23
    0
      cert-check.sh
  2. 23
    0
      cert-renew-all.sh
  3. 4
    1
      install

+ 23
- 0
cert-check.sh Zobrazit soubor

@@ -0,0 +1,23 @@
1
+#! /usr/bin/env sh
2
+
3
+if [ $# -ne 2 ]
4
+then
5
+  echo "Usage: cert-check directory checkend" >&2
6
+  exit 64
7
+fi
8
+
9
+dir="$1"
10
+checkend="$2"
11
+
12
+for cert in ${dir}/*.crt
13
+do
14
+  openssl x509 -noout -in "${cert}" -checkend "${checkend}"
15
+  will_expire="$?"
16
+  date="$(openssl x509 -noout -in "${cert}" -enddate | cut -d= -f2)"
17
+  if [ "${will_expire}" -eq 1 ]
18
+  then
19
+    site=$(basename "${cert}")
20
+    site=$(echo "${site}" | sed -re 's/(.+).crt/\1/')
21
+    echo "${site}" "${date}"
22
+  fi
23
+done

+ 23
- 0
cert-renew-all.sh Zobrazit soubor

@@ -0,0 +1,23 @@
1
+#! /usr/bin/env sh
2
+
3
+if [ $# -ne 2 ]
4
+then
5
+    name=$(basename "$0")
6
+    echo "Usage: ${name} directory checkend" >&2
7
+    exit 64
8
+fi
9
+
10
+dir="$1"
11
+checkend="$2"
12
+
13
+certs=$(cert-check "${dir}" "${checkend}")
14
+
15
+echo "${certs}"
16
+
17
+sites=$(echo "${certs}" | cut -d' ' -f1)
18
+
19
+for site in ${sites}
20
+do
21
+  echo
22
+  generate-ssl-cert "${site}"
23
+done

+ 4
- 1
install Zobrazit soubor

@@ -4,5 +4,8 @@ mkdir -p /etc/sitegen
4 4
 mkdir -p ~/.sitegen/hooks.d
5 5
 cp -r sitegen /etc/
6 6
 cp sitegen.sh /usr/local/bin/sitegen
7
-cp generate-ssl-cert.sh /usr/local/bin/generate-ssl-cert
8 7
 cp sitegen.completion /etc/bash_completion.d/sitegen
8
+
9
+cp generate-ssl-cert.sh /usr/local/bin/generate-ssl-cert
10
+cp cert-check.sh /usr/local/bin/cert-check
11
+cp cert-renew-all.sh /usr/local/bin/cert-renew-all

Načítá se…
Zrušit
Uložit