question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fortinet Accept Disclaimer After Login still not working in Netmiko 3.4.0

See original GitHub issue

Hello everyone,

I have a Fortigate running with banner and “post-login-banner” enabled. I’m facing the same Socket Error. It seems that this session_preparation function which was tweaked in 2019 doesn’t work for my case. Last issue I found about that:

`aws_us_dev1 = { “device_type”: ‘fortinet’, “host”: “x.x.x.x”, “username”: username, “password”: password, “fast_cli”: True }

aws_us_dev2 = { “device_type”: ‘fortinet’, “host”: “x.x.x.x”, “username”: username, “password”: password, “fast_cli”: True }

elif site == ‘aws-us’ and env == ‘qa’: for device in (aws_us_dev1, aws_us_dev2): net_connect = Netmiko(**device) print(net_connect.find_prompt()) output = net_connect.send_command(command) url_references = url_pattern.finditer(output) for url_reference in url_references: print(url_reference.group(1)) match = True if not match: print(“URL não encontrada”) `

– Error:

Traceback (most recent call last): File "/home/cce_jmello/fortigatePython/find_proxy.py", line 141, in <module> net_connect = Netmiko(**device) File "/home/cce_jmello/.local/lib/python3.6/site-packages/netmiko/ssh_dispatcher.py", line 326, in ConnectHandler return ConnectionClass(*args, **kwargs) File "/home/cce_jmello/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 350, in __init__ self._open() File "/home/cce_jmello/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 356, in _open self._try_session_preparation() File "/home/cce_jmello/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 792, in _try_session_preparation self.session_preparation() File "/home/cce_jmello/.local/lib/python3.6/site-packages/netmiko/fortinet/fortinet_ssh.py", line 35, in session_preparation self.set_base_prompt(alt_prompt_terminator="$") File "/home/cce_jmello/.local/lib/python3.6/site-packages/tenacity/__init__.py", line 324, in wrapped_f return self(f, *args, **kw) File "/home/cce_jmello/.local/lib/python3.6/site-packages/tenacity/__init__.py", line 404, in __call__ do = self.iter(retry_state=retry_state) File "/home/cce_jmello/.local/lib/python3.6/site-packages/tenacity/__init__.py", line 360, in iter raise retry_exc.reraise() File "/home/cce_jmello/.local/lib/python3.6/site-packages/tenacity/__init__.py", line 193, in reraise raise self.last_attempt.result() File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 425, in result return self.__get_result() File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 384, in __get_result raise self._exception File "/home/cce_jmello/.local/lib/python3.6/site-packages/tenacity/__init__.py", line 407, in __call__ result = fn(*args, **kwargs) File "/home/cce_jmello/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 1164, in set_base_prompt prompt = self.find_prompt(delay_factor=delay_factor) File "/home/cce_jmello/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 1179, in find_prompt self.write_channel(self.RETURN) File "/home/cce_jmello/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 459, in write_channel self._write_channel(out_data) File "/home/cce_jmello/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 417, in _write_channel self.remote_conn.sendall(write_bytes(out_data, encoding=self.encoding)) File "/home/cce_jmello/.local/lib/python3.6/site-packages/paramiko/channel.py", line 846, in sendall sent = self.send(s) File "/home/cce_jmello/.local/lib/python3.6/site-packages/paramiko/channel.py", line 801, in send return self._send(s, m) File "/home/cce_jmello/.local/lib/python3.6/site-packages/paramiko/channel.py", line 1198, in _send raise socket.error("Socket is closed") OSError: Socket is closed When I login with a manual SSH session I get the following: | xxx S/A | | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

| ATENCÃO: Aviso Importante | | E proibido o acesso não autorizado. | Esse e um recurso de acesso restrito devidamente controlado e monitorado e de

responsabilidade do xxx. | | Se você não possui autorização para acessar este recurso, desconecte imediata mente ou poderá sofrer sanções legais e/ou ação disciplinar. | Em caso de problemas envie e-mail para xxx@xxx.com | | ----------------------------------------------------------------------------------------------------- | ATTENTION: IMPORTANT ADVICE | | It totally forbidden any not allowed access. | This resource element is under monitoring and strong restrictions, according to xxx responsibility. | Current no allowed access is demanding for disconnection, rather for sufferin g prosecution from either Administrative Policies or Law Suite. | Any problems send mail to xxx@xxx.com |

(Press ‘a’ to accept):

Can you help me?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jmello-pagsegurocommented, May 11, 2022

Correct.

Netmiko 4.1.0 and PY3.7.2

1reaction
jmello-pagsegurocommented, May 11, 2022

Hi Kirk,

It worked after upgrade to Python3.7 via pyenv.

Thanks a lot!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disclaimer - Fortinet Community
Hello,. I have 3200D running 5.4.1. I would like to know if it's possible to choose the time or frequency the disclaimer is...
Read more >
The Art of Network Engineering
Cloud Academy Welcome Screen After Login ... I'm not currently active but have been in the past yet continue to have a smile...
Read more >
netmiko - bytemeta
Fortinet Accept Disclaimer After Login still not working in Netmiko 3.4.0. nlspears. nlspears OPEN · Updated 5 months ago ...
Read more >
Fix collections link icon on mobile - 30-Seconds/30-Seconds-Web
Fortinet Accept Disclaimer After Login still not working in Netmiko 3.4.0, 6, 2022-05-10, 2022-10-29. Plow should not be rotated on headland turns ...
Read more >
Multi-vendor library to simplify CLI connections to network ...
Network automation to screen-scraping devices is primarily ... If you find an issue with Netmiko, then you can open an issue on this ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found