thinkst / opencanary

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

Ubuntu - Autostart Service in Python Virtual Enviroment #256

Closed Cleonardsmc closed 1 year ago

Cleonardsmc commented 1 year ago

Somewhat Linux Noob. Have everything configured including alerts to Gmail. Can't see to find a process for autostarting the Virtual environment and stating open canary on boot up of Linux Ubuntu.

Any guidance?

hkelley commented 1 year ago

I used the suggested service definition from #73.

[Unit]
Description=OpenCanary
After=syslog.target
After=network-online.target

[Service]
User=root
Type=simple
RemainAfterExit=yes
Restart=always
ExecStart=/root/env/bin/opencanaryd --start
ExecStop=/root/env/bin/opencanaryd --stop

[Install]
WantedBy=multi-user.target
jayjb commented 1 year ago

Hi @Cleonardsmc,

Thanks for checking in with us. Lets see if we can get you up and running. As @hkelley (thanks!) has mentioned, for the autostart you can use a service file (as defined above).

The part there that you should be aware of is the pathing to opencanaryd.

As an example, lets say i created my virtual environment (using virtualenv or pyenv). Once I've activated the virtual environment and pip install opencanary, you should be able to see opencanaryd (is this possible in your setup?).

We can then go which opencanaryd to find the path to opencanaryd. Lets say I do

$ which opencanaryd
/home/ubuntu/Work/opencanaryenv/bin/opencanaryd

We would then use that output /home/ubuntu/Work/opencanaryenv/bin/opencanaryd in our service file for the:

ExecStart=/home/ubuntu/Work/opencanaryenv/bin/opencanaryd --start
ExecStop=/home/ubuntu/Work/opencanaryenv/bin/opencanaryd --stop

Otherwise please provide us with some more information about your setup so we can help further

jayjb commented 1 year ago

Hi @Cleonardsmc,

Just wanted to check in and see if you got everything working?

jayjb commented 1 year ago

Closing this issue due to inactivity. Please feel free to reopen if you continue to have this issue.