Update Fail2Ban banned IPs #1348
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Fail2Ban banned IPs | |
| on: | |
| schedule: | |
| - cron: '0 */2 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-banned: | |
| runs-on: self-hosted | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.SECRET_TOKEN }} | |
| path: malicious_ips | |
| - name: Run update script | |
| run: bash ~/script.sh | |
| - name: Commit and push updated IP list | |
| working-directory: malicious_ips | |
| run: | | |
| cd ~/malicious_ips && git pull | |
| git add malicious_ips.txt | |
| if git diff --staged --quiet; then | |
| echo "Nothing to update." | |
| exit 0 | |
| fi | |
| git config user.name 'nixbear-actions' | |
| git config user.email ${{ secrets.GH_EMAIL }} | |
| git commit -m "[auto]Update banned IPs every 2 hours $(date -u +'%Y-%m-%d %H:%M:%S UTC')" | |
| git push |