thinkst / opencanary

Modular and decentralised honeypot
http://opencanary.org
BSD 3-Clause "New" or "Revised" License
2.29k stars 358 forks source link

Build docker image from source #353

Closed anhtn512 closed 4 months ago

anhtn512 commented 6 months ago

Is your feature request related to a problem? Please describe. I want modify opencanary source and rebuild it to docker image => to easy to deploy

Describe the solution you'd like

Describe alternatives you've considered

Additional context

jayjb commented 6 months ago

Hi @anhtn512,

Thanks for getting in touch. Can you give me more details of what you looking to do? I'm not sure I follow what you asking for

anhtn512 commented 6 months ago

HI Jay, I want to build an image with my custom code so I create it

FROM python:3.10-buster

# Download cache lists and install minimal versions
RUN apt-get update && apt-get -yq install --no-install-recommends \
    # Required linux dependencies
    sudo vim build-essential libssl-dev libffi-dev python-dev libpcap-dev && \
    # Remove cache lists and clean up anything not needed to minimize image size
    apt-get autoremove -yq && apt-get clean && rm -rf /var/lib/apt/lists/*

# Install required pip dependencies
RUN pip install scapy pcapy-ng

WORKDIR /app
COPY . .
RUN rm -rf ./dist
RUN python setup.py sdist
RUN pip install ./dist/opencanary-*.tar.gz

# Set the default application we are running
ENTRYPOINT [ "opencanaryd" ]

# Set the default arguments to be used for the entrypoint
CMD [ "--dev" ]
michelcrypt4d4mus commented 5 months ago

these scripts may or may not be helpful

jayjb commented 5 months ago

Hi @anhtn512,

So if im understanding you correctly, you would just like some steps to follow to build the docker image from custom opencanary code instead of pulling from pip?

anhtn512 commented 5 months ago

Hi @anhtn512,

So if im understanding you correctly, you would just like some steps to follow to build the docker image from custom opencanary code instead of pulling from pip?

yes, that is my point one more thing, when I restart a container to run opencanary, it immediately stops because twistd cannot run due to the twistd.pid file already exists, I suggest we add a check in the bin/opencanaryd file to make sure everything can work again properly. Normal Can I create a pull request?

github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 14 days with no activity.

jayjb commented 4 months ago

Hi @anhtn512,

Sorry for the delay in a response. Please do create a PR with that check. It sounds useful. With regards, to a docker build of github current, that also sounds useful. Let me see if we can figure that out.

github-actions[bot] commented 4 months ago

This issue is stale because it has been open for 14 days with no activity.

github-actions[bot] commented 4 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.