diff --git a/.gitea/workflows/gitea-ci.yaml b/.gitea/workflows/gitea-ci.yaml deleted file mode 100644 index ebaab78..0000000 --- a/.gitea/workflows/gitea-ci.yaml +++ /dev/null @@ -1,12 +0,0 @@ -jobs: - Check-Cert: - runs-on: ubuntu-latest - steps: - - name: Ověření platnosti certifikátu chosesoft.eu - run: | - if echo | openssl s_client -servername chosesoft.eu -connect chosesoft.eu:443 2>/dev/null | openssl x509 -noout -checkend 0; then - echo "✅ Certifikát je stále platný" - else - echo "❌ Certifikát už není platný" - exit 1 - fi \ No newline at end of file diff --git a/.gitea/workflows/packer.yaml b/.gitea/workflows/packer.yaml new file mode 100644 index 0000000..9fffa68 --- /dev/null +++ b/.gitea/workflows/packer.yaml @@ -0,0 +1,33 @@ +name: Check Certificates Expiry + +on: + workflow_dispatch: + +jobs: + check_certs: + runs-on: ubuntu-latest + + steps: + - name: Display certificate expiry dates + run: | + for host in chosesoft.eu nas.chosesoft.eu gitea.chosesoft.eu; do + echo "🔍 Certificate for $host:" + expiry_date=$(echo | openssl s_client -servername "$host" -connect "$host:443" 2>/dev/null \ + | openssl x509 -noout -enddate | cut -d= -f2) + + if [ -z "$expiry_date" ]; then + echo "❌ Unable to fetch certificate for $host" + echo + continue + fi + + expiry_ts=$(date -d "$expiry_date" +%s) + now_ts=$(date +%s) + + if [ "$expiry_ts" -gt "$now_ts" ]; then + echo "✅ Valid until: $expiry_date" + else + echo "❌ Expired on: $expiry_date" + fi + echo + done \ No newline at end of file