The password is not correctly used.
Description
Description
Details
Details
- Difficulty level
- Unknown (require assessment)
- Version
- 202004110117
- Why the issue appeared?
- Will be filled on close
- Is it a breaking change?
- Unspecified (possibly destroys the router)
- Issue type
- Bug (incorrect behavior)
Event Timeline
Comment Actions
This naive patch fixes the issue but I am not sure it is correct and will let @jestabro decide how to handle it (as git gives him as the author of the file)
diff --git a/python/vyos/remote.py b/python/vyos/remote.py index f8a21f0..a69537e 100644 --- a/python/vyos/remote.py +++ b/python/vyos/remote.py @@ -140,10 +140,18 @@ def get_remote_config(remote_file): print('HTTP error: {0} {1}'.format(*val)) sys.exit(1) - if request['user'] and not request['passwd']: - curl_cmd = 'curl -# -u {0} {1}'.format(request['user'], remote_file) + if request['protocol'] in ('scp', 'sftp'): + if request['user'] and not request['passwd']: + # not sure what happens if a username/password has ":" + curl_cmd = 'curl -# -u {0}:{1} {2}'.format(request['user'], request['passwd'], remote_file) + else: + curl_cmd = 'curl {0} -# {1}'.format(redirect_opt, remote_file) + # XXX: This probably only works for http/https ? else: - curl_cmd = 'curl {0} -# {1}'.format(redirect_opt, remote_file) + if request['user'] and not request['passwd']: + curl_cmd = 'curl -# -u {0} {1}'.format(request['user'], remote_file) + else: + curl_cmd = 'curl {0} -# {1}'.format(redirect_opt, remote_file) try: config_file = subprocess.check_output(curl_cmd, shell=True, `
Comment Actions
True, it doesn't currently work; that patch has various problems.
The use of 'user:passwd' is deprecated in rfc 3986, and was carried over in the rewrite from perl to python to maintain backwards compatibility; it should probably be retired. I will either fix or retire.
Comment Actions
It is a useful feature .. please do not kill, This patch will fix things until it can be looked into 🤕