https://github.com/sjdiego/znc-files
A very custom deployment to run a ZNC instance and backup its logs into S3 bucket
https://github.com/sjdiego/znc-files
s3 s3-bucket znc
Last synced: 8 months ago
JSON representation
A very custom deployment to run a ZNC instance and backup its logs into S3 bucket
- Host: GitHub
- URL: https://github.com/sjdiego/znc-files
- Owner: sjdiego
- License: unlicense
- Created: 2022-11-05T17:25:59.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-01-02T16:24:50.000Z (over 3 years ago)
- Last Synced: 2025-01-14T15:20:57.521Z (over 1 year ago)
- Topics: s3, s3-bucket, znc
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ZNC config files
Repository of files to have a ZNC instance and backup log files into S3 bucket.
## Requirements
- Python3
- Docker
- OpenSSL (1.1.1)
- aws-cli
- AWS account with S3 permissions
- [Healthchecks.io](https://www.healthchecks.io) account
## How to start ZNC
Just start it with docker using the following command:
- `docker-compose up`
## How to backup log files
Before using the backup log script you should have aws-cli already configured and authenticated, and a ping endpoint in healthchecks.io
The backup script performs the following operations:
- Checks for the required parameters
- Removes old log files (it should be already backup'd) and empty directories
- Looks for newest log files and creates a tar.gz file in /tmp
- Encrypts tar file with password provided in env var
- Uploads tar.gz file to S3 bucket
- Confirms operation to Healthchecks.io
## Deployment of S3 bucket using Cloudformation
Execute the following command:
- `aws cloudformation deploy --stack-name --template-file stack.yml --capabilities CAPABILITY_IAM`
## Create a cronjob for backup
Rename cronjob.example.sh, modify it with encryption password, chmod +x it and add an entry into your cron file like this:
- `0 2 * * MON ~/znc/cronjob.sh >> ~/znc/backup.log 2>&1`
## How to decrypt backup log file
Execute the following commands:
```
$ export ENCRYPTION_PASS=
$ openssl enc -aes-256-cbc \
-md sha512 -iter 100000 \
-pbkdf2 -salt \
-d \
-in \
-out unencrypted.tar.gz \
-pass env:ENCRYPTION_PASS
$ unset ENCRYPTION_PASS
```