A protocol = all line does not work in my case.
It depends from the banning action you use.
What do you mean as "does not work"?
For actions (like iptables-allports accepting all) it may be enough to set that this way, for other action (which accepts multiple protocols, like nftables), it can be set with protocol = tcp,udp (or whatever separator they'd need instead of comma).
For the actions which doesn't accept multiple protocols (like iptables-multiport) one need to specify 2 actions, here is an example working for newest fail2ban versions - https://github.com/fail2ban/fail2ban/blob/10cd81552538fa950cefc32787b9f82b5ee1b998/config/jail.conf#L748-L749
For older fail2ban versions which does not accept interpolation of %(default/action_)s or multiple parameters [...][...] you need to set something like this:
action = %(action_)s[name=%(__name__)s-tcp, protocol="tcp"]
%(action_)s[name=%(__name__)s-udp, protocol="udp"]
(or by fail2ban 0.9.x even replace %(action_)s with its whole definition from default section):
action = %(banaction)s[name=%(__name__)s-tcp, actionname=%(__name__)s-tcp, protocol="tcp", port="%(port)s", chain="%(chain)s"]
%(banaction)s[name=%(__name__)s-udp, actionname=%(__name__)s-udp, protocol="udp", port="%(port)s", chain="%(chain)s"]