mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-04-28 19:28:50 +00:00
systemd - a service awakens
This commit is contained in:
parent
fbfb5a1d90
commit
faff7a17bf
4 changed files with 57 additions and 6 deletions
33
installer/bin/clean.sh
Normal file
33
installer/bin/clean.sh
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
########################################################
|
||||
# T-Pot #
|
||||
# Container Data Cleaner #
|
||||
# #
|
||||
# v16.10.0 by mo, DTAG, 2016-05-28 #
|
||||
########################################################
|
||||
|
||||
# Set persistence
|
||||
myPERSISTENCE=$2
|
||||
|
||||
# Check persistence
|
||||
if [ "$myPERSISTENCE" = "on" ];
|
||||
then
|
||||
echo "### Persistence enabled, nothing to do."
|
||||
exit
|
||||
fi
|
||||
|
||||
# Let's create a function to clean up dionaea data
|
||||
fuDIONAEA () {
|
||||
rm -rf /data/dionaea/*
|
||||
rm /data/ews/dionaea/ews.json
|
||||
mkdir -p /data/dionaea/log /data/dionaea/bistreams /data/dionaea/binaries /data/dionaea/rtp /data/dionaea/wwwroot
|
||||
chmod 760 /data/dionaea -R
|
||||
chown tpot:tpot /data/dionaea -R
|
||||
}
|
||||
|
||||
case $1 in
|
||||
dionaea)
|
||||
fuDIONAEA $1
|
||||
;;
|
||||
esac
|
|
@ -41,7 +41,7 @@ for i in $(cat /data/imgcfg/all_images.conf);
|
|||
do
|
||||
systemctl stop $i
|
||||
sleep 2
|
||||
rm -rf /etc/init/$i.conf || true;
|
||||
systemctl disable $i;
|
||||
done
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
|
@ -56,7 +56,7 @@ sleep 2
|
|||
for i in $(cat /data/images.conf);
|
||||
do
|
||||
docker pull dtagdevsec/$i:latest1603;
|
||||
cp /data/upstart/"$i".conf /etc/init/;
|
||||
systemctl enable $i;
|
||||
done
|
||||
|
||||
# Announce reboot
|
||||
|
|
20
installer/data/systemd/dionaea.service
Normal file
20
installer/data/systemd/dionaea.service
Normal file
|
@ -0,0 +1,20 @@
|
|||
[Unit]
|
||||
Description=dionaea
|
||||
Requires=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
#PermissionsStartOnly=true
|
||||
#User=root
|
||||
#Group=root
|
||||
ExecStartPre=-/usr/bin/docker stop dionaea
|
||||
ExecStartPre=-/usr/bin/docker rm -v dionaea
|
||||
ExecStartPre=/bin/bash -c '/usr/bin/clean.sh dionaea off'
|
||||
#ExecStartPre=/usr/bin/clean.sh dionaea
|
||||
ExecStart=/usr/bin/docker run --name dionaea --cap-add=NET_BIND_SERVICE --rm=true -p 21:21 -p 42:42 -p 8081:80 -p 135:135 -p 443:443 -p 445:445 -p 1433:1433 -p 3306:3306 -p 5060:5060 -p 5061:5061 -p 69:69/udp -p 5060:5060/udp -v /data/dionaea:/data/dionaea -v /data/ews:/data/ews dtagdevsec/dionaea:latest1603
|
||||
#ExecStartPost=/bin/sleep 2
|
||||
ExecStop=/usr/bin/docker stop dionaea
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -314,17 +314,15 @@ tar xvfz /root/tpot/data/elkbase.tgz -C /
|
|||
cp /root/tpot/data/elkbase.tgz /data/
|
||||
cp -R /root/tpot/bin/* /usr/bin/
|
||||
cp -R /root/tpot/data/* /data/
|
||||
cp /root/tpot/data/systemd/* /etc/systemd/system/
|
||||
cp -R /root/tpot/etc/issue /etc/
|
||||
cp -R /root/tpot/home/* /home/tsec/
|
||||
cp /root/tpot/keys/authorized_keys /home/tsec/.ssh/authorized_keys
|
||||
for i in $(cat /data/images.conf);
|
||||
do
|
||||
cp /data/upstart/$i.conf /etc/init/;
|
||||
systemctl enable $i;
|
||||
done
|
||||
|
||||
# Let's turn persistence off by default
|
||||
touch /data/persistence.off
|
||||
|
||||
# Let's take care of some files and permissions
|
||||
chmod 760 -R /data
|
||||
chown tpot:tpot -R /data
|
||||
|
|
Loading…
Reference in a new issue