Po zainstalowaniu rozszerzenia Brute-Force Protection nie ma jak zdjąć banów, ponieważ rozszerzenie nie posiada takiej funkcjonalności. Poniżej skrypt Basha, który usuwa bany zapytaniami do bazy. Należy w nim poprawić:
Żeby skrypt mógł działać na bazie danych, uruchamiający go użytkownik (na przykład root) powinien mieć plik .my.cnf pozwalający na logowanie się bez podawania hasła.
#!/usr/bin/bash # unban IP addresses from Owncloud application firewall if [ "$1" = "--ip" ] ; then # unban single IP address if [ -z $2 ] ; then echo "Add ip address, or use --help" else mysql -e "delete from owncloud.oc_bfp_failed_logins where ip = '${2}';" fi elif [ "$1" = "--vpn" ] ; then # unban all VPN users mysql -e "delete from owncloud.oc_bfp_failed_logins where ip like '172.30.50.%';" mysql -e "delete from owncloud.oc_bfp_failed_logins where ip like '172.30.51.%';" mysql -e "delete from owncloud.oc_bfp_failed_logins where ip = '192.168.60.254';" elif [ "$1" = "--all" ] ; then # unban all IP addresses mysql -e "delete from owncloud.oc_bfp_failed_logins;" elif [ "$1" = "--user" ] ; then # unban single user if [ -z $2 ] ; then echo "Add username, or use --help" else mysql -e "delete from owncloud.oc_bfp_failed_logins where uid = '${2}';" fi elif [ "$1" = "--list" ] ; then # list users and IP addresses mysql -e "select uid as user, \ ip as ip_address, \ FROM_UNIXTIME(attempted_at) as login_attempt \ from owncloud.oc_bfp_failed_logins \ order by 3;" # help elif [ "$1" = "--help" ] || [ -z $1 ] ; then # echo some instructions echo -e "Unban users from Owncloud login page.\r Please specify:\r owncloud_unban --list to view all banned IP's,\r owncloud_unban --all to unban all IP's,\r owncloud_unban --ip [ip.ip.ip.ip] to unban single IP address,\r owncloud_unban --vpn to unban all IP's from VPN and internal networks,\r owncloud_unban --user [username] to unban user." else echo "That did nothing. Try owncloud_unban --help" fi