Public Repository

Last pushed: 6 months ago
Short Description
Listen syslog messages and if someone do something download config from device
Full Description

Device Backup Service

Listen syslog messages and if someone do something download config from device

Service listen syslog messages and if find something like "User some_user logout" or "%SYS--CONFIG_I:", run python class backup.main.backup.send(msg).

msg — is value-pairs dict wich contains all variables from syslog message wich can be used for fomating data folders and stored config files.

Use volume from docerised TFTP and/or FTP server.

RUN

docker run -d --name tftpd -p 69/udp vkushnir/tftp-hpa
docker run -d --volumes-from tftpd --name device-backup -p 514/udp --link tftpd -v /data/config:/var/config -e SNMP_COMMUNITY="public" -e SRV_TFTP_ADDR="8.8.8.8" vkushnir/device-backup

Docker Variables

SNMP

  • SNMP_VERSION=2c — snmp version 1,2c,3

SNMP Version 1 or 2c specific

  • SNMP_COMMUNITY="public" — default community string

SNMP Version 3 specific

  • SNMP_APROTOCOL="MD5" — default authentication protocol (MD5|SHA)
  • SNMP_APASSPHRASE="pass" — default authentication protocol pass phrase
  • SNMP_SENGINE-ID="00000000" — default security engine ID (e.g. 800000020109840301)
  • SNMP_CENGINE-ID="00000000" — default context engine ID (e.g. 800000020109840301)
  • SNMP_LEVEL="noAuthNoPriv" — default security level (noAuthNoPriv|authNoPriv|authPriv)
  • SNMP_CONTEXT="backup" — default context name (e.g. bridge1)
  • SNMP_USER-NAME="backup" — default security name (e.g. bert)
  • SNMP_PPROTOCOL="DES" — default privacy protocol (DES|AES)
  • SNMP_PPASSPHRASE="pass" — default privacy protocol pass phrase
  • SNMP_BOOTS="" — default destination engine boots/time

SNMP Others

  • SNMP_TIMEOUT=3 — timeout in seconds to wait snmp device answer
  • SNMP_RETRIES=1 — count retry requests from snmp device
  • MIBS_PATH="/usr/local/share/snmp/mibs" — path to additional Asn1 mib modules
  • PySNMP_MIBS_PATH="/usr/local/share/snmp/pysnmp_mibs" — path to additional PySNMP compiled mib modules
  • PySNMP_MIBS_PATH="/usr/local/share/snmp/pysnmp_mibs" — path to additional PySNMP compiled mib modules

Device configuration store settings

  • CONFIG_COMPARE=1 — compare downloaded config with previous in the same folder
  • CONFIG_NODUP=1 — don't store config if previous is the same (require CONFIG_COMPARE=1)
  • CONFIG_DIFF_OPT="-iEZbBu" — options for linux diff
  • CONFIG_FOLDER="/var/config/{syslog[R_YEAR]}/{l0ip}/{syslog[R_YEAR]}-{syslog[R_MONTH]}" — template for config folder
  • CONFIGFILE="**{l0ip}{syslog[R_YEAR]}{syslog[R_MONTH]}{syslog[RDAY]}{n:02}.conf**" — template for config file
  • CONFIGDIFF="**{l0ip}{syslog[R_YEAR]}{syslog[R_MONTH]}{syslog[R_DAY]}.diff**" — template for different file

    format using str.format(msg=<syslog-ng_message[]>, l0ip=<leading zero source ip (172.000.000.001)>, n=<count fies with
    same name>)

Database

  • DB_FILE="devices.db" — SQLite database file name
  • DB_PATH="/var/sqlite" — SQLite database file location
  • DB_MEMORY=1 — Load full database to memory on init stage
  • DB_SAVE=1 — Save database to disk on uninit stage (require DB_MEMORY=1)

Server

  • SRV_SLEEP=60not yet reliased
  • SRV_SAVE_TIMEOUT=15 — Timeout for waiting tftp transfer from device
  • SRV_THREADS=10 — Maximum count simultaneous threads (not yet reliased)
  • SRV_HITS=10 — Maximum hits for single device before generate error message (not yet reliased)
  • SRV_TFTP_ADDR="172.0.0.1" — Default external TFTP server address
  • SRV_TFTP_PATH="/var/tftp" — Default TFTP server volume location
  • SRV_FTP_ADDR="172.0.0.1" — Default external FTP server address
  • SRV_FTP_PATH="/var/ftp" — Default FTP server volume location

Others

  • PYTHONPATH="/usr/local/lib/python" — path to user python modules

Docker Volumes

  • /usr/local/bin — folder for python executables
  • /usr/local/lib/python — Python modules
  • /usr/local/share/snmp/mibs — ASN1 mib files
  • /usr/local/share/snmp/pysnmp_mibs — PySNMP compiled modules
  • /etc/syslog-ng — Syslog-ng configuration folder
  • /etc/dev-backup — Device backup configuration folder
  • /var/config — Downloaded config files
  • /var/tftp — TFTP folder
  • /var/ftp — FTP folder
  • /var/sqlite — SQL folder
Docker Pull Command
Owner
vkushnir

Comments (0)