add fail2ban scripts
This commit is contained in:
@ -1,3 +1,3 @@
|
||||
[Definition]
|
||||
actionban = /data/action.d/entryPoint.py <ip> add
|
||||
actionunban = /data/action.d/entryPoint.py <ip>clea del
|
||||
actionunban = /data/action.d/entryPoint.py <ip> del
|
7
docker/authelia/action.d/entryPoint.py → fail2ban/action.d/entryPoint.py
Normal file → Executable file
7
docker/authelia/action.d/entryPoint.py → fail2ban/action.d/entryPoint.py
Normal file → Executable file
@ -1,5 +1,9 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
"""
|
||||
Creates a virtual environment, installs dependencies, and then calls modifyBanList.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
@ -12,8 +16,5 @@ venv_dir = 'env'
|
||||
if not os.path.exists(venv_dir):
|
||||
os.system(f"{sys.executable} -m venv {venv_dir}")
|
||||
|
||||
activate_script = os.path.join(venv_dir, 'bin', 'activate')
|
||||
os.system(f"chmod +x {activate_script}")
|
||||
os.system(f"{os.path.join(venv_dir, 'bin', 'pip')} install --upgrade requests ipaddress")
|
||||
|
||||
os.system(f"{os.path.join(venv_dir, 'bin', 'python')} /data/action.d/modifyBanList.py {sys.argv[1]} {sys.argv[2]}")
|
@ -1,5 +1,10 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
"""
|
||||
Called by entryPoint.py, performs the addition or deletion of an item in a Cloudflare custom list.
|
||||
Support for IPV6 is limited as it blocks the entire /64 subnet.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import requests
|
||||
from requests import Response
|
||||
@ -53,6 +58,7 @@ if __name__ == "__main__":
|
||||
}
|
||||
|
||||
existingIpList = getIPList(apiEndpoint,headers)
|
||||
print(existingIpList)
|
||||
response = None
|
||||
|
||||
if action == "del":
|
Reference in New Issue
Block a user