说明
在使用cowrie官网的镜像搭建蜜罐时,无法访问蜜罐容器里的日志文件,所以决定自己构建一个镜像,方便后续的操作。
Dockerfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| FROM ubuntu:jammy
RUN test ! -f /etc/apt/source.list.save && cp /etc/apt/sources.list /etc/apt/sources.list.save \ && sed -i "s@security.ubuntu.com@mirrors.ustc.edu.cn@g" /etc/apt/sources.list \ && sed -i "s@archive.ubuntu.com@mirrors.ustc.edu.cn@g" /etc/apt/sources.list \ && apt-get update \ && apt-get install -y wget python3.10-venv python-is-python3 git python3-virtualenv libssl-dev libffi-dev build-essential libpython3-dev python3-minimal authbind virtualenv \ && adduser --disabled-password --gecos "" cowrie
RUN su - cowrie \ && cd /home/cowrie \ && wget https://github.com/cowrie/cowrie/archive/refs/tags/v2.5.0.tar.gz \ && tar -zxvf v2.5.0.tar.gz \ && mv cowrie-2.5.0/ cowrie \ && cd cowrie \ && pwd \ && python -m venv cowrie-env \ && . cowrie-env/bin/activate \ && python -m pip install --upgrade pip -i http://pypi.douban.com/simple --trusted-host pypi.douban.com \ && python -m pip install --upgrade -r requirements.txt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com \ && chown -R cowrie:cowrie .
EXPOSE 2222 2223
USER cowrie WORKDIR /home/cowrie/cowrie
CMD ["bin/cowrie", "start","-n"]
|
构建镜像
1
| docker build -t cowrie_from_ubuntu:20240202 .
|
运行方式
1
| docker run -itd -p 2222:2222 -p 2223:2223 cowrie_from_ubuntu:20240202
|
上传镜像
1 2 3 4 5 6 7 8
| docker login
docker tag cowrie_from_ubuntu:20240202 mollyyuu/cowrie_from_ubuntu:20240202
docker push mollyyuu/cowrie_from_ubuntu:20240202
|
参考