davrodpin / mole

CLI application to create ssh tunnels focused on resiliency and user experience.

Home Page:https://davrodpin.github.io/mole/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error generating ssh client config: error while parsing 'known_hosts'

meotimdihia opened this issue · comments

Affected Version

1.0.1

Expected Behavior

tunnel port

Current Behavior

time="2020-09-12T12:10:35+07:00" level=error msg="error generating ssh client config: error while parsing 'known_hosts' file: C:\Users\meoti\.ssh\known_hosts: knownhosts: C:\Users\meoti\.ssh\known_hosts:21: illegal base64 data at input byte 140" tunnel="[channels:[[source=127.0.0.1:5432, destination=127.0.0.1:5432]], server:xx.xx.xx.xx:22]"

Steps to Reproduce

start command: mole start local --source :5432 --source :6379 --destination :5432 --destination :6379 --server server on windows 10, and git bash (https://git-scm.com/downloads)

Hi @meotimdihia,

Is the ssh program able to parse the file? Any chance your known_hosts file was generated or edited by a windows program?

I did some basic tests in a win10, using git bash and mole is working fine.

I still ssh to my server with this file for years. It seems Mole has more problems with known_host files. I tried to delete lines in known_hosts (in Vim) and get a new bug: known_hosts:30: knownhosts: missing host pattern"

edit: I fixed it by deleted the problem lines.

And I have a question, can Mole replace autossh? I can't install autossh on windows. I always use this command to tunnel my server and connecting to my Postgres database: ssh -nNT -L5432:localhost:5432 myserver

I still ssh to my server with this file for years. It seems Mole has more problems with known_host files.

It will be hard trying to fix this issue without having the specific line that is creating the trouble. Would you mind posting it here?

I tried to delete lines in known_hosts (in Vim) and get a new bug: known_hosts:30: knownhosts: missing host pattern"

edit: I fixed it by deleted the problem lines.

That is probably happening because mole is not capable of generating an entry in your knownhosts file when you connect to the ssh server.

And I have a question, can Mole replace autossh? I can't install autossh on windows. I always use this command to tunnel my server and connecting to my Postgres database: ssh -nNT -L5432:localhost:5432 myserver

Mole has an auto connection restart mechanism through the --connection-retries flag.
It also sends synthetic packets to the server that acts as a keep-alive mechanism, through the --keep-alive-interval flag.

It will be hard trying to fix this issue without having the specific line that is creating the trouble. Would you mind posting it here?

Sorry, I deleted those lines with no backup 😃.
I read the documentation and can't figure how to replace the command ssh -nNT -L5432:localhost:5432 myserver with mole.
Can you give me an example, thanks?

Sorry, I deleted those lines with no backup .

That's all right. I am closing the issue since this is not reproducable. Feel free to re-open it if you see a need.

I read the documentation and can't figure how to replace the command ssh -nNT -L5432:localhost:5432 myserver with mole.
Can you give me an example, thanks?

mole start local --source :5432 --destination 127.0.0.1:5432 --server myserver

Since myserver is not a domain or ip address, it will look for its entry on your ssh config file.