Initial backup import
This commit is contained in:
17
etc/fstab
Normal file
17
etc/fstab
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# /etc/fstab: static file system information.
|
||||||
|
#
|
||||||
|
# Use 'blkid' to print the universally unique identifier for a
|
||||||
|
# device; this may be used with UUID= as a more robust way to name devices
|
||||||
|
# that works even if disks are added and removed. See fstab(5).
|
||||||
|
#
|
||||||
|
# systemd generates mount units based on this file, see systemd.mount(5).
|
||||||
|
# Please run 'systemctl daemon-reload' after making changes here.
|
||||||
|
#
|
||||||
|
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||||
|
# / was on /dev/sda2 during installation
|
||||||
|
UUID=9c56b6fd-2a60-4480-b82f-240da2e66acc / ext4 errors=remount-ro 0 1
|
||||||
|
# /boot/efi was on /dev/sda1 during installation
|
||||||
|
UUID=C863-7654 /boot/efi vfat umask=0077 0 1
|
||||||
|
# swap was on /dev/sda3 during installation
|
||||||
|
UUID=da855cd2-3dc7-490d-a9c9-9c6b473b5e8b none swap sw 0 0
|
||||||
|
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
|
||||||
7
etc/hosts
Normal file
7
etc/hosts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
127.0.0.1 localhost
|
||||||
|
127.0.1.1 debian
|
||||||
|
|
||||||
|
# The following lines are desirable for IPv6 capable hosts
|
||||||
|
::1 localhost ip6-localhost ip6-loopback
|
||||||
|
ff02::1 ip6-allnodes
|
||||||
|
ff02::2 ip6-allrouters
|
||||||
15
etc/network/interfaces
Normal file
15
etc/network/interfaces
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# This file describes the network interfaces available on your system
|
||||||
|
# and how to activate them. For more information, see interfaces(5).
|
||||||
|
|
||||||
|
source /etc/network/interfaces.d/*
|
||||||
|
|
||||||
|
# The loopback network interface
|
||||||
|
auto lo
|
||||||
|
iface lo inet loopback
|
||||||
|
|
||||||
|
# The primary network interface
|
||||||
|
auto ens18
|
||||||
|
iface ens18 inet static
|
||||||
|
address 192.168.199.5
|
||||||
|
netmask 255.255.255.0
|
||||||
|
gateway 192.168.199.170
|
||||||
21
etc/nsswitch.conf
Normal file
21
etc/nsswitch.conf
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# /etc/nsswitch.conf
|
||||||
|
#
|
||||||
|
# Example configuration of GNU Name Service Switch functionality.
|
||||||
|
# If you have the `glibc-doc-reference' and `info' packages installed, try:
|
||||||
|
# `info libc "Name Service Switch"' for information about this file.
|
||||||
|
|
||||||
|
passwd: files systemd sss winbind
|
||||||
|
group: files systemd sss winbind
|
||||||
|
shadow: files systemd sss
|
||||||
|
gshadow: files systemd
|
||||||
|
|
||||||
|
hosts: files dns
|
||||||
|
networks: files
|
||||||
|
|
||||||
|
protocols: db files
|
||||||
|
services: db files sss
|
||||||
|
ethers: db files
|
||||||
|
rpc: db files
|
||||||
|
|
||||||
|
netgroup: nis sss
|
||||||
|
automount: sss
|
||||||
55
etc/samba/smb.conf
Normal file
55
etc/samba/smb.conf
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# Global parameters
|
||||||
|
[global]
|
||||||
|
kerberos method = secrets and keytab
|
||||||
|
log file = /var/log/samba/log.%m
|
||||||
|
logging = file
|
||||||
|
map to guest = Bad User
|
||||||
|
max log size = 1000
|
||||||
|
obey pam restrictions = No
|
||||||
|
pam password change = Yes
|
||||||
|
panic action = /usr/share/samba/panic-action %d
|
||||||
|
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
|
||||||
|
passwd program = /usr/bin/passwd %u
|
||||||
|
realm = FOCUS-ON-IT.DE
|
||||||
|
security = ADS
|
||||||
|
template shell = /bin/bash
|
||||||
|
unix password sync = Yes
|
||||||
|
usershare allow guests = Yes
|
||||||
|
winbind use default domain = Yes
|
||||||
|
workgroup = FOCUS-ON-IT
|
||||||
|
idmap config focus-on-it : range = 20001-999999
|
||||||
|
idmap config focus-on-it : backend = rid
|
||||||
|
idmap config * : range = 10000-20000
|
||||||
|
idmap config * : backend = tdb
|
||||||
|
|
||||||
|
|
||||||
|
[homes]
|
||||||
|
browseable = No
|
||||||
|
comment = Home Directories
|
||||||
|
create mask = 0700
|
||||||
|
directory mask = 0700
|
||||||
|
valid users = %S
|
||||||
|
|
||||||
|
|
||||||
|
[printers]
|
||||||
|
browseable = No
|
||||||
|
comment = All Printers
|
||||||
|
create mask = 0700
|
||||||
|
path = /var/tmp
|
||||||
|
printable = Yes
|
||||||
|
|
||||||
|
|
||||||
|
[print$]
|
||||||
|
comment = Printer Drivers
|
||||||
|
path = /var/lib/samba/printers
|
||||||
|
|
||||||
|
|
||||||
|
[Nextcloud-Homes]
|
||||||
|
path = /srv/nextcloud-data/%U
|
||||||
|
read only = no
|
||||||
|
browseable = no
|
||||||
|
|
||||||
|
create mask = 0700
|
||||||
|
directory mask = 0700
|
||||||
|
|
||||||
|
valid users = %U
|
||||||
1
etc/systemd/system/chronyd.service
Symbolic link
1
etc/systemd/system/chronyd.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/chrony.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/cloud-init-hotplugd.socket
|
||||||
1
etc/systemd/system/cloud-init.target.wants/cloud-config.service
Symbolic link
1
etc/systemd/system/cloud-init.target.wants/cloud-config.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/cloud-config.service
|
||||||
1
etc/systemd/system/cloud-init.target.wants/cloud-final.service
Symbolic link
1
etc/systemd/system/cloud-init.target.wants/cloud-final.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/cloud-final.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/cloud-init-local.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/cloud-init-main.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/cloud-init-network.service
|
||||||
1
etc/systemd/system/dbus-org.freedesktop.timesync1.service
Symbolic link
1
etc/systemd/system/dbus-org.freedesktop.timesync1.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/systemd-timesyncd.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/wtmpdb-update-boot.service
|
||||||
1
etc/systemd/system/getty.target.wants/getty@tty1.service
Symbolic link
1
etc/systemd/system/getty.target.wants/getty@tty1.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/getty@.service
|
||||||
1
etc/systemd/system/hibernate.target.wants/grub-common.service
Symbolic link
1
etc/systemd/system/hibernate.target.wants/grub-common.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/grub-common.service
|
||||||
1
etc/systemd/system/hybrid-sleep.target.wants/grub-common.service
Symbolic link
1
etc/systemd/system/hybrid-sleep.target.wants/grub-common.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/grub-common.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/chrony.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/chrony.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/chrony.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/console-setup.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/console-setup.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/console-setup.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/cron.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/cron.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/cron.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/e2scrub_reap.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/e2scrub_reap.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/e2scrub_reap.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/fail2ban.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/fail2ban.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/fail2ban.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/grub-common.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/grub-common.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/grub-common.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/networking.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/networking.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/networking.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/nmbd.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/nmbd.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/nmbd.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/oddjobd.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/oddjobd.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/oddjobd.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/remote-fs.target
Symbolic link
1
etc/systemd/system/multi-user.target.wants/remote-fs.target
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/remote-fs.target
|
||||||
1
etc/systemd/system/multi-user.target.wants/rsyslog.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/rsyslog.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/rsyslog.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/samba-ad-dc.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/samba-ad-dc.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/samba-ad-dc.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/smbd.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/smbd.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/smbd.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/ssh.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/ssh.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/ssh.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/sssd.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/sssd.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sssd.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/unattended-upgrades.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/winbind.service
Symbolic link
1
etc/systemd/system/multi-user.target.wants/winbind.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/winbind.service
|
||||||
1
etc/systemd/system/multi-user.target.wants/zfs.target
Symbolic link
1
etc/systemd/system/multi-user.target.wants/zfs.target
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/zfs.target
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/networking.service
|
||||||
1
etc/systemd/system/nmb.service
Symbolic link
1
etc/systemd/system/nmb.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/nmbd.service
|
||||||
1
etc/systemd/system/samba.service
Symbolic link
1
etc/systemd/system/samba.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/samba-ad-dc.service
|
||||||
1
etc/systemd/system/smb.service
Symbolic link
1
etc/systemd/system/smb.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/smbd.service
|
||||||
1
etc/systemd/system/ssh.service.wants/sshd-keygen.service
Symbolic link
1
etc/systemd/system/ssh.service.wants/sshd-keygen.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sshd-keygen.service
|
||||||
1
etc/systemd/system/ssh.socket.wants/sshd-keygen.service
Symbolic link
1
etc/systemd/system/ssh.socket.wants/sshd-keygen.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sshd-keygen.service
|
||||||
1
etc/systemd/system/sshd.service
Symbolic link
1
etc/systemd/system/sshd.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/ssh.service
|
||||||
1
etc/systemd/system/sshd.service.wants/sshd-keygen.service
Symbolic link
1
etc/systemd/system/sshd.service.wants/sshd-keygen.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sshd-keygen.service
|
||||||
1
etc/systemd/system/sshd@.service.wants/sshd-keygen.service
Symbolic link
1
etc/systemd/system/sshd@.service.wants/sshd-keygen.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sshd-keygen.service
|
||||||
1
etc/systemd/system/sssd.service.wants/sssd-autofs.socket
Symbolic link
1
etc/systemd/system/sssd.service.wants/sssd-autofs.socket
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sssd-autofs.socket
|
||||||
1
etc/systemd/system/sssd.service.wants/sssd-nss.socket
Symbolic link
1
etc/systemd/system/sssd.service.wants/sssd-nss.socket
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sssd-nss.socket
|
||||||
1
etc/systemd/system/sssd.service.wants/sssd-pac.socket
Symbolic link
1
etc/systemd/system/sssd.service.wants/sssd-pac.socket
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sssd-pac.socket
|
||||||
1
etc/systemd/system/sssd.service.wants/sssd-pam.socket
Symbolic link
1
etc/systemd/system/sssd.service.wants/sssd-pam.socket
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sssd-pam.socket
|
||||||
1
etc/systemd/system/sssd.service.wants/sssd-ssh.socket
Symbolic link
1
etc/systemd/system/sssd.service.wants/sssd-ssh.socket
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sssd-ssh.socket
|
||||||
1
etc/systemd/system/sssd.service.wants/sssd-sudo.socket
Symbolic link
1
etc/systemd/system/sssd.service.wants/sssd-sudo.socket
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sssd-sudo.socket
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/grub-common.service
|
||||||
1
etc/systemd/system/suspend.target.wants/grub-common.service
Symbolic link
1
etc/systemd/system/suspend.target.wants/grub-common.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/grub-common.service
|
||||||
1
etc/systemd/system/sysinit.target.wants/apparmor.service
Symbolic link
1
etc/systemd/system/sysinit.target.wants/apparmor.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/apparmor.service
|
||||||
1
etc/systemd/system/sysinit.target.wants/keyboard-setup.service
Symbolic link
1
etc/systemd/system/sysinit.target.wants/keyboard-setup.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/keyboard-setup.service
|
||||||
1
etc/systemd/system/sysinit.target.wants/systemd-pstore.service
Symbolic link
1
etc/systemd/system/sysinit.target.wants/systemd-pstore.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/systemd-pstore.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/systemd-timesyncd.service
|
||||||
1
etc/systemd/system/syslog.service
Symbolic link
1
etc/systemd/system/syslog.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/rsyslog.service
|
||||||
1
etc/systemd/system/timers.target.wants/apt-daily-upgrade.timer
Symbolic link
1
etc/systemd/system/timers.target.wants/apt-daily-upgrade.timer
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/lib/systemd/system/apt-daily-upgrade.timer
|
||||||
1
etc/systemd/system/timers.target.wants/apt-daily.timer
Symbolic link
1
etc/systemd/system/timers.target.wants/apt-daily.timer
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/lib/systemd/system/apt-daily.timer
|
||||||
1
etc/systemd/system/timers.target.wants/dpkg-db-backup.timer
Symbolic link
1
etc/systemd/system/timers.target.wants/dpkg-db-backup.timer
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/lib/systemd/system/dpkg-db-backup.timer
|
||||||
1
etc/systemd/system/timers.target.wants/e2scrub_all.timer
Symbolic link
1
etc/systemd/system/timers.target.wants/e2scrub_all.timer
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/e2scrub_all.timer
|
||||||
1
etc/systemd/system/timers.target.wants/fstrim.timer
Symbolic link
1
etc/systemd/system/timers.target.wants/fstrim.timer
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/lib/systemd/system/fstrim.timer
|
||||||
1
etc/systemd/system/timers.target.wants/logrotate.timer
Symbolic link
1
etc/systemd/system/timers.target.wants/logrotate.timer
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/logrotate.timer
|
||||||
1
etc/systemd/system/timers.target.wants/man-db.timer
Symbolic link
1
etc/systemd/system/timers.target.wants/man-db.timer
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/man-db.timer
|
||||||
1
etc/systemd/system/zed.service
Symbolic link
1
etc/systemd/system/zed.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/zfs-zed.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/zfs-import-cache.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/zfs-load-module.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/zfs-volume-wait.service
|
||||||
1
etc/systemd/system/zfs.target.wants/zfs-import.target
Symbolic link
1
etc/systemd/system/zfs.target.wants/zfs-import.target
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/zfs-import.target
|
||||||
1
etc/systemd/system/zfs.target.wants/zfs-load-module.service
Symbolic link
1
etc/systemd/system/zfs.target.wants/zfs-load-module.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/zfs-load-module.service
|
||||||
1
etc/systemd/system/zfs.target.wants/zfs-mount.service
Symbolic link
1
etc/systemd/system/zfs.target.wants/zfs-mount.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/zfs-mount.service
|
||||||
1
etc/systemd/system/zfs.target.wants/zfs-share.service
Symbolic link
1
etc/systemd/system/zfs.target.wants/zfs-share.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/zfs-share.service
|
||||||
1
etc/systemd/system/zfs.target.wants/zfs-volumes.target
Symbolic link
1
etc/systemd/system/zfs.target.wants/zfs-volumes.target
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/zfs-volumes.target
|
||||||
1
etc/systemd/system/zfs.target.wants/zfs-zed.service
Symbolic link
1
etc/systemd/system/zfs.target.wants/zfs-zed.service
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/zfs-zed.service
|
||||||
5
root/.ssh/config
Normal file
5
root/.ssh/config
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Host gitea
|
||||||
|
HostName git.focus-on-it.net
|
||||||
|
User git
|
||||||
|
Port 2222
|
||||||
|
IdentityFile /root/.ssh/id_ed25519
|
||||||
267
root/backup-config/backup-config.sh
Executable file
267
root/backup-config/backup-config.sh
Executable file
@@ -0,0 +1,267 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Einstellungen
|
||||||
|
########################################
|
||||||
|
|
||||||
|
SOURCE_LIST="/root/backup-config/sources.txt"
|
||||||
|
BACKUP_ROOT="/root/backup-config/backup"
|
||||||
|
LOGFILE="/var/log/backup-config.log"
|
||||||
|
|
||||||
|
# Git
|
||||||
|
USE_GIT="yes"
|
||||||
|
GIT_BRANCH="DockerDMZ_Configfiles"
|
||||||
|
|
||||||
|
# Verzeichnisse, die automatisch nach Config-Dateien durchsucht werden
|
||||||
|
AUTO_SCAN_DIRS=(
|
||||||
|
"/root/docker"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Dateitypen, die automatisch erkannt werden
|
||||||
|
AUTO_FILE_TYPES=(
|
||||||
|
"*.sh"
|
||||||
|
"*.yml"
|
||||||
|
"*.yaml"
|
||||||
|
"*.env"
|
||||||
|
"*.conf"
|
||||||
|
"*.cnf"
|
||||||
|
"*.ini"
|
||||||
|
"*.json"
|
||||||
|
"*.toml"
|
||||||
|
"*.service"
|
||||||
|
"Dockerfile"
|
||||||
|
"docker-compose.yml"
|
||||||
|
"compose.yml"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Pfade, die beim automatischen Scan ausgeschlossen werden
|
||||||
|
EXCLUDES=(
|
||||||
|
"*/data/pages/*"
|
||||||
|
"*/data/media/*"
|
||||||
|
"*/data/cache/*"
|
||||||
|
"*/data/tmp/*"
|
||||||
|
"*/logs/*"
|
||||||
|
"*/log/*"
|
||||||
|
"*/db/*"
|
||||||
|
"*/database/*"
|
||||||
|
"*/mysql/*"
|
||||||
|
"*/mariadb/*"
|
||||||
|
"*/postgres/*"
|
||||||
|
"*/redis/*"
|
||||||
|
"*/.git/*"
|
||||||
|
)
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Logging
|
||||||
|
########################################
|
||||||
|
|
||||||
|
log() {
|
||||||
|
printf '%s %s\n' "$(date '+%F %T')" "$1" | tee -a "$LOGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Hilfsfunktionen
|
||||||
|
########################################
|
||||||
|
|
||||||
|
is_excluded() {
|
||||||
|
local path="$1"
|
||||||
|
local ex
|
||||||
|
|
||||||
|
for ex in "${EXCLUDES[@]}"; do
|
||||||
|
if [[ "$path" == $ex ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_path() {
|
||||||
|
local src="$1"
|
||||||
|
local rel
|
||||||
|
local dst
|
||||||
|
|
||||||
|
if is_excluded "$src"; then
|
||||||
|
log "SKIP (exclude): $src"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "$src" ]]; then
|
||||||
|
rel="${src#/}"
|
||||||
|
dst="$BACKUP_ROOT/$rel"
|
||||||
|
|
||||||
|
mkdir -p "$(dirname "$dst")"
|
||||||
|
cp -a "$src" "$dst"
|
||||||
|
log "OK (FILE): $src -> $dst"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d "$src" ]]; then
|
||||||
|
rel="${src#/}"
|
||||||
|
dst="$BACKUP_ROOT/$rel"
|
||||||
|
|
||||||
|
mkdir -p "$(dirname "$dst")"
|
||||||
|
cp -a "$src" "$dst"
|
||||||
|
log "OK (DIR): $src -> $dst"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "WARN: Pfad nicht gefunden: $src"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Automatischer Scan
|
||||||
|
########################################
|
||||||
|
|
||||||
|
auto_scan() {
|
||||||
|
local dir
|
||||||
|
local file
|
||||||
|
local find_expr=()
|
||||||
|
|
||||||
|
log "INFO: Starte automatischen Scan"
|
||||||
|
|
||||||
|
# find-Ausdruck für Dateitypen bauen
|
||||||
|
for pattern in "${AUTO_FILE_TYPES[@]}"; do
|
||||||
|
find_expr+=( -name "$pattern" -o )
|
||||||
|
done
|
||||||
|
unset 'find_expr[${#find_expr[@]}-1]'
|
||||||
|
|
||||||
|
for dir in "${AUTO_SCAN_DIRS[@]}"; do
|
||||||
|
if [[ ! -d "$dir" ]]; then
|
||||||
|
log "WARN: Auto-Scan-Verzeichnis fehlt: $dir"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
while IFS= read -r file; do
|
||||||
|
if is_excluded "$file"; then
|
||||||
|
log "SKIP (exclude): $file"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
copy_path "$file" || true
|
||||||
|
done < <(
|
||||||
|
find "$dir" -type f \( "${find_expr[@]}" \) 2>/dev/null | sort -u
|
||||||
|
)
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Git
|
||||||
|
########################################
|
||||||
|
|
||||||
|
git_prepare_repo() {
|
||||||
|
if [[ "$USE_GIT" != "yes" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v git >/dev/null 2>&1; then
|
||||||
|
log "ERROR: Git ist nicht installiert"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$BACKUP_ROOT"
|
||||||
|
|
||||||
|
if [[ ! -d "$BACKUP_ROOT/.git" ]]; then
|
||||||
|
log "INFO: Git-Repository wird initialisiert"
|
||||||
|
git -C "$BACKUP_ROOT" init
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Benutzerinfo prüfen
|
||||||
|
if ! git -C "$BACKUP_ROOT" config user.name >/dev/null; then
|
||||||
|
log "WARN: Git user.name ist im Repository nicht gesetzt"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git -C "$BACKUP_ROOT" config user.email >/dev/null; then
|
||||||
|
log "WARN: Git user.email ist im Repository nicht gesetzt"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
git_checkout_branch() {
|
||||||
|
local branch="$1"
|
||||||
|
|
||||||
|
if [[ "$USE_GIT" != "yes" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$branch" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if git -C "$BACKUP_ROOT" show-ref --verify --quiet "refs/heads/$branch"; then
|
||||||
|
git -C "$BACKUP_ROOT" checkout "$branch" >/dev/null 2>&1
|
||||||
|
log "INFO: Git-Branch aktiviert: $branch"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wenn noch gar kein Commit existiert, zuerst initialen Commit anlegen
|
||||||
|
if ! git -C "$BACKUP_ROOT" rev-parse --verify HEAD >/dev/null 2>&1; then
|
||||||
|
git -C "$BACKUP_ROOT" add -A
|
||||||
|
if ! git -C "$BACKUP_ROOT" diff --cached --quiet; then
|
||||||
|
git -C "$BACKUP_ROOT" commit -m "Initial backup import"
|
||||||
|
log "INFO: Initialer Commit erstellt"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
git -C "$BACKUP_ROOT" checkout -b "$branch" >/dev/null 2>&1
|
||||||
|
log "INFO: Git-Branch erstellt und aktiviert: $branch"
|
||||||
|
}
|
||||||
|
|
||||||
|
git_commit_changes() {
|
||||||
|
local changed_files
|
||||||
|
local commit_msg
|
||||||
|
|
||||||
|
if [[ "$USE_GIT" != "yes" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git -C "$BACKUP_ROOT" add -A
|
||||||
|
|
||||||
|
if git -C "$BACKUP_ROOT" diff --cached --quiet; then
|
||||||
|
log "INFO: Keine Änderungen für Git"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
changed_files="$(git -C "$BACKUP_ROOT" diff --cached --name-only | sed 's#^# - #' || true)"
|
||||||
|
|
||||||
|
commit_msg=$(
|
||||||
|
cat <<EOF
|
||||||
|
Config-Backup $(date '+%F %T')
|
||||||
|
|
||||||
|
Geänderte Dateien:
|
||||||
|
$changed_files
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
git -C "$BACKUP_ROOT" commit -m "$commit_msg"
|
||||||
|
log "OK: Git-Commit erstellt"
|
||||||
|
}
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Hauptlogik
|
||||||
|
########################################
|
||||||
|
|
||||||
|
main() {
|
||||||
|
mkdir -p "$BACKUP_ROOT"
|
||||||
|
|
||||||
|
if [[ -f "$SOURCE_LIST" ]]; then
|
||||||
|
log "INFO: Lese Source-Liste: $SOURCE_LIST"
|
||||||
|
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||||
|
[[ -z "${line// }" ]] && continue
|
||||||
|
[[ "$line" =~ ^[[:space:]]*# ]] && continue
|
||||||
|
copy_path "$line" || true
|
||||||
|
done < "$SOURCE_LIST"
|
||||||
|
else
|
||||||
|
log "WARN: Source-Liste fehlt: $SOURCE_LIST"
|
||||||
|
fi
|
||||||
|
|
||||||
|
auto_scan
|
||||||
|
|
||||||
|
git_prepare_repo
|
||||||
|
git_checkout_branch "$GIT_BRANCH"
|
||||||
|
git_commit_changes
|
||||||
|
|
||||||
|
log "INFO: Lauf abgeschlossen"
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
86
root/backup-config/run-backup-and-push.sh
Executable file
86
root/backup-config/run-backup-and-push.sh
Executable file
@@ -0,0 +1,86 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
BASE_DIR="/root/backup-config"
|
||||||
|
BACKUP_DIR="$BASE_DIR/backup"
|
||||||
|
BACKUP_SCRIPT="$BASE_DIR/backup-config.sh"
|
||||||
|
LOGFILE="/var/log/backup-config-run.log"
|
||||||
|
BRANCH="DockerDMZ_Configfiles"
|
||||||
|
|
||||||
|
log() {
|
||||||
|
printf '%s %s\n' "$(date '+%F %T')" "$1" | tee -a "$LOGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
if [[ ! -x "$BACKUP_SCRIPT" ]]; then
|
||||||
|
echo "Backup-Skript nicht gefunden oder nicht ausführbar: $BACKUP_SCRIPT" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$BACKUP_DIR"
|
||||||
|
|
||||||
|
log "INFO: Starte Backup"
|
||||||
|
"$BACKUP_SCRIPT"
|
||||||
|
log "INFO: Backup beendet"
|
||||||
|
|
||||||
|
cd "$BACKUP_DIR"
|
||||||
|
|
||||||
|
if ! command -v git >/dev/null 2>&1; then
|
||||||
|
log "ERROR: Git ist nicht installiert"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d .git ]]; then
|
||||||
|
log "INFO: Git-Repository wird initialisiert"
|
||||||
|
git init
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Branch aktivieren oder anlegen
|
||||||
|
if git show-ref --verify --quiet "refs/heads/$BRANCH"; then
|
||||||
|
git checkout "$BRANCH" >/dev/null 2>&1
|
||||||
|
log "INFO: Git-Branch aktiviert: $BRANCH"
|
||||||
|
else
|
||||||
|
if git rev-parse --verify HEAD >/dev/null 2>&1; then
|
||||||
|
git checkout -b "$BRANCH" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
git checkout --orphan "$BRANCH" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
log "INFO: Git-Branch erstellt: $BRANCH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
git add -A
|
||||||
|
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
log "INFO: Keine neuen Dateiinhalte für Commit"
|
||||||
|
else
|
||||||
|
git commit -m "Config-Backup $(hostname) $(date '+%F %T')"
|
||||||
|
log "INFO: Commit erstellt"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git remote get-url origin >/dev/null 2>&1; then
|
||||||
|
log "WARN: Kein Remote 'origin' konfiguriert, Push übersprungen"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remote-Infos aktualisieren
|
||||||
|
git fetch origin "$BRANCH" >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
# Falls der Remote-Branch noch nicht existiert
|
||||||
|
if ! git ls-remote --exit-code --heads origin "$BRANCH" >/dev/null 2>&1; then
|
||||||
|
git push -u origin "$BRANCH"
|
||||||
|
log "INFO: Initialer Push des Branches erfolgreich"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prüfen, ob lokale Commits noch nicht gepusht wurden
|
||||||
|
AHEAD_COUNT="$(git rev-list --count "origin/$BRANCH..$BRANCH" 2>/dev/null || echo 0)"
|
||||||
|
|
||||||
|
if [[ "$AHEAD_COUNT" -gt 0 ]]; then
|
||||||
|
git push origin "$BRANCH"
|
||||||
|
log "INFO: Push erfolgreich ($AHEAD_COUNT lokale Commits übertragen)"
|
||||||
|
else
|
||||||
|
log "INFO: Kein Push nötig, Remote ist aktuell"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
11
root/backup-config/sources.txt
Normal file
11
root/backup-config/sources.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#systembasis
|
||||||
|
/etc/network/interfaces
|
||||||
|
/etc/hosts
|
||||||
|
/etc/fstab
|
||||||
|
/etc/samba/smb.conf
|
||||||
|
/etc/systemd/system
|
||||||
|
/root/backup-config/backup-config.sh
|
||||||
|
/root/backup-config/run-backup-and-push.sh
|
||||||
|
/root/backup-config/sources.txt
|
||||||
|
/root/.ssh/config
|
||||||
|
/etc/nsswitch.conf
|
||||||
Reference in New Issue
Block a user