SecurityCamBot

command module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2022 License: BSD-2-Clause Imports: 10 Imported by: 0

README

SecurityCamBot

Telegram bot for managing webcams and receiving alerts from then.

Install

Add Widmaker repo ans install windmaker-security-cam-bot:

wget -O - https://packages.windmaker.net/WINDMAKER-GPG-KEY.pub | sudo apt-key add -
sudo add-apt-repository "deb http://packages.windmaker.net/ focal main"
sudo apt-get update
sudo apt-get install windmaker-security-cam-bot

Allowed actions

For the time being, webcams can be rebooted only.

Configuration

This bot uses a config file which folder location is defined by environment variable SECURITY_CAM_BOT_CONFIG_FILE_LOCATION, inside this folder it must exists a file called config.toml.

[telegram_bot]
token = "token"

[telegram_bot.allowed_senders]
[telegram_bot.allowed_senders.alice]
name = "Alice"
id = 12

[telegram_bot.allowed_senders.bob]
name = "Bob"
id = 13

[webcams]
[webcams.cam01]
name= "cam1"
ip = "10.10.10.34"
user = "user"
password = "pass"

[webcams.cam02]
name= "cam2"
ip = "10.10.10.35"
user = "user"
password = "pass"

[rabbitmq]
host = "localhost"
port = 5672
user = "guest"
password = "guest"

[queues]
[queues.send_sanpshot_commands]
name = "sendsnapshotjobs"

[queues.receive_sanpshot]
name = "snapshots"

Config files must include the following sections:

telegram_bot

Defines telegram bot config:

  • token -> bot token
  • allowed_senders -> list of telegram users allowed to interact with this bot.
    • id -> user ID
    • name -> user name
Webcams

Webcams to manage must be set in this section.

  • name -> Name for identifying the webcam
  • ip -> Webcam IP
  • user -> Webcam user
  • password -> Webcam password
Rabbitmq

Snapshot jobs are sended to WebCamSnapshotWorker through Rabbitmq queues.

  • host -> Rabbitmq host
  • port -> Rabbitmq port
  • user -> Rabbitmq user
  • password -> User's password
Queues

This bots requires tew queues for the time being, each queue needs a name.

  • send_sanpshot_commands -> Queue for sending snapshot jobs.
  • receive_sanpshot -> Queue for receiving finnished snapshot jobs from WebCamSnapshotWorker

Systemd service setup

After saving config in /etc/windmaker-security-cam-bot/config.toml systemd service can be enabled:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable windmaker-security-cam-bot
sudo /bin/systemctl start windmaker-security-cam-bot

Logging

This bot writes logs to syslog:

Dec  5 15:51:29 metatron security-cam-bot[8220]: Blocked message received from sender 112897183.
Dec  5 15:56:40 metatron security-cam-bot[8962]: /hello received from sender Bob.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL