persistent db for docker

This commit is contained in:
2019-11-10 19:07:26 +02:00
parent 1a107fdd50
commit 5664128d20
4 changed files with 20 additions and 15 deletions

View File

@@ -6,12 +6,12 @@ RUN apt-get update && apt-get install -y \
curl \
git \
openssh-server \
build-essential
RUN curl -L https://six9.net/get-pip.py | python3 && pip3 install tabulate psutil
build-essential \
&& apt-get clean
RUN curl -L https://six9.net/get-pip.py | python3 && pip3 install tabulate psutil && rm -rf ~/.cache/pip
RUN git clone https://bitbucket.org/MoonQ/backdoor.git /backdoor
ADD config.env /backdoor/
RUN cd /backdoor
ADD install.sh /
ADD run.sh /
CMD sh /run.sh
CMD bash /run.sh

View File

@@ -1,5 +0,0 @@
#!/bin/bash
cd /backdoor
make install

View File

@@ -1,12 +1,22 @@
#!/bin/bash
set -e
/etc/init.d/ssh start
useradd -u $USR user
mkdir -p /home/user/.ssh /home/user/bin
id user 2> /dev/null || \
useradd -s /bin/bash -u $USR user || \
useradd -s /bin/bash -u $USR -M user
mkdir -p /home/user/.ssh /home/user/bin /home/user/db
chown -R user /home/user /backdoor
cd /backdoor && make install
/home/user/bin/ssh-backdoor --db /home/user/db/ssh-backdoor.sqlite list
ln -sfT /home/user/db/ssh-backdoor.sqlite /tmp/ssh-backdoor.sqlite
chmod 600 /home/user/.ssh/*
chmod 700 /home/user/.ssh /home/user/bin
su -l -c /install.sh user
chmod 600 /home/user/db/*
chmod 700 /home/user/.ssh /home/user/bin /home/user/bin/*
/etc/init.d/ssh start
while :; do
sleep 60
done

View File

@@ -181,7 +181,7 @@ class DataBase:
os.kill(parent, 9)
except OSError:
pass
sys.exit(1)
sys.exit(0)
def check_die(self):