Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Reverse SSH Proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NoCloud
docker
Reverse SSH Proxy
Commits
4890681b
Commit
4890681b
authored
1 year ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
Readme
parent
71b4d52f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Readme.md
+42
-0
42 additions, 0 deletions
Readme.md
with
42 additions
and
0 deletions
Readme.md
0 → 100644
+
42
−
0
View file @
4890681b
This service is a reverse proxy to send requests to a ssh tunnel
Say that you have a server A that is not reachable from outside the network and a server B that is reachable.
On server B, start this service, then on server A, launch a ssh-tunnel to this service.
## Installation on the proxy server (B)
```
cp .env .env.sample
```
Then edit the following variables:
+
`SSH_PUB_KEY`
: the public key of server A that will be used to log in the ssh server to create a tunnel
+
`HOSTS`
a comma separated list of FQDN with backticks, i.e
```
`a.example.org`,`b.example.org`
```
+
`SSHPORT`
: port to bind the conteners ssh server should be free on the host B
+
`SSHPORT_INT`
: Port for making server A accessible via ssh on server B
+
`HTTPS_PORT`
: Port that will be bind to HTTPS port of server A
+
`NAME`
a unique name for traefik
Finally
`docker-compose up -d`
## On the proxified server (A)
On the server A, put the following script in
`/root/ssh-tunnel.sh`
then run it after starting the services on
`B`
, adapt the constants to your needs
```
bash
#!/bin/bash
HTTPS_PORT
=
8080
SSHPORT_INT
=
2223
SSHPORT
=
2222
PROXY_HOST
=
aquila.tetras-libre.fr
while
true
;
do
/usr/bin/ssh
-i
/root/.ssh/id_rsa
-N
-R
${
HTTPS_PORT
}
:localhost:443
-R
${
SSHPORT_INT
}
:localhost:22
-o
"ExitOnForwardFailure yes"
-o
"StrictHostKeyChecking no"
-o
"ServerAliveInterval 60"
sshuser@
${
PROXY_HOST
}
-p
${
SSHPORT
}
echo
"Ssh failed
$?
"
sleep
5
done
```
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment