From c8a0c9ad5b0a122a79997749db3109aa123dcbcb Mon Sep 17 00:00:00 2001 From: Tony Cavella <9434191+acavella@users.noreply.github.com> Date: Thu, 28 Dec 2023 22:29:41 +0000 Subject: [PATCH] update revoke.sh add network check --- CHANGELOG.md | 37 ------------------------------------- conf/revoke.yml | 1 - revoke.sh | 13 +++++++++++-- 3 files changed, 11 insertions(+), 40 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 88c514b..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,37 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] -- Major redevelopment effort towards version 2.0.0. -- Code modularity, functions built into individual external modules. -- Read CRL data to database. -- OCSP responder functionality. -- Automated installation via script and package manager (RPM). -- Guided configuration script. -- Script and configuration validation. -- Built in help menu with example commands. -- Improved documentation; use cases, installation, configuration, etc... -- Updated project website. - -## [1.0.1] - 2019-04-02 -### Removed -- OpenSSL CRL validation system too complex, requires rework. - -## [1.0.0] - 2019-04-01 -### Added -- Initial public release. -- OpenSSL CRL validation. - -## [0.2.0-alpha] - 2019-03-30 -### Added -- Gateway and network validation. - -### Changed -- Logging format improved and removed from CLI - -## [0.1.0-alpha] - 2019-03-27 -### Added -- Initial rapid development version diff --git a/conf/revoke.yml b/conf/revoke.yml index 76ea6af..98eb824 100644 --- a/conf/revoke.yml +++ b/conf/revoke.yml @@ -2,7 +2,6 @@ default: gateway: google.com www: /var/www/revoke/ - tmpDir: /tmp/ ca: - id: x11 diff --git a/revoke.sh b/revoke.sh index 3070bc7..8bcc444 100755 --- a/revoke.sh +++ b/revoke.sh @@ -20,7 +20,7 @@ config="${baseDir}/conf/revoke.yml" log="${baseDir}/logs/revoke_${fileDTG}.log" wwwdir=$(./lib/yq4 -r .default.www ${config}) arraySize=$(./lib/yq4 '.ca | length' ${config}) -defGW=$(/usr/sbin/ip route show default | /usr/bin/awk '/default/ {print $3}') +defGW=$(./lib/yq4 -r .default.gateway ${config}) ## FUNCTIONS @@ -54,7 +54,15 @@ check_config() { } check_network() { - commands + ping -c 1 $defGW >/dev/null 2>&1; + pingExit=$? + if [ $pingExit -eq 0 ] + then + printf "$(date '+%Y-%m-%dT%H:%M:%S') [info] received ping response from ${defgw}\n" + else + printf "$(date '+%Y-%m-%dT%H:%M:%S') [error] ping response not received from ${defgw}\n" + exit 1 + fi } @@ -98,6 +106,7 @@ download_crl() { main() { show_version check_config + check_network download_crl fix_permissions }