Fortinet Accept Disclaimer After Login still not working in Netmiko 3.4.0
See original GitHub issueHello 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:
- Created a year ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Correct.
Netmiko 4.1.0 and PY3.7.2
Hi Kirk,
It worked after upgrade to Python3.7 via pyenv.
Thanks a lot!