GNU/Linux Fail2ban BanIP
Quickly ban or unban an ip using fail2ban recidive policy.
sudo fail2ban-client set recidive [banip|unbanip] 192.168.1.1
Quickly ban or unban an ip using fail2ban recidive policy.
sudo fail2ban-client set recidive [banip|unbanip] 192.168.1.1
The example function below retrieves the FQDN of the machine on which the script is running. The switch option swIsEmail can be activated to construct a noreply email address.
function fnGetFQDN() {
param (
[switch]$swIsEmail = $false
)
$oNETIP = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties()
if ($swIsEmail -eq $true) {
[string]$Return1 = "noreply@" + $oNETIP.HostName + "." + $oNETIP.DomainName
} else {
[string]$Return1 = $oNETIP.HostName + "." + $oNETIP.DomainName
}
return $Return1
}