Fix check_defaultroute - We need to check if the /etc/mygate file exists before comparing it - version 6.7.3

This commit is contained in:
Jérémy Dubois 2020-07-23 10:28:34 +02:00
parent 04994ecebc
commit 3d86996f5d
2 changed files with 15 additions and 5 deletions

View File

@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [6.7.3] - 2020-07-23
### Fixed
- Fix check_defaultroute - We need to check if the /etc/mygate file exists before comparing it
## [6.7.2] - 2020-07-22
### Added

View File

@ -3,7 +3,7 @@
# EvoCheck
# Script to verify compliance of an OpenBSD server powered by Evolix
readonly VERSION="6.7.2"
readonly VERSION="6.7.3"
# Disable LANG*
@ -306,10 +306,14 @@ check_sync(){
}
check_defaultroute(){
file_route=$(cat /etc/mygate)
used_route=$(route -n show -priority 8 | grep default | awk '{print $2}')
if [ "$file_route" != "$used_route" ]; then
failed "IS_DEFAULTROUTE" "The default route in /etc/mygate is different from the one currently used"
if [ -f /etc/mygate ]; then
file_route=$(cat /etc/mygate)
used_route=$(route -n show -priority 8 | grep default | awk '{print $2}')
if [ "$file_route" != "$used_route" ]; then
failed "IS_DEFAULTROUTE" "The default route in /etc/mygate is different from the one currently used"
fi
else
failed "IS_DEFAULTROUTE" "The file /etc/mygate does not exist. Make sure you have the same default route in this file as the one currently in use."
fi
}