scriptsrc / homelab

My own homelab scripts. Mostly for playing around.
0 stars 1 forks source link

Make opencanary a systemd service. #1

Open scriptsrc opened 1 year ago

scriptsrc commented 1 year ago

https://github.com/thinkst/opencanary/wiki#how-do-i-start-opencanary-on-startup

Relevant code: https://github.com/scriptsrc/homelab/blob/main/packer/proxmox/ubuntu-server-jammy-docker/ubuntu-server-jammy-docker.pkr.hcl#L171-L190

scriptsrc commented 1 year ago

Added an opencanary.service. I’ll need to rebuild the VM to test this out.

tinder-patrickkelley commented 1 year ago

Does not seem to have worked:

root@tailscale-subnet-router:/home/canary/.local/bin# service --status-all
 [ + ]  apparmor
 [ + ]  apport
 [ - ]  console-setup.sh
 [ + ]  cron
 [ - ]  cryptdisks
 [ - ]  cryptdisks-early
 [ + ]  dbus
 [ + ]  docker
 [ - ]  grub-common
 [ - ]  hwclock.sh
 [ + ]  irqbalance
 [ - ]  iscsid
 [ - ]  keyboard-setup.sh
 [ + ]  kmod
 [ - ]  lvm2
 [ - ]  lvm2-lvmpolld
 [ + ]  multipath-tools
 [ - ]  open-iscsi
 [ - ]  open-vm-tools
 [ - ]  osqueryd
 [ + ]  plymouth
 [ + ]  plymouth-log
 [ + ]  procps
 [ + ]  qemu-guest-agent
 [ - ]  rsync
 [ - ]  screen-cleanup
 [ + ]  ssh
 [ + ]  udev
 [ + ]  ufw
 [ + ]  unattended-upgrades
 [ - ]  uuidd
 [ - ]  x11-common

root@tailscale-subnet-router:/home/canary/.local/bin# file /etc/systemd/system/opencanary.service
/etc/systemd/system/opencanary.service: ASCII text

root@tailscale-subnet-router:/home/canary/.local/bin# head /etc/systemd/system/opencanary.service
[Unit]
Description=OpenCanary
After=syslog.target
After=network-online.target

[Service]
User=root
Type=oneshot
RemainAfterExit=yes
Restart=always

root@tailscale-subnet-router:/home/canary/.local/bin# ls -al /etc/systemd/system/opencanary.service
-rw-r--r-- 1 root root 286 Jan  1 05:23 /etc/systemd/system/opencanary.service

root@tailscale-subnet-router:/home/canary/.local/bin# ps agux | grep -i canary
root       16408  0.0  0.0   6608  2336 pts/1    S+   09:33   0:00 grep --color=auto -i canary