ssl-checker/.circleci/config.yml

64 lines
2.1 KiB
YAML
Raw Normal View History

version: 2
jobs:
2020-11-26 17:29:23 +11:00
sslcheck:
2021-01-13 14:53:56 +11:00
machine:
image: circleci/classic:latest
working_directory: ~/repo
steps:
- checkout
2021-01-13 14:53:56 +11:00
- run:
name: Connect To Apthletic VPN
command: |
echo "Installing OpenVPN 2.4"
echo "deb http://build.openvpn.net/debian/openvpn/release/2.4 trusty main" > /tmp/openvpn-aptrepo.list
sudo mv /tmp/openvpn-aptrepo.list /etc/apt/sources.list.d/openvpn-aptrepo.list
sudo apt-get update
2021-01-13 14:56:00 +11:00
sudo apt-get install openvpn python3
2021-01-13 14:53:56 +11:00
echo "${VPN_CONF_BASE64}" | base64 -d > /tmp/openvpn.conf
sudo mv /tmp/openvpn.conf /etc/openvpn/vpn.conf
sudo openvpn --daemon --config /etc/openvpn/vpn.conf
echo "OpenVPN Daemon starting"
- run:
name: Check SSL Certificates
command: |
2020-11-26 18:01:49 +11:00
.circleci/slack-message.sh "*Checking SSL Certificates*" "#FFF000"
2021-01-13 15:43:07 +11:00
pip install -r requirements.txt
2020-11-26 18:26:45 +11:00
OUTPUT=$(./ssl_checker.py -f ./hosts_to_check)
2020-11-26 17:40:51 +11:00
echo "$OUTPUT"
2020-11-26 18:07:36 +11:00
if ! echo "$OUTPUT" | grep "Expired: 0" ; then
2020-11-26 17:56:09 +11:00
.circleci/slack-message.sh "*Checked SSL Certificates*: Expired :x:" "#FF0000"
2020-11-26 17:59:56 +11:00
fi
2021-01-12 18:26:02 +11:00
if ! echo "$OUTPUT" | grep "Failed: 0" ; then
.circleci/slack-message.sh "*Checked SSL Certificates*: Failed :x:" "#FF0000"
fi
2020-11-26 18:07:36 +11:00
if ! echo "$OUTPUT" | grep "Warning: 0" ; then
2020-11-26 17:56:09 +11:00
.circleci/slack-message.sh "*Checked SSL Certificates*: Warnings :warning:" "#FF0000"
2020-11-26 17:47:13 +11:00
fi
2021-01-13 14:53:56 +11:00
- run:
name: Stop VPN
command: sudo killall openvpn
workflows:
version: 2
2020-11-26 17:29:23 +11:00
sslcheck-on-push:
jobs:
2020-11-26 17:29:23 +11:00
- sslcheck:
context: github-backup
filters:
branches:
2021-01-13 16:05:08 +11:00
only: master
2020-11-26 17:29:23 +11:00
sslcheck-on-schedule:
triggers:
- schedule:
2020-11-26 17:31:41 +11:00
cron: "0 22 * * *"
2020-11-26 17:29:23 +11:00
filters:
branches:
only:
- master
jobs:
- sslcheck:
context: github-backup
filters:
branches:
only: master