Skip to content

fix: Raise specific exception for host-blocked ACL messages (Fixes #3779) - #3879

Open
JoeTannous wants to merge 1 commit into
ktbyers:developfrom
JoeTannous:fix-host-blocked-exception
Open

fix: Raise specific exception for host-blocked ACL messages (Fixes #3779)#3879
JoeTannous wants to merge 1 commit into
ktbyers:developfrom
JoeTannous:fix-host-blocked-exception

Conversation

@JoeTannous

Copy link
Copy Markdown

This fixes issue #3779.

The problem:
When a router blocks your IP with an rACL, it sends a message like "You are not permitted to connect from this host" before you even see a login prompt. Netmiko doesn't recognize this, times out, and just says "Authentication failed".

The real issue is the host got rejected before auth even happened - not that the credentials were wrong.

What I changed:

  • Added NetmikoHostBlockedException to exceptions.py so users can catch this specifically
  • Modified telnet_login() in base_connection.py to look for common "you're blocked" messages
  • Now it throws a clear error saying the host was rejected

Testing:
Ran the unit tests - 133 passed. The 5 failures are unrelated to this change (missing TTP/Genie deps + a Windows path issue that was already there).

Let me know if you need any changes!

- Added NetmikoHostBlockedException class
- Modified telnet_login() to detect host blocked messages
- Fixes issue ktbyers#3779
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant