Skip to content

Commit

Permalink
update revoke.sh
Browse files Browse the repository at this point in the history
add network check
  • Loading branch information
acavella committed Dec 28, 2023
1 parent da42420 commit c8a0c9a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 40 deletions.
37 changes: 0 additions & 37 deletions CHANGELOG.md

This file was deleted.

1 change: 0 additions & 1 deletion conf/revoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
default:
gateway: google.com
www: /var/www/revoke/
tmpDir: /tmp/

ca:
- id: x11
Expand Down
13 changes: 11 additions & 2 deletions revoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}


Expand Down Expand Up @@ -98,6 +106,7 @@ download_crl() {
main() {
show_version
check_config
check_network
download_crl
fix_permissions
}
Expand Down

0 comments on commit c8a0c9a

Please sign in to comment.