Skip to content

Commit cec8e49

Browse files
committed
fixing path of ini file and adding piid in case it is missing
1 parent 391f607 commit cec8e49

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

bin/updatehoneypotip.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ if [ ! "$userid" = "0" ]; then
88
exit 9
99
fi
1010

11-
if [ ! -f /etc/dshield.ini ]; then
12-
echo "missing /etc/dshield.ini file"
11+
if [ ! -f /srv/dshield/etc/dshield.ini ]; then
12+
echo "missing /srv/dshield/etc/dshield.ini file"
1313
exit 9
1414
fi
1515
honeypotip=$(curl -s https://www4.dshield.org/api/myip?json | jq .ip | tr -d '"')
1616
if echo -n $honeypotip | egrep -q '^[0-9\.]+$'; then
17-
sed -i "s/^honeypotip=.*/honeypotip=$honeypotip/" /etc/dshield.ini
17+
sed -i "s/^honeypotip=.*/honeypotip=$honeypotip/" /srv/dshield/etc/dshield.ini
18+
if ! grep -q '^piid=' dshield.ini; then
19+
piid=$(openssl rand -hex 10)
20+
sed -i "^apikey/a piid=$piid" /srv/dshield/etc/dshield.ini
21+
fi
1822
else
1923
echo "Bad IP address"
2024
exit 9

0 commit comments

Comments
 (0)