[Unit]
Description=AutoSSH tunnels for gitlab
After=network-online.target
StartLimitIntervalSec=0
[Service]
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -M 0 -T -N gitlab-tunnel
Restart=always
RestartSec=2
User=tunnel
WorkingDirectory=/home/tunnel
[Install]
WantedBy=multi-user.target
Host gitlab-tunnel
HostName 192.168.0.26
User gitlab
Port 22
IdentityFile /home/tunnel/.ssh/id_ed25519
LocalForward 0.0.0.0:22 localhost:22
ExitOnForwardFailure yes
ServerAliveInterval 5
ServerAliveCountMax 3
● autossh-tunnel.service - AutoSSH tunnel for gitlab
Loaded: loaded (/etc/systemd/system/autossh-tunnel.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2024-07-04 06:49:35 UTC; 11min ago
Main PID: 63290 (autossh)
Tasks: 1 (limit: 4556)
Memory: 188.0K
CPU: 181ms
CGroup: /system.slice/autossh-tunnel.service
└─63290 /usr/lib/autossh/autossh -M 0 -T -N gitlab-tunnel
Jul 04 06:56:25 k8s-master1.local autossh[68120]: bind [0.0.0.0]:22: Permission denied
Jul 04 06:56:25 k8s-master1.local autossh[68120]: channel_setup_fwd_listener_tcpip: cannot listen to port: 22
Jul 04 06:56:25 k8s-master1.local autossh[68120]: Could not request local forwarding.
Jul 04 06:56:25 k8s-master1.local autossh[63290]: ssh exited with error status 255; restarting ssh
Jul 04 06:59:07 k8s-master1.local autossh[63290]: starting ssh (count 15)
Jul 04 06:59:07 k8s-master1.local autossh[63290]: ssh child pid is 69935
Jul 04 06:59:07 k8s-master1.local autossh[69935]: bind [0.0.0.0]:22: Permission denied
Jul 04 06:59:07 k8s-master1.local autossh[69935]: channel_setup_fwd_listener_tcpip: cannot listen to port: 22
Jul 04 06:59:07 k8s-master1.local autossh[69935]: Could not request local forwarding.
Jul 04 06:59:07 k8s-master1.local autossh[63290]: ssh exited with error status 255; restarting ssh
~
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-113-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Thu Jul 4 07:05:00 AM UTC 2024
System load: 0.13 Processes: 252
Usage of /: 32.3% of 33.20GB Users logged in: 1
Memory usage: 83% IPv4 address for enp0s3: 192.168.0.26
Swap usage: 1%
* Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
just raised the bar for easy, resilient and secure K8s cluster deployment.
https://ubuntu.com/engage/secure-kubernetes-at-the-edge
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
Last login: Thu Jul 4 06:31:36 2024 from 192.168.0.19
gitlab@gitlab-server:~$
server {
listen 8080;
server_name domen.ru;
location / {
proxy_pass http://192.168.0.26:22; #проксирую на гитлабовский ssh
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
}
}
server {
listen 8088;
server_name node1.com;
location / {
proxy_pass http://192.168.0.21:8088;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 8089;
server_name domen2.com;
location / {
proxy_pass http://192.168.0.22:8089;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}