Search code examples
sshgitlabcloudflare

GitLab ssh over cloudflare and proxy


I have installed gitlab on lxc container in a proxmox.

It works like gitlab<->proxy<->cloudflare.

Everything works fine except SSH clone/push/pull, BUT, if I'll add an entry to the /ets/hosts (on the local machine or any other server where im using gitlab) line my public IP of the proxy and domain name of my gitlab - its OK.

proxy VM is lxc container too. There im just redirecting 22 port to gitlab VM with a rule

-A PREROUTING -d AAA.AAA.AAA.AAA/32 -p tcp -m tcp --dport 22 -j DNAT --to-destination 192.168.10.150:22
ssh -T git@git.MYHOST

this works with entry in hosts file. But if remove - its not working.

ERRORS:

# git pull

ssh: connect to host git.peacedata.su port 22: Network is unreachable
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

UPD on 24.04.2020

I found out, that Cloudflare blocks 22port. I have some workaround, but I need most "beautiful" solution)).


Solution

  • So, I just added direct IP address to /etc/hosts and all works as a charm.

    More explained about cloudflare opened ports and why so on link: https://blog.cloudflare.com/cloudflare-now-supporting-more-ports/