telekom-security / tpotce

🍯 T-Pot - The All In One Multi Honeypot Platform 🐝
GNU General Public License v3.0
6.91k stars 1.09k forks source link

tpot.service #640

Closed lluked closed 4 years ago

lluked commented 4 years ago

I am new to docker but believe there may be a small mistake in tpotce/host/etc/systemd/tpot.service on line 23.

ExecStartPre=-/bin/bash -c 'docker rmi $(docker images | grep "<none>" | awk \'{print $3}\')'

executing

docker rmi $(docker images | grep "<none>" | awk \'{print $3}\')

in terminal results in

awk: 1: unexpected character ''' awk: line 2: missing } near end of file "docker rmi" requires at least 1 argument.

I believe that the \ preceding {print $3}\ is not needed.

so the line should be

ExecStartPre=-/bin/bash -c 'docker rmi $(docker images | grep "<none>" | awk '{print $3}\')'

This results in either removing <none> images or returning

"docker rmi" requires at least 1 argument. See 'docker rmi --help'.

if no <none> images are present.

As I had no <none> images left for testing I downloaded several versions of alpine images and replaced grep "<none>" with grep "alpine" and executed

docker rmi $(docker images | grep "alpine" | awk \'{print $3}\')

this resulted in the error

awk: 1: unexpected character ''' awk: line 2: missing } near end of file "docker rmi" requires at least 1 argument.

executing

docker rmi $(docker images | grep "alpine" | awk '{print $3}\')

successfully removed the images.

Again, I'm new to this so sorry if I'm incorrect

t3chn0m4g3 commented 4 years ago

Running in systemd without \ before ' results in not executing the command correctly. At least in my tests.

lluked commented 4 years ago

Sorry that's probably the problem, I wasn't running through systemd.