#658  OneDev SSH clone shows local IP address and port
Closed
Quin opened 2 years ago

A couple of issues.

For me, running internally, it isn't an issue, but externally it is.

The SSH clone shows the internal IP address for the server, whereas HTTPS it correct (a URL).

Internally, I can pull and push without any issue, but externally, I can only pull with HTTPS and not push.

Quin referenced from other issue 2 years ago
Robin Shen changed state to 'Closed' 2 years ago
Previous Value Current Value
Open
Closed
Robin Shen commented 2 years ago

The SSH clone url is guessed by OneDev at its best and you may change the root url at administration / security setting / ssh setting

Quin changed state to 'Open' 2 years ago
Previous Value Current Value
Closed
Open
Quin commented 2 years ago

I've changed the SSH URL to be an actual URL.

That does not work. I've tested it internally and externally, and I get fatal: repository does not exist. However, adding :6610 to the end of the URL when pulling internally does at least get me to the password prompt (and that's all).

Robin Shen commented 2 years ago

Have you configured some sort of port forwarding? OneDev by default listeners on 6610 (for http) and 6611 (for ssh), and you may setup some form of port forwarding outside of OneDev to forward 80/22 traffic to OneDev's 6610/6611 port.

This is not a bug of OneDev.

Robin Shen changed fields 2 years ago
Name Previous Value Current Value
Type
Bug
Support Request
Quin commented 2 years ago

On my router, I have ports 80, 443, and 22 all directing that traffic to the Hypervisor. On the Hypervisor, I am running nginx reverse proxy and I've literally copied and pasted the config from the manual.

Robin Shen commented 2 years ago

Please describe your case in more detail. Like how you are running OneDev (docker, bare metal), what is the role of Hypervisor here etc.

Quin commented 2 years ago

Bare Metal, on a guest machine. The hypervisor has nginx installed. I am using virt-manager to handle all the guest machines. I have multiple guest machines, and nginx reverse proxy directs the traffic correctly (I can view the sites on 80/443, I cannot access via SSH)

Using the internal IP:Port as remote allows me to pull and push repos internally via SSH, but externally, I can only pull using HTTPS.

On a separate note, because my router cannot handle loopbacks, I have BIND9 split DNS enabled so I can access the guest machines as though external (instead of using their internal IP).

Robin Shen commented 2 years ago

I am not familiar with these techs. OneDev is no different than other services. To access OneDev SSH service via port 22, you need to set up some form of port forwarding to forward TCP traffic from 22 on some node to 6611 on node running OneDev.

Robin Shen commented 2 years ago

Or you may set up OneDev to serve SSH via port 22 directly by running it as root and configure property "sshPort" of "conf/server.properties" as 22. But that will conflict with the SSHD service, and is not recommended.

Quin commented 2 years ago

Okay.

So how can I fix the issue of not being able to push with HTTP?

Robin Shen commented 2 years ago

Are you able to push via port 6610 directly? If yes, you may need to check your proxy/frontend setup.

Quin commented 2 years ago

When the SSH url is set to the (internal) IP:Port, but not when it's the resolved domain.

When it's the domain, the closest I can get to is asking for a password, but the username is wrong (I'm not sure if it's pulling from my Windows username).

Quin commented 2 years ago

When trying to clone on the same network fatal: unable to access 'https://[username]@[domain:6610/TestProject/': error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol; without the port, it just hangs.

When trying to clone externally, I get error:0A00010B:SSL routines::wrong version number

Both, HTTP (not SSH).

Quin commented 2 years ago

Update:

I've got the SSH URL set to the same subdomain as when viewing the site "onedev.[domain]".

git remote -v produces:

origin  ssh://onedev.[domain]/newProj (fetch)
origin  ssh://onedev.[domain]/newProj (push)

It asks for a password for user, but this isn't the username used in OneDev. I believe this is my Windows account username. I have tried in multiple Terminals. All return the same.

I've tried setting git's global and local user.name's, and it doesn't seem to work.

When I've updated the remotes to include the correct username ssh://[username]@onedev.[domain]/[project] all I get back is that "[project] does not appear to be a git repository"

Robin Shen commented 2 years ago

If you can access internal 6611 port via SSH directly without any issue, it should be a problem of port forwarding. To narrow down the issue, you may first make sure port forwarding to a plain old SSHD service works, then change the target port to point to OneDev's SSH service.

Quin commented 2 years ago

@robin so what's the issue with the project not being a git repo?

These are some new projects I've created; one on OneDev and added some commits, and one local "pre-existing" to push. Both return the same issue.

On other git-services, I've had .git files, i.e. git@github.com:matomo-org/matomo-for-wordpress.git

Robin Shen commented 2 years ago

I guess the traffic is not going to OneDev 6611 port all all.

Robin Shen commented 2 years ago

You may run telnet <host> <port> to see if it prints out SSHD welcome message.

Quin commented 2 years ago

Okay... it all seems to be working now. Not sure if restarting the PC actually did the trick, but I can push and pull with ease now. Could have been changing the port forwarding (probably most likely).

I've had a look at the log file, but nothing really stands out to me as the cause.

Robin Shen commented 2 years ago

Glad to see it is working now. So I guess this can be closed now?

Quin changed state to 'Closed' 2 years ago
Previous Value Current Value
Open
Closed
Quin commented 2 years ago

Dear me (or anyone who does find this for reference). The solution is simple.

Router port forwarding: any external host:22 internal onedev:6611

((I post this simply because I had a ISP issue, and had to reset the router, and forgot what the solution was))

issue 1 of 1
Type
Question
Priority
Major
Assignee
Not assigned
Issue Votes (0)
Watchers (4)
Reference
onedev/server#658
Please wait...
Page is in error, reload to recover