-
Notifications
You must be signed in to change notification settings - Fork 34
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
Implement sshs config generator from known_hosts files #8
Conversation
f57b918
to
31bb6db
Compare
@jarrodCoombes this is the maximum I can do with
Do you see further improvements that can be made? |
Ooh! I'll give it a go in a bit, but that sounds exactly like I was thinking and it'll be a great shortcut for getting the list populated. I do like the idea of getting the info from the Are the changes reflected in the pre-build binaries in the releases? |
Sadly no, you need to build it yourself. But it's just calling `makeˋ. |
So I pulled down the source, installed Go, installed the other needed things it called for and compiled it. Running
What did I do wrong here? |
Did you checkout to branch |
31bb6db
to
f77a174
Compare
@jarrodCoombes you can find a built version in the artifacts: https://github.com/quantumsheep/sshs/actions/runs/1828649999 |
307b909
to
1a7b0a3
Compare
I am new to github, so only know how to checkout the master branch, and did not know there was a feature branch. I'll need to look up how to do that. In the meantime, I grabbed the binary and tested it. It works well, but there are some issues. In the known_hosts file you can actually have a single signature tied to multiple host names/ips. My entry that looks like this:
Also this:
Other than that, it actually did a great job. |
1a7b0a3
to
af04fda
Compare
With your example, for instance:
It gives this output in the last commit: Host server.domain.tld:222
Hostname server.domain.tld
Port 222
Host xx.xx.xx.xx:222
Hostname xx.xx.xx.xx
Port 222
Host server2.domain.tld
Hostname server2.domain.tld
Port 22
Host server2
Hostname server2
Port 22
Host yy.yy.yy.yy
Hostname yy.yy.yy.yy
Port 22 What do you think ? |
I think that leads to quite a bit of redundancy and clutter. When given:
It should return:
Basically your host and hostname should be everything up to the first comma (minus any port info). The bits in the I suggest the quotes for the host because it looks like sshs uses that field as the target unless it is in quotes. Not sure if this is deliberate or not, but something I noted when testing this. |
But what do you do for this:
Or even:
|
I would assume that if they share a At the very least this would be such a rare edge case, that I am not sure it's reasonably to account for it. I also see this generate option as a kick-start type thing. It'll get you mostly there, but you'll still need to edit the Also, remember that |
Should be better in the last commit (check artifacts at https://github.com/quantumsheep/sshs/actions/runs/1849655613). I added |
Interesting, not too sure that is really all that necessary. I think this:
Should return
This will almost certainly be the majority of all cases that you'll find the My use is a little bit of an edge case I think, or at least a power user case, the vast majority of people probably won't have such a neat and organized |
We can't set |
a32b3ac
to
7d16b42
Compare
So this config would be considered invalid?
What about this:
This makes me wonder what the difference between |
sshs works by calling ssh over an host (E.g. calling |
I get that, but from my testing sshs seems to try
If I select
I think that sshs should always use |
There are cases when a host doesn't have an hostname (E.g. ProxyCommand). That's why I rely on |
I feel like I am missing something here. You say you rely on the Also I am completely confused by why there is a As for cases where a host doesn't have a hostname, how does sshs handle that? |
Yes I was, and I apologize for this. I did not realize that the With my newly acquired knowledge I think I can say that this feature is about as good as it can probably get, but I will do some testing on it. |
Sorry I didn't realized, I would have told you :/
Ok, I'm waiting for your return to decide if we merge it like that or change it. |
Looks like it's ignoring all my entries in
Returns:
|
Should we add an a |
I think so, to me it makes sense to treat each line in the |
e7cbddf
to
807b13e
Compare
It should be good in https://github.com/quantumsheep/sshs/actions/runs/1953959990 |
Relates to #6.