Skip to content

Commit debefad

Browse files
committed
Agregar instrucciones sobre la configuración de puertos SSH en el README.md y ajustar el script ssh.sh para aplicar el puerto SSH solo si está definido.
1 parent 29060a6 commit debefad

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,42 @@ Edita el archivo `.env` para personalizar:
5454
| `KF2_STEAM_PORT` | 20560 | Puerto de red Steam (UDP) |
5555
| `KF2_NTP_PORT` | 123 | Puerto NTP para Weekly Outbreak (UDP) |
5656

57+
### ⚠️ Configuración SSH Importante
58+
59+
**Problema de configuración de puertos SSH:**
60+
61+
Si defines `SSH_PORT` en environment Y en ports al mismo tiempo, ocurrirá un conflicto:
62+
63+
```yaml
64+
# ❌ CONFIGURACIÓN INCORRECTA - Causará conflicto
65+
environment:
66+
- SSH_PORT=2222 # SSH escuchará en puerto 2222 interno
67+
ports:
68+
- "2222:22/tcp" # Mapea puerto 2222 externo a 22 interno (pero SSH no escucha 22)
69+
```
70+
71+
**Soluciones:**
72+
73+
1. **Opción A - Mapeo de puertos (Recomendado):**
74+
```yaml
75+
# ✅ CORRECTO - No definir SSH_PORT en environment
76+
environment:
77+
- LGSM_PASSWORD=${LGSM_PASSWORD}
78+
- SSH_KEY=${SSH_KEY}
79+
# NO incluir SSH_PORT aquí
80+
ports:
81+
- "${SSH_PORT}:22/tcp" # SSH escucha en 22 interno, mapea a SSH_PORT externo
82+
```
83+
84+
2. **Opción B - network_mode: host:**
85+
```yaml
86+
# ✅ CORRECTO - Usar SSH_PORT en environment sin mapeo
87+
environment:
88+
- SSH_PORT=${SSH_PORT} # SSH escuchará directamente en SSH_PORT
89+
network_mode: host
90+
# No usar ports: cuando se usa network_mode: host
91+
```
92+
5793
### Configuración del Servidor
5894

5995
Después de iniciar el contenedor, conecta via SSH y configura:
@@ -165,6 +201,11 @@ docker exec -it kf2-server service ssh status
165201
docker exec -it kf2-server cat /etc/ssh/sshd_config
166202
```
167203

204+
**Problema común:** SSH no responde en el puerto esperado
205+
- Si definiste `SSH_PORT` en environment, SSH escuchará en ese puerto interno
206+
- Si usas mapeo de puertos `"${SSH_PORT}:22/tcp"`, SSH debe escuchar en puerto 22 interno
207+
- **Solución:** Remover `SSH_PORT` del environment o usar `network_mode: host`
208+
168209
### El servidor no aparece en el navegador
169210
1. Verificar que los puertos estén correctamente reenviados
170211
2. Verificar configuración del firewall

docker-scripts/ssh.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ else
3333
sed -i 's|#PasswordAuthentication yes|PasswordAuthentication no|' /etc/ssh/sshd_config
3434
fi
3535

36-
sed -i "s|#Port 22|Port ${SSH_PORT}|" /etc/ssh/sshd_config
36+
if [ -n "${SSH_PORT}" ]; then
37+
sed -i "s|#Port 22|Port ${SSH_PORT}|" /etc/ssh/sshd_config
38+
fi
3739

3840
# Start the SSH service
3941
service ssh start

0 commit comments

Comments
 (0)