https://habr.com/ru/company/flant/blog/420055/
https://borgbackup.readthedocs.io/en/stable/installation.html
1. install borg on both backup server and client :
portsnap fetch update ; portmaster -Dbg archivers/py-borgbackup
2. Add user on server
# pw user add -n borg -m -s /sbin/nologin
3. on client generate ssh key :
# ssh-keygen -b 4096
4. on server add key :
# cd /home/borg//.ssh
# echo 'command="/usr/local/bin/borg serve" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNdaDfqUUf/XmSVWfF7PfjGlbKW00MJ63zal/E/mxm+vJIJRBw7GZofe1PeTpKcEUTiBBEsW9XUmTctnWE6p21gU/JNU0jITLx+vg4IlVP62cac71tkx1VJFMYQN6EulT0alYxagNwEs7s5cBlykeKk/QmteOOclzx684t9d6BhMvFE9w9r+c76aVBIdbEyrkloiYd+vzt79nRkFE4CoxkpvptMgrAgbx563fRmNSPH8H5dEad44/Xb5uARiYhdlIl45QuNSpAdcOadp46ftDeQCGLc4CgjMxessam+9ujYcUCjhFDNOoEa4YxVhXF9Tcv8Ttxolece6y+IQM7fbDR' > authorized_keys
# chown -R borg:borg /home/borg/.ssh/
5. on client init repo
# borg init -e none ssh:
6. on client run first backup :
# borg create --stats --list ssh://borg@host:port/path/to/backup::"MyFirstBackup-{now:%Y-%m-%d_%H:%M:%S}" /etc /root /usr/local/etc
------------------
List backups
on client machine :
borg list ssh://borg@host:port/path/to/backups
on server :
borg list /path/to/backups
-----------------
List files in backups :
borg list /path/to/backups::MyBackup-<date>
-------------
Extract file or directory from backup (on server) :
borg extract /path/to/backups::MyBackup-<date> etc/hostname
------------
in this case for zabbix database:
Convert tables from latin1 to utf-8 :
mysql zabbix -B -N -e 'show tables' | xargs -L 1 | awk '{print "ALTER TABLE "$1" CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin"}' | xargs -L 1 -I {} echo mysql zabbix -e \' {} \' | sh -x
convert database charset :
mysql -e 'ALTER DATABASE zabbix DEFAULT CHARACTER SET utf8 COLLATE utf8_bin'
After connecting pptp vpn dns servers recieved from vpn server are listed at the bottom of the list in /etc/resolv.conf and have lowest priority.
To make them have higher priority:
nmcli -p connection modify MY_VPN_CONNECTION ipv4.dns-priority -42
found this on:
based on https://wiki.mikrotik.com/wiki/Dynamic_DNS_Update_Script_for_No-IP_DNS
:local ddnsuser "<no-ip_username>"
:local ddnspass "<no-ip_pass>"
:local ddnshostname "<no-ip_host.ddns.net>"
:local ddnsinterface "<ddns_iface_name>"
# global variables definition
:global ddnslastip
#local vars definitions
:local ddnsip
#:local ddnsURL "http://dynupdate.no-ip.com/nic/update?hostname=$ddnshostname&myip=$ddnsip"
# base64 encoded string of username:password used
# https://www.noip.com/integrate/request
:local auth "Authorization:<base64 encoded string>"
:local useragent "User-Agent:Mikrotik-script <maintainer email>"
:local headers
:set $headers "$auth , $useragent"
:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }
:local ddnsip [ /ip address get [/ip address find interface=$ddnsinterface ] address ]
:if ([ :typeof $ddnsip ] = nil ) do={
:log info ("ServiceDNS: No ip address on $ddnsinterface .")
} else={
:for i from=( [:len $ddnsip] - 1) to=0 do={
:if ( [:pick $ddnsip $i] = "/") do={
:set ddnsip [:pick $ddnsip 0 $i];
}
}
}
:if ($ddnsip != $ddnslastip) do={
:log info ("ServiceDNS: $ddnshostname -> $ddnsip")
:local ddnsURL "http://dynupdate.no-ip.com/nic/update?hostname=$ddnshostname&myip=$ddnsip"
:local response [ /tool fetch url=$ddnsURL http-header-field=$headers as-value output=user ]
if ($response->"status" = "finished") do={
:local data ($response->"data");
:set $ddnslastip $ddnsip
:log info ("$ddnslastip")
:log info "DDNS: Update succeeded."
} else={
:log error "DDNS: Update failed.";
}
} else {
# :log info "DDNS: No IP change.";
}
}