1. intro

13mar2023

get the latest backup, sample:

mkdir -p backup
curl -ns http://d01cid.ddns.net/log/d01.net/srv002/sbu/03.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 -ns http://${rdsserver}/sharel/bin/inst-httpd | sh
rsync -ai backup/var/www/html/ /var/www/html/

4. mariadb

curl -ns 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
mysql -u'root' -p'Passw0rd' -e "create database if not exists warpit;"
mysql -u'root' -p'Passw0rd' warpit < backup/sql/warpit.sql
mysql -u'root' -p'Passw0rd' -e "create database if not exists insdb;"
mysql -u'root' -p'Passw0rd' insdb < backup/sql/insdb.sql

5. dns and dhcp

tarname="dhcp-20221001.tgz"
curl -ns http://${rdsserver}/sharel/img/dhcp/${tarname} | tar xzP -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-server
rsync -ai backup/etc/dhcp/ /etc/dhcp/
systemctl enable dhcpd.service
curl -ns http://${rdsserver}/sharel/bin/inst-pihole | sh
/bin/cid-updates
/bin/cid-dhcp-dns-hosts-files
/opt/dhcp/bin/ss-dhcp-dns
systemctl stop dhcpd.service

6. ldap

curl -ns http://${rdsserver}/sharel/bin/inst-ldap | sh
ldapdelete -x -D cn=root -w Passw0rd -r ou=groups,dc=d01,dc=net
ldapdelete -x -D cn=root -w Passw0rd -r ou=users,dc=d01,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. firewall

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

8. vpn

rpm -q -quiet iptables || yum -y install iptables
curl -ns http://${rdsserver}/sharel/bin/inst-openvpn | sh
cube /etc/openvpn/server.conf "DNS 10.1.1.1" with "DNS 10.1.1.2"

9. tftp

yum -y install tftp-server
systemctl enable --now tftp.socket