Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BR]: fail2ban-client help: Invalid command #3241

Open
antonv6 opened this issue Mar 18, 2022 · 4 comments
Open

[BR]: fail2ban-client help: Invalid command #3241

antonv6 opened this issue Mar 18, 2022 · 4 comments
Labels

Comments

@antonv6
Copy link
Contributor

antonv6 commented Mar 18, 2022

# fail2ban-client | grep help
    -h, --help              display this help message
    help                                     return this output
# fail2ban-client -h | grep help
    -h, --help              display this help message
    help                                     return this output
# fail2ban-client help
2022-03-18 09:10:10,452 fail2ban                [14909]: ERROR   NOK: ('Invalid command',)
Invalid command
# grep help /var/log/fail2ban.log
2022-03-18 09:10:10,449 fail2ban.transmitter    [11880]: WARNING Command ['help'] has failed. Received Exception('Invalid command')
# fail2ban-client version
0.11.2

Looks like https://github.com/fail2ban/fail2ban/blob/master/fail2ban/server/transmitter.py is missing a case for help command, even though it's suggested in the output of fail2ban-client if you don't provide any command (or use -h).

@antonv6 antonv6 added the bug label Mar 18, 2022
@sebres
Copy link
Contributor

sebres commented Mar 18, 2022

Thx!

No, transmitter is only for commands supplied to the server, which help should not be (at least at the moment fail2ban server does not provide special command for help).

Maybe it was planned at some time point...
Just in newer versions (at least starting from some v.0.10.x), the protocol streams and help of fail2ban-client and fail2ban-server are the same, so I don't see why we'd need such command at server side.

@djdomi
Copy link

djdomi commented May 27, 2022

thats not a bug, the display is uggly formatted. it clearly satys, that -h or --help is required.

@antonv6
Copy link
Contributor Author

antonv6 commented May 27, 2022

@djdomi read the issue again. The bug is that fail2ban-client lists help command, but actually trying it leads to an error. It should either support the command properly or not list it.

it clearly satys, that -h or --help is required

Required for what? For help command? Sure, there you go:

$ fail2ban-client help -h
2022-05-27 10:08:19,868 fail2ban                [12195]: ERROR   NOK: ('Invalid command',)
Invalid command

@djdomi
Copy link

djdomi commented May 27, 2022

@djdomi read the issue again. The bug is that fail2ban-client lists help command, but actually trying it leads to an error. It should either support the command properly or not list it.

it clearly satys, that -h or --help is required

Required for what? For help command? Sure, there you go:

$ fail2ban-client help -h
2022-05-27 10:08:19,868 fail2ban                [12195]: ERROR   NOK: ('Invalid command',)
Invalid command

i basically meaned

 -h, --help              display this help message

which leads to

fail2ban-client -h
fail2ban-client --help

which is (IMHO&AFAIK) the correct handling for basic Linux commands.

i basically, researched what you meaned, and i agree at one point to you:

help is shown as command, but not as action.

i am unfamilar with python, but it looks like a similar possibility like

 elif o in ("-h", "--help"): 

to be changed to

elif o in ("-h", "--help", "help"):

on bash it would work similar like this :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants