-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
Update to version 98 today. After installation, the following error was logged for the cron job running "/srv/dshield/updatehoneypotip.sh"
grep: dshield.ini: No such file or directory
sed: -e expression #1, char 1: unknown command: `^'
After investigating, I found the error was related to a missing path for the grep query checking to see if "piid" had been set. The following patch prevents the sed command from being run when piid has already been defined. I don't believe it fixes the sed expression failure.
diff --git a/bin/updatehoneypotip.sh b/bin/updatehoneypotip.sh
index 1d45894..935f920 100755
--- a/bin/updatehoneypotip.sh
+++ b/bin/updatehoneypotip.sh
@@ -15,9 +15,9 @@ fi
honeypotip=$(curl -s https://www4.dshield.org/api/myip?json | jq .ip | tr -d '"')
if echo -n $honeypotip | egrep -q '^[0-9\.]+$'; then
sed -i "s/^honeypotip=.*/honeypotip=$honeypotip/" /srv/dshield/etc/dshield.ini
- if ! grep -q '^piid=' dshield.ini; then
+ if ! grep -q '^piid=' /srv/dshield/etc/dshield.ini; then
piid=$(openssl rand -hex 10)
- sed -i "^apikey/a piid=$piid" /srv/dshield/etc/dshield.ini
+ sed -i "^apikey/a piid=$piid" /srv/dshield/etc/dshield.ini
fi
else
echo "Bad IP address"
Metadata
Metadata
Assignees
Labels
No labels