Home > Back-end >  Git repo unreachable after unsuccessful login attempt from within a docker container
Git repo unreachable after unsuccessful login attempt from within a docker container

Time:10-30

Ok, so. I am trying to build a docker container for an app we use frequently at work, and as a part of the build process docker needs to clone the content of certain private git repositories owned by our company.

Now, before starting the docker build process (with docker-compose ... ) I used to have full access to these repositories, which is set up through a pair of public/private SSH keys. For instance, executing commands like

ssh -Tvvv [email protected]

produced (among others) output messages like "Authentication succeeded (publickey)" and I could use all the usual git commands (pull, push...) in my local repositories with no problems.

This situation changed after I started the docker build process for our proprietary app. The build itself is unsuccessful, giving an error message like (exact message altered for privacy purposes):

 Failed to execute git clone --no-checkout 'ssh://[email protected]:7000/zs-payments.git' 
'/srv/www/zs/payment' && cd '/srv/www/zs/payments' && git remote add composer 
'[email protected]:7000/zs-payments.git' && git fetch composer

 Cloning into '/srv/www/zs/payments'...
 ssh: connect to host [email protected]:7000: Connection refused
 fatal: Could not read from remote repository.

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

I assume that the "connection refused" part of the problem comes from the fact that I did not properly set up the SSH key authentification from within the Docker container. This is a topic which was already discussed on StackOverflow, see e.g.

Using SSH keys inside docker container

However, at the moment I am NOT interested in this particular issue! My real problem is the fact that, after the unsuccessful docker build process (and the associated "connection refused" issue), I cannot access the git repositories of my company at all! For instance, executing the ssh test command given above (ssh -Tvvv ...) now results in an error message like (again, exact message altered for privacy purposes)

OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data C:\\Users\\user_name/.ssh/config
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolving "gitlab.main-company-repo.de" port 7000
debug2: ssh_connect_direct
debug1: Connecting to gitlab.main-company-repo.de [85.xxx.xx.11] port 7000.
debug3: finish_connect - ERROR: async io completed with error: 10060, io:000001EDA40D7590
debug1: connect to address 85.xxx.xx.11 port 7000: Connection timed out
ssh: connect to host gitlab.main-company-repo.de: Connection timed out

Similarly, the git commands like pull and push, which used to work perfectly fine in my local repositores before the docker build process, now give the same "connection timeout" error.

Restarting the computer does NOT fix the issue, i.e. also after restart the repositories are unavailable to me. One thing that DID help (for a while) was switching to another network. After switching from the WLAN network that I initially used to the Internet from my mobile service provider (by means of USB-Tethering), the problem was gone for a bit and I could access the repositories again. But after doing the docker build again (which ends with the same error message), the same "connection timeout" thing happens with the "mobile phone Internet" and the repositories are unavailable to me on both networks.

Does anyone have any idea what might be happening here? In another words, how can an unsuccessful git login attempt (with SSH keys) from within a Docker container result in me being "locked out" of all (previously available) repos, and in a such a way that restarting the machine does not help (but switching to another network does)? Is this maybe some sort of a firewall issue, where my login attempts to git have been marked as potential threats?

Any hints and/or suggestions on what might be going on here would be very welcome! And in the case it might be important, this all happens on a Windows 10 machine.

Also (I just remembered this), running the ping command on the problematic repository, i.e.

ping 85.xxx.xx.11 7000

gives the error message

ping: sendmsg: Network is unreachable

The ping command was run on a WSL-based Ubuntu from within Windows. Again, any help in this regard would be greatly appreciated!

CodePudding user response:

The problem was solved in the end, in a somewhat unexpected way. Soon after I posted this question, other people in the company started having similar issues, with their git commands ending with the same "connection timeout" error messages.This only seemed to affect the users with static IP addresses, and also happened to people who did not use any kind of docker container builds.

It turns out (or at least so I have been told) that git firewall was blacklisting our IP addresses, designating our access attempts as potential threats. The people in charge of these matters at the company have managed to get our IPs taken off the blacklist and since then things are running smoothly. We still do not know why this exactly happened, and what kind of criteria git used when designating our activities as "unwanted". If there is some more info in the future about this I will post it here, so that others may avoid similar situations.

  • Related