Fred808 commited on
Commit
b9d804e
·
verified ·
1 Parent(s): d800701

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +8 -11
entrypoint.sh CHANGED
@@ -1,28 +1,25 @@
1
  #!/bin/bash
2
  set -e
3
 
4
- echo "Starting SSH/SOCKS5 Gateway..."
5
-
6
- # Get public IP
7
- PUBLIC_IP=$(curl -s ifconfig.me)
8
- if [ -z "$PUBLIC_IP" ]; then
9
- echo "Error: Could not fetch public IP."
10
  exit 1
11
  fi
12
- echo "Detected public IP: $PUBLIC_IP"
13
 
14
- # Generate SSH keys if needed
 
 
15
  if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
16
  ssh-keygen -A
17
  fi
18
 
19
- # Start SSH server
20
  /usr/sbin/sshd -D -e -f /etc/ssh/sshd_config &
21
  echo "SSH server started."
22
 
23
- # Start Dante SOCKS5
24
  /usr/sbin/danted -D &
25
  echo "Dante SOCKS5 server started."
26
 
27
- # Keep container alive
28
  exec tail -f /dev/null
 
1
  #!/bin/bash
2
  set -e
3
 
4
+ if [ "$(id -u)" -ne 0 ]; then
5
+ echo "⚠️ Not running as root. Cannot start sshd."
 
 
 
 
6
  exit 1
7
  fi
 
8
 
9
+ echo "Starting SSH/SOCKS5 Gateway..."
10
+
11
+ # Ensure SSH host keys exist
12
  if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
13
  ssh-keygen -A
14
  fi
15
 
16
+ # Start SSH
17
  /usr/sbin/sshd -D -e -f /etc/ssh/sshd_config &
18
  echo "SSH server started."
19
 
20
+ # Start Dante
21
  /usr/sbin/danted -D &
22
  echo "Dante SOCKS5 server started."
23
 
24
+ # Stay alive
25
  exec tail -f /dev/null