Multiple tunnel request for serveo.net not working - jenkins

I have two things running on localhost
A]Jenkins server on localhost:8080
B]Another App on localhost:3000
I wanted to expose both localhost URL so that these applications can be accessed remotely by anyone.
I found option serveo.net I tried firing command:
ssh -R 80:localhost:8080 -R 80:localhost:4200 serveo.net
Result:
I get a response
Forwarding HTTP traffic from https://subdomain1.serveo.net
Forwarding HTTP traffic from https://subdomain2.serveo.net
My Jenkins server is running properly on URL https://subdomain1.serveo.net
But I am having a problem for URL https://subdomain2.serveo.net
How to solve this issue?
Is there any change required in below command for serveo.net?
ssh -R 80:localhost:8080 -R 80:localhost:3000 serveo.net.

you need to run it in 2 separate instances:
ssh -R 80:localhost:8080 serveo.net
ssh -R 80:localhost:3000 serveo.net
Then you will have access to both URL's from serveo to access them.

Related

Cant Use a Subdomain in NGINX Proxy Manager

I'm trying to set up the NGINX Reverse Proxy Manager on my Docker.
Now I have a DynDNS address and I work with the proxy manager because I can reach the default page of nginx proxy manager over the dyndns address.
When i try to connect a port with the standard dyndns name that I have over the proxy manager it works fine, also with SSL. But when I try to use a subdomain like subdomain1.laptopsimon.net nothing works: I can't create an SSL certificate and I can't even connect over http to the side.
Does anybody have an idea why I can not use Subdomains?
Also, I get this Letsencrypt Error in the LOG:
[12/25/2022] [1:50:45 PM] [SSL ] › ℹ info Requesting Let'sEncrypt certificates for Cert #9: subdomain1.laptopsimon.ddns.net
[12/25/2022] [1:50:45 PM] [SSL ] › ℹ info Command: certbot certonly --config "/etc/letsencrypt.ini" --cert-name "npm-9" --agree-tos --authenticator webroot --email "simon.hauber#outlook.de" --preferred-challenges "dns,http" --domains "subdomain1.laptopsimon.ddns.net"
[12/25/2022] [1:50:49 PM] [Nginx ] › ℹ info Reloading Nginx
[12/25/2022] [1:50:49 PM] [Express ] › ⚠ warning Command failed: certbot certonly --config "/etc/letsencrypt.ini" --cert-name "npm-9" --agree-tos --authenticator webroot --email "simon.hauber#outlook.de" --preferred-challenges "dns,http" --domains "subdomain1.laptopsimon.ddns.net"
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
Your DDNS provider, No-IP, doesn't support "fourth-level" subdomains (see also this answer).
You could have example.ddns.net working fine and DNS A record pointing to an IP address you have chosen, but they won't resolve e.g. test.example.ddns.net.
You can verify this yourself with command nslookup subdomain1.laptopsimon.ddns.net.
IIRC, that was the reason why I stopped using them and continued with duckdns.org.
There, every subdomain, even test1.test2.example.duckdns.org will resolve to same IP address.
From let'sencrypt log excerpt it's not clear to me what could be the problem. You will need to check

docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:80: bind:

I'm trying to run a docker image on my windows 10 pro workstation, and I'm getting this error:
docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
I'm running this command:
docker run -d -p 80:80 docker/getting-started
And getting this response back:
Unable to find image 'docker/getting-started:latest' locally
latest: Pulling from docker/getting-started
188c0c94c7c5: Pull complete
617561f33ec6: Pull complete
7d856acdaa9c: Pull complete
a0d3c6e28e6d: Pull complete
af69a9b963c8: Pull complete
0739f3815ad8: Pull complete
7c7b75d0baf8: Pull complete
Digest: sha256:b821569034e3b5fae03b40e64a866017067f3bf17effe185b782bdbf02179528
Status: Downloaded newer image for docker/getting-started:latest
7907f6de2b55cc2d66b5ed3a642ac1a97e5bb5ecda5fcf76ff60d7236e8fd32d
docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
How can I run a Docker container and get past this problem?
The commands that helped me were:
net stop winnat
net start winnat
Taken from here.
Check if somthing is listening on port 80 by running PowerShell command:
Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess
If the response is something like this:
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
0 0.20 4.87 0.00 4 0 System
Then the it is taken.
terminate the process or simply change the port
docker run -d -p 81:81 docker/getting-started 5a0b1202f48ef63c06d75c2f26be2a05f29aa84fe2fbdc5b66f989aa86df98f
docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
I was also using Docker's Getting Started tutorial, ran
docker run -d -p 80:80 docker/getting-started, and got the same error.
I thought that Internet Information Services (IIS) might be using port 80 already. I verified this hunch by going to
Start > IIS > computer name > Sites > Default Web Site > highlight Default Web Site
In the right pane, I saw
Browse *.80 (http)
Yep, port 80 was already in use!
Note: To verify if any process is using port 80, run the command
Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess
and look for something like
NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
------ ----- ----- ------ -- -- -----------
0 0.20 2.96 0.00 4 0 System
per #Tim Dunphy's answer.
Solution #1
Stop the Default Web site.
Either go to IIS per above > right pane > Manage Website > Stop or
Use the net stop http command, and stop services using the port.
Solution #2
You may not want to stop IIS or any other service running on port 80, so just change the local port! For example,
docker run -d -p 81:80 docker/getting-started
will likely do the trick, as long as you don't have services using port 81.
When I encountered this error there was nothing actively listening on the port.However, the following command showed the port had been reserved by something else
netsh interface ipv4 show excludedportrange protocol=tcp
See This article for more details. A reboot fixed the issue for me.
Most times, Windows IIS (Internet Information Service) or some other program may be using port 80, which is the default http port used by Laravel, Apache and other PHP development environments.
To resolve this issue, Open a new PowerShell window as administrator and simply run this command:
net stop http
A prompt listing all services using the http port is shown and you are given the option of stopping them. enter 'Y' and press Enter. All the services are stopped and port 80 is now free for whatever you want to use it for.
Very useful for testing multiple application environments locally on Windows without having to worry about port configuration.
in my case,the task manager show that a system process is occupy port 80.
when i dive deeper, i found a svchost.exe related to port 80, and it is based on world wide web service
so,just open service list and stop the world wide web service,then everything will be ok,the name of service maybe different, but should include keywords :world wide web
just do it
netsh http add iplisten ipaddress=::
(This has to be run in a command prompt with elevated rights!)

When I try to curl using internal ip it works but the same doesn't work with external ip on GCP?

I'm bit new to GCP, I am trying to run a curl command using internal ip this works but when tried with external ip it doesn't response
curl -vvvv http://10.128.0.3:50000
* Rebuilt URL to: http://10.128.0.3:50000/
* Trying 10.128.0.3...
* Connected to 10.128.0.3 (10.128.0.3) port 50000 (#0)
> GET / HTTP/1.1
> Host: 10.128.0.3:50000
> User-Agent: curl/7.47.0
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Content-Type: text/plain;charset=UTF-8
<
Jenkins-Agent-Protocols: JNLP4-connect, Ping
Jenkins-Version: 2.121.3
Jenkins-Session: 4c0a93f0
Client: 10.128.0.3
Server: 10.128.0.3
Remoting-Minimum-Version: 2.60
* Closing connection 0
curl -vvvv http://35.232.33.183:50000
* Rebuilt URL to: http://35.232.33.183:50000/
* Trying 35.232.33.183...
Confirm that the firewall is properly configured by running the ff:
telnet 35.232.33.183 50000
You should get a prompt (which exact prompt depends on the remote server's OS.
The other option is to expose your internal IP to external world using tools like ngrok. Use the following steps to install and run ngrok. (This example is for Ubuntnu 16.04 on GCP and should work on other platforms too)
The following instructions are for using ngrok to expose localhost application to
internet. This is tested on CGP, Ubuntu 16.04
Step 1: Download ngrok
Login into https://ngrok.com/ and download Linux(32-bit) zip file to your google
instance (you may choose the right version for your platform else you will get a segmentation fault while trying to execute)
Step 2: Unzip executable
mkdir ngrok
cd ngrok
unzip ngrok-stable-linux-386.zip
Step 3: Run your app
Run your app which is listening on port 5000 of localhost.
Python3 main.py
The output will look like this:
name#instance-1:~$ python3 main.py
Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
Restarting with stat
Debugger is active!
Debugger PIN: 279-195-470
Your app is now listening on port 5000 of the local machine
Step 4: Run ngrok
For exposing an app listening on port 5000, run the following command
./ngrok http 5000
The output will look like this:
ngrok by #inconshreveable (Ctrl+C to quit)
Session Status online
Session Expires 7 hours, 59 minutes
Version 2.2.8 Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://f985f882.ngrok.io -> localhost:5000
Forwarding https://f985f882.ngrok.io -> localhost:5000
Connections ttl opn rt1 rt5 p50 p90 0 0 0.00 0.00 0.00 0.00
Step 5: Test your app
Run this command:
curl http://f985f882.ngrok.io
The output will look like:
Mynames-MacBook-Pro:~ Myname$ curl http://f985f882.ngrok.io
I am running
You can also access the above url from any browser
In conclusion
ngrok is very simple and easy tool to use

Docker: ssh -L to docker container - connection refused

I'm having problems to get my ssh tunnel working for my container in a docker swarm cluster.
ssh connection on my local machine:
ssh -L 7180:test.XXX:7180 user#XXX
In my Dockerfile on the remote machine:
EXPOSE 7180
Container start:
docker -H test:2379 --tlsverify run -d -p 7180:7180 --net=my-net
I tried to connect in Firefox via:
localhost:7180
Unfortunately the connection gets refused on the remote machine:
channel 3: open failed: connect failed: Connection refused
"docker container ls" prints following for the ports:
xxx:7180->7180/tcp
Inside my container "netstat -ntlp | grep LISTEN" prints:
tcp 0 0 0.0.0.0:7180 0.0.0.0:* LISTEN -
I'm new to this but after all what I've read so far this should actually work. I'm using "--net=my-net" because I want to setup my own network later. I had the same issue with "--net=host". What am I doing wrong?
The ssh command should be:
ssh -L 7180:127.0.0.1:7180 user#XXX
And then from your browser, you would go to:
http://127.0.0.1:7180
I've avoided using "localhost" because some machines map this to IPv6 even if you don't have IPv6 configured.
When testing this tunnel, make sure your application is listening on the remote server by doing an ssh to that server and run a curl command directly on the server to 127.0.0.1:7180. If it doesn't work there, you would repeat your debugging with netstat inside the container and verifying the port is published in thedocker ps` output.
I got it working with
ssh -D localhost:7180 -f -C -q -N user#XXX
and using
xxx:7180
in my browser (instead of localhost).
localhost and --net=host did not work for me with ssh -L.

ssh connection to git failing

I am opening some question I somewhat asked before but now the problem seems to be pretty linked to ssh.
I have installed Gitlab in /home/myuser/gitlab.
I created a rep test
Following instructions, I added a remote git#localhost:root/testing.git (Gitlab's server runs on port 3000)
Now, when I try to push, I get this error message:
$ git push -u origin master
ssh: Could not resolve hostname mylocalhost: nodename nor servname provided, or not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Now, I found that there was a problem with my ssh connect. Here's my /home/myhome/.ssh/config file
Host mylocalhost
Hostname localhost
PORT 3000
User git
IdentityFile /home/myuser/.ssh/id_rsa.pub
When I run ssh mylocalhost I get this message
ssh_exchange_identification: Connection closed by remote host
On verbose mode, it seems that the connection is established on the right port but the porcess fails here debug1: ssh_exchange_identification: HTTP/1.1 400 Bad Request.
I tried to update my /System/Library/LaunchDaemons/ssh.plist (I am using OSX) to forward port listening to 3000 but then the Gitlab Webrick Rails server won't run anymore. L tried to change git remote set-url origin mylocalhost:testing.git
Gitlab's HTTP interface is probably running on port 3000, but SSH isn't running there to push the repository to.
The message of ssh: connect to host localhost port 22: Connection refused means that the SSH client was unable to connect to the SSH server at localhost on port 22. I'd ensure you've installed gitlab correctly and Gitlab is running correctly. Also ensuring the ssh server is running and able to accept connections on port 22.
You cannot hope to use the port 3000 if you are using a fully specified url
git#localhost:root/testing.git
As I have explained to you before:
The idea of the ssh config file is to define an entry "foobar" which will set the right server name (Hostname), ssh private key (IdentityFile), and user under which the ssh session is opened.
That would allow to do 'ssh foobar' (without having to put git#xxx, and with non-standard public/private keys files).
You can define as many entry as you want, allowing you to use different user and keys.
So you cannot define origin with git#xxx. You must type:
git remote add origin mylocalhost:testing.git
Or, if origin is already defined, and you need to change its url:
git remote set-url origin mylocalhost:testing.git
(no 'root/' you don't specify any path in front of a gitlab repo: gitlab will deduce the full path of the repo)
But you need to be sure your sshd starts on port 3000, and that gitlab.yml contains that port number.
ssh: Could not resolve hostname mylocalhost: nodename nor servname provided, or not known
That means ssh cannot find ~/.ssh/config, with a mylocalhost entry in it.
Make sure that file exist.
Your previous question put in ~/.git/config, which has nothing to do with ssh.
At last, I figured out what was the problem. I had to set properly the ~/.ssh/config file
Host mylocalhost
Hostname localhost
//I deleted a line specifying the PORT to 3000
User git
IdentityFile /home/myuser/.ssh/id_rsa //It was previously set to /home/myuser/.ssh/id_rsa.pub
Then I reinstalled a key but I still got some problem. Finally, setting the perm of the file /home/myuser/.ssh/id_rsa to 644 and it worked just fine. For information, I found searching in the web that some settings could work with a 700 or a 600 chmod perm, but for me 644 did the trick

Resources