fail2ban/fail2ban — Issue #37: Impossible to specify multiple same actions within a jail with different names
Author: yarikoptic
Created: 2012-02-28 17:00:39+00:00
State: open

e.g.

```

[asterisk]

enabled = true
filter = asterisk
action = iptables-multiport[name=asterisk-udp, port="5060,5061", protocol=udp]
iptables-multiport[name=asterisk-tcp, port="5060,5061", protocol=tcp]
sendmail-whois[name=Asterisk, dest=you@example.com, sender=fail2ban@example.com]
logpath = /var/log/asterisk/messages
maxretry = 10
```
would result only in asterisk-tcp chain setup -- it is due to actions taking the 'name' of the jail. Simple patch

```

diff --git a/client/jailreader.py b/client/jailreader.py
index f66dc01..247216f 100644
--- a/client/jailreader.py
+++ b/client/jailreader.py
@@ -87,7 +87,9 @@ class JailReader(ConfigReader):
for act in self.__opts["action"].split('\n'):
try:
splitAct = JailReader.splitAction(act)
- action = ActionReader(splitAct, self.__name)
+ # YOH: action takes name specified in options if available
+ action = ActionReader(splitAct,
+ splitAct[1].get('name', self.__name))
ret = action.read()
if ret:
action.getOptions(self.__opts)
```

is insufficient since it brakes logic somewhere in jails.py (I believe) which relies on action name to correspond to jail name. So more TODO (may be action name could be jail_name:action_name_option)?