1. intro

get the latest backup, sample: 06=sat

mkdir -p backup
curl -s http://d01cid.ddns.net/log/d03.net/srv002/sbu/06.tgz | tar xz -C backup/
Tip 00=sun, 01=mon, 02=tue, 03=wed, 04=thu, 05=fri, 06=sat

2. restore some files

unalias cp
cp -p backup/boot/config.txt /boot/
cp -p backup/etc/cid.conf /etc/
cp -p backup/etc/3proxy.cfg /etc/
cp -p backup/etc/rc.local /etc/
cp -p backup/etc/cron.d/cid-cron /etc/cron.d/
cp -p backup/bin/cid-cron* /bin/
cp -p backup/bin/cid-daily /bin/
cp -p backup/bin/cid-hourly /bin/
cp -p backup/data1/var/log/ipl.log /data1/var/log/
source /etc/cid.conf

3. httpd

curl -s http://${rdsserver}/sharel/bin/inst-httpd | sh
rsync -ai backup/var/www/html/ /var/www/html/
systemctl reload httpd.service

4. mariadb

curl -s http://${rdsserver}/sharel/bin/inst-mariadb-server | sh
mysql -u'root' -p'Passw0rd' -e "create database if not exists cid;"
mysql -u'root' -p'Passw0rd' cid < backup/sql/cid.sql

5. dns and dhcp

tarname="dhcp-20181105.tgz"
curl -s http://${rdsserver}/sharel/tar/${tarname} | tar xz -C /
wget -N -nv http://${rdsserver}/sharel/etc/httpd/conf.d/dhcp.conf -P /etc/httpd/conf.d/
cube /etc/httpd/conf.d/dhcp.conf "%dnsdomainname%" with "$(dnsdomainname)"
cp -puv /opt/dhcp/etc/sudoers.d/http /etc/sudoers.d/
chown root:root /etc/sudoers.d/http
chmod 400 /etc/sudoers.d/http
systemctl reload httpd.service
yum -y install dhcp
cp -pv backup/etc/dhcp/dhcpd.conf /etc/dhcp/
wget -N -nv http://${rdsserver}/sharel/etc/dhcp/dhcpd-commit.conf -P /etc/dhcp/
wget -N -nv http://${rdsserver}/sharel/etc/dhcp/dhcpd-wpad.conf -P /etc/dhcp/
systemctl enable dhcpd.service
curl http://${rdsserver}/sharel/bin/inst-cloudflare | sh
curl -s http://${rdsserver}/sharel/bin/inst-pihole | sh
sed -i 's/server.port.*/server.port = 8080/' /etc/lighttpd/lighttpd.conf
systemctl stop lighttpd.service
systemctl disable lighttpd.service
systemctl enable pihole-FTL.service
/bin/cid-updates
/bin/cid-dhcp-dns-hosts-files
/opt/dhcp/bin/ss-dhcp-dns; systemctl stop dhcpd.service
sed -i 's/nameserver.*/nameserver 127.0.0.1/' /etc/resolv.conf

6. ldap

curl -s http://${rdsserver}/sharel/bin/inst-ldap | sh
ldapdelete -x -D cn=root -w Passw0rd -r ou=groups,dc=d03,dc=net
ldapdelete -x -D cn=root -w Passw0rd -r ou=users,dc=d03,dc=net
ldapadd -x -D cn=root -w Passw0rd -f backup/ldif/groups.ldif
ldapadd -x -D cn=root -w Passw0rd -f backup/ldif/users.ldif

7. vpn

curl -s http://${rdsserver}/sharel/bin/inst-openvpn | sh
cube /etc/openvpn/server.conf "DNS 10.3.1.1" with "DNS 10.3.1.2"

8. firewall

cp -p backup/etc/rfwd.conf /etc/
cid-rfwd

9. tunnel

yum -y install 3proxy
systemctl enable 3proxy.service ss-rtunnel.service
systemctl restart 3proxy.service ss-rtunnel.service