allow proxy during SSH host key scan in FluxCD CLI#827
Conversation
d0fe81e to
63c6588
Compare
makkes
left a comment
There was a problem hiding this comment.
I'm generally in favor of this change. What I can't judge right now is which Flux CLI commands are affected by this. I couldn't find any controller code affected by this.
It will be very important to document this change with respect to the affected commands.
| defer client.Close() | ||
| ctx, cancel := context.WithTimeout(context.Background(), timeout) | ||
| defer cancel() | ||
| // support for ALL_PROXY ENV varaible |
There was a problem hiding this comment.
| // support for ALL_PROXY ENV varaible | |
| // this reads the ALL_PROXY environment variable |
|
I've tried to improve as I understand another PR should be made to document P.S. and tests for go-git's clone are broken, I'm trying to understand why |
|
ah! |
8c10c5e to
ddb3fd8
Compare
|
I triaged fluxcd/flux2#4353 (full write-up here) and it leads straight to this PR, so a few data points that may help revive it.
@makkes the enumeration (as of flux2 v2.9.2 — all of them funnel into
Related issue reports of the same root cause: fluxcd/flux2#4353, fluxcd/flux2#2509, fluxcd/flux2#3430 (closed), discussion fluxcd/flux2#4414. Validation: the branch no longer builds against the current modules (its @adone are you still interested in finishing this? If not, I'm happy to submit a rebased version with a regression test, plus the flux2 docs PR documenting |
|
hi @gecube honestly I would like to have a contribution to the project |
|
Hi @adone, Great, go for it — I'd much rather see you land it. Ping me if you need a review (at least I would be able to invest some efforts in testing stage) One thing though: I'm still curious how your original issue got resolved. Even a short write-up would be useful for anyone else hitting the same thing. |
2be5563 to
2b6f6e8
Compare
|
I've added a test but it uses a little dirty trick to update cached ENV variables in |
ssh.Dial uses net.DialTimeout under the hood and there is no possibility to use a proxy when running command like `flux create source git` so we use almost all internal implementation of ssh.Dial except net.DialTimeout is replaced with proxy.Dial like it is done in go-git Signed-off-by: Artem Nistratov <nistratov.artem@gmail.com>
previously ScanHostKey ignored any SSH/network errors in case it managed to get host keys to make it more obvious we imitate `ssh.Dial` with `sshDial` func Signed-off-by: Artem Nistratov <nistratov.artem@gmail.com>
Signed-off-by: Artem Nistratov <nistratov.artem@gmail.com>
2b6f6e8 to
c912c45
Compare
| go 1.26.0 | ||
|
|
||
| require ( | ||
| github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 |
There was a problem hiding this comment.
We can not take on this dependency which is abandoned for 10+ years.
ssh.Dialusesnet.DialTimeoutunder the hood srcand there is no possibility to use a proxy when running command like
flux create source git --url ssh://git@example.com/repository.git(unlike for the source controller withALL_PROXY)so I replaced
ssh.Dialwith its almost full internal implementationexcept
net.DialTimeoutreplaced withproxy.Diallike it is done in go-git