corbanworks / aws-blocker

A simple bash script to block all AWS IP ranges using iptables.
The Unlicense
143 stars 34 forks source link

Iptables location important for crontab execution #2

Closed megberts closed 7 years ago

megberts commented 8 years ago

During running from crontab the location of iptables cannot be found; /usr/src/aws-blocker/aws-blocker: line 23: iptables: command not found

Adding location might be a solution

Great script though!

jacoballred commented 8 years ago

The location of iptables can vary based on the distribution. I can't recall using a distribution that doesn't have iptables in the path for cron by default. What distribution are you using?

I agree that the full path should be used for wider compatibility, but hardcoding to /usr/sbin would fix it for you and break it for others. Perhaps the script could see if iptables is in the PATH, and if not, check a few common locations?

megberts commented 8 years ago

I think that would be a more appropriate solution!

Thanks

Op 21 jun. 2016, om 14:12 heeft Jacob Allred notifications@github.com het volgende geschreven:

The location of iptables can vary based on the distribution. I can't recall using a distribution that doesn't have iptables in the path for cron by default. What distribution are you using?

I agree that the full path should be used for wider compatibility, but hardcoding to /usr/sbin would fix it for you and break it for others. Perhaps the script could see if iptables is in the PATH, and if not, check a few common locations?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/corbanworks/aws-blocker/pull/2#issuecomment-227421261, or mute the thread https://github.com/notifications/unsubscribe/AAkRWqGz_ZIfnWxsJra6n1jMyUdq8z9rks5qN9U3gaJpZM4I6bJc.