-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
SFTP issue with libssh #222
Comments
@ashwini-mhatre please explain what doesn't work. |
I am facing issue with iosxr_config Module. I am using iosxr_config to replace device configuration with source file. |
Hi, I'm using Ansible:
Collections
libssh:
Playbook: iosxr_ospf.yml - name: Play to set up OSPF on IOSXR routers
hosts: routersxr
gather_facts: false
tasks:
- name: Collect ios_facts
cisco.iosxr.iosxr_facts:
gather_subset:
- min
register: facts
tags: hwinfo
- name: Generate config from jinja template
ansible.builtin.template:
src: iosxr_ospf.j2
dest: ./ospfconfig/"{{ ansible_net_hostname }}".cfg
backup: true
mode: 0640
- name: Setup OSPF
cisco.iosxr.iosxr_config:
src: ./ospfconfig/"{{ ansible_net_hostname }}".cfg
replace: config Jinja2 template {% if ospf is defined %}
router ospf {{ ospf.process_id }}
router-id {{ ospf.router_id }}
auto-cost reference-bandwidth {{ ospf.auto_cost.reference_bandwidth }}
address-family ipv4 unicast
{% for item in ospf.areas %}
area {{ item.area_id }}
{% for intf in item.interfaces %}
interface {{ intf.name }}
{% if intf.network is defined %}
network {{ intf.network }}
{% endif %}{#p2p#}
{% if intf.passive is defined %}
{% if intf.passive == "true" %}
passive enable
{% endif %}{#-passivetrue-#}
{% endif %}{#passive#}
{% endfor %}{#intf#}
{% endfor %}{#areas#}
{% endif %}{#ospf#} OSPF config file router ospf 2
router-id 2.2.2.2
auto-cost reference-bandwidth 1000
address-family ipv4 unicast
area 0.0.0.0
interface GigabitEthernet0/0/0/0
network point-to-point
area 0.0.0.2
interface GigabitEthernet0/0/0/1
network point-to-point
interface Loopback1
network point-to-point
passive enable
Result TASK [Setup OSPF] **********************************************************************************************************************************************************
fatal: [R2xr]: FAILED! => {"changed": false, "msg": "Writing to remote file [b'/harddisk:/ansible_config.txt'] failed with error [Generic failure: Invalid SSH_FXP_STATUS message]"} |
Just an addition, when using the iosxr_user module with the public_key_contents argument (which uploads an ssh key to the device) i debugged the scp server on the iosxr side, results: paramiko:
pylibssh:
to me it looks like pylibssh sends the encasing single quote which iosxr cannot handle correctly this is confirmed with manually scp-ing the file with \'/harddisk:/publickey_sshkeytest.b64\' producing the same logs as with pylibssh this is tested and confirmed on iosxr 6.5.1, 7.1.1, 7.5.1 |
@Qalthos is any update on this issue? |
Also, other than paramiko and ansible-pylibssh, is there any other library that can be used? As paramiko is allegedly very slow. Thanks! |
There are really separate issues with the It's I switched to the None of the problems are caused by pylibssh, I think. |
Would you mind sharing the libssh patch as it seems to be the only way to get the iosxr_config module working currently? |
Here are the patches I use (uploaded as txt since Github refuses to accept files with the |
@alexandergall |
Can you propose the changes to libssh in https://gitlab.com/libssh/libssh-mirror/-/merge_requests with some more information what is wrong there and how is your patch solving this issue? |
libssh is correct, it's the SFTP implementation of some IOS-XR versions that's wrong. My patch is just a workaround and shouldn't be merged as it is. The reasonable thing to do would be to add a configuration option to libssh to disable the SSH_FXP_STATUS check when dealing with broken routers, I think. I don't have the time to write a complete patch right now, but I could open an issue describing the problem. |
Yes please, even the issue for libssh with enough information could be enough for now just to be aware of the issue. I would rather create some quirk that would detect the broken implementation from SSH string identification or something rather than creating configuration for this bug, but that is an implementation detail that can be resolved later. |
SUMMARY
sftp is not working with libssh on iosxr platform
ISSUE TYPE
PYLISSH and LIBSSH VERSION
OS / ENVIRONMENT
IOSXR 6.1.3
IOSXR 7.0.2
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
Tasks
The text was updated successfully, but these errors were encountered: