frist commit
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y openssh-server && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
# Crear directorio de datos con permisos abiertos para lectura del usuario ssh
|
||||
RUN mkdir -p /app/data && chmod 777 /app/data
|
||||
|
||||
# Configurar SSH
|
||||
RUN mkdir -p /var/run/sshd && \
|
||||
useradd -m -s /bin/bash craig && \
|
||||
echo 'craig:madrid' | chpasswd && \
|
||||
mkdir -p /home/craig/.ssh && \
|
||||
chown craig:craig /home/craig/.ssh
|
||||
|
||||
# Habilitar autenticacion por contrasena
|
||||
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
|
||||
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
|
||||
|
||||
# Al conectar como craig, forzar la ejecucion del visor de anuncios
|
||||
RUN echo '' >> /etc/ssh/sshd_config && \
|
||||
echo 'Match User craig' >> /etc/ssh/sshd_config && \
|
||||
echo ' ForceCommand python3 /app/ssh_display.py' >> /etc/ssh/sshd_config && \
|
||||
echo ' PermitTTY yes' >> /etc/ssh/sshd_config && \
|
||||
echo ' AllowTcpForwarding no' >> /etc/ssh/sshd_config && \
|
||||
echo ' X11Forwarding no' >> /etc/ssh/sshd_config
|
||||
|
||||
RUN chmod +x /app/start.sh
|
||||
|
||||
EXPOSE 5000 22
|
||||
|
||||
CMD ["/app/start.sh"]
|
||||
Reference in New Issue
Block a user