diff --git a/zen/ipfs_SWARM_refresh.sh b/zen/ipfs_SWARM_refresh.sh index a88f37d..128c61e 100755 --- a/zen/ipfs_SWARM_refresh.sh +++ b/zen/ipfs_SWARM_refresh.sh @@ -53,13 +53,16 @@ do ### Is "ipfs_swarm/.$id/G1SSB/_ssb.whoami" my SSB friend?? ssbID=$(cat /home/$YOU/.zen/ipfs_swarm/.$id/G1SSB/_ssb.whoami) isMyFriend=$(grep -Rwl "$ssbID" /tmp/ssb-friends.txt) - if [[ ! $isMyFriend ]]; then + if [[ -f /tmp/ssb-friends.txt && ! $isMyFriend ]]; then echo "WARNING! $count IS NOT my SSB Friend !!! Check $ssbID" rm -Rf /home/$YOU/.zen/ipfs_swarm/.$id ipfs swarm disconnect $peer ipfs bootstrap rm $peer ## TODO: Send sbotc message - sbotc private.publish '{"type":"post","text":"ALERT '"$ssbID"' is trying to connect to IPFS swarm as '"$peer"'"}' + if [[ -f /tmp/ssb-friends_ALERT.txt && ! $(grep -Rwl "$ssbID" /tmp/ssb-friends_ALERT.txt) ]]; then + sbotc publish '{"type":"post","text":"ALERT '"$ssbID"' is trying to connect to IPFS swarm (http://127.0.0.1/ipfs/'"$id"')"}' + echo "$ssbID" >> /tmp/ssb-friends_ALERT.txt + fi ## TODO: Use fail2ban if same node continue entering our swarm... continue fi