-
Notifications
You must be signed in to change notification settings - Fork 269
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
Download License + scp and ftp (also e.g. for startup-config) #1414
base: main
Are you sure you want to change the base?
Conversation
implementing #1377 |
@@ -5,6 +5,7 @@ go 1.20 | |||
require ( | |||
github.com/a8m/envsubst v1.4.2 | |||
github.com/awalterschulze/gographviz v2.0.3+incompatible | |||
github.com/bramvdbogaerde/go-scp v1.2.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose using sftp rather than scp
example: https://github.com/openconfig/gnmic/blob/ee2c9de75216ce19198ca5bb8f61dcc91e5da88e/utils/file.go#L128
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried the current PR from @steiler rebased with main. So far scp works, but with scp I get the warnings:
WARN[0000] error performing host key validation based on "/root/.ssh/known_hosts" for hostname "flosch1:22" (knownhosts: key is unknown). continuing anyways
Also not sure if we should have this in the config file and not only as env var: CLAB_SSH_KEY
I also tried sftp, but I do not get it to work. I remains in:
DEBU[0000] Fetching "ftp://user:pass@localhost:2222/license" for node "leaf1" storing at "/tmp/.clab/clos02-leaf1-license"
I can debug a bit more...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried the current PR from @steiler rebased with main. So far scp works, but with scp I get the warnings:
WARN[0000] error performing host key validation based on "/root/.ssh/known_hosts" for hostname "flosch1:22" (knownhosts: key is unknown). continuing anyways
Also not sure if we should have this in the config file and not only as env var: CLAB_SSH_KEY
I also tried sftp, but I do not get it to work. I remains in: DEBU[0000] Fetching "ftp://user:pass@localhost:2222/license" for node "leaf1" storing at "/tmp/.clab/clos02-leaf1-license"
I can debug a bit more...
could be HostKeyCallback
setting this code
clientConfig := ssh.ClientConfig{
User: u.User.Username(),
Auth: []ssh.AuthMethod{},
HostKeyCallback: getCustomHostKeyCallback(knownHostsPath),
HostKeyCallback: getCustomHostKeyCallback(knownHostsPath)
, suggest to use ssh.InsecureIgnoreHostKey()
to allow any host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, would suggest to keep SCP as a fallback in SFTP service does not available in the router.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a custom Hostkey callback that is being used.
What happens is, that it informs you that it acted like InsecureIgnoreHostKey()
in case no known key was found.
Thats the reason for the warning plus the "continuing anyways".
615b273
to
421e903
Compare
421e903
to
21df4d0
Compare
Is there any timeline when we could expect this PR to be merged? Is there anything needed to be tested/checked to get this? For Nokia internal usage this would further simplify labbing! |
Let me base it on the actual master branch to resolve merge conflicts then @hellt can probably get to it. ;-) |
d8312d2
to
d66fc4a
Compare
Do we want to run the tests for the downloads as seperate suite or also make it part of smoke tests? |
…file downloads (also startup-configs)
d66fc4a
to
93bf471
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1414 +/- ##
==========================================
- Coverage 51.78% 51.19% -0.60%
==========================================
Files 148 148
Lines 14548 14777 +229
==========================================
+ Hits 7534 7565 +31
- Misses 6180 6374 +194
- Partials 834 838 +4
|
clientConfig := ssh.ClientConfig{ | ||
User: u.User.Username(), | ||
Auth: []ssh.AuthMethod{}, | ||
HostKeyCallback: getCustomHostKeyCallback(knownHostsPath), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest to use ssh.InsecureIgnoreHostKey() to allow any host.
@@ -5,6 +5,7 @@ go 1.20 | |||
require ( | |||
github.com/a8m/envsubst v1.4.2 | |||
github.com/awalterschulze/gographviz v2.0.3+incompatible | |||
github.com/bramvdbogaerde/go-scp v1.2.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried the current PR from @steiler rebased with main. So far scp works, but with scp I get the warnings:
WARN[0000] error performing host key validation based on "/root/.ssh/known_hosts" for hostname "flosch1:22" (knownhosts: key is unknown). continuing anyways
Also not sure if we should have this in the config file and not only as env var: CLAB_SSH_KEY
I also tried sftp, but I do not get it to work. I remains in: DEBU[0000] Fetching "ftp://user:pass@localhost:2222/license" for node "leaf1" storing at "/tmp/.clab/clos02-leaf1-license"
I can debug a bit more...
could be HostKeyCallback
setting this code
clientConfig := ssh.ClientConfig{
User: u.User.Username(),
Auth: []ssh.AuthMethod{},
HostKeyCallback: getCustomHostKeyCallback(knownHostsPath),
HostKeyCallback: getCustomHostKeyCallback(knownHostsPath)
, suggest to use ssh.InsecureIgnoreHostKey()
to allow any host.
This PR makes license files downloadable and embeddable.
It further also implements scp and ftp as download protocols for also als the existing downloadable content (e.g. startup-config).