diff --git a/cap b/cap new file mode 100644 index 0000000..34b1ac1 --- /dev/null +++ b/cap @@ -0,0 +1,39 @@ +#show + +systemctl show |grep -i capa +#prüfe welche du brauchst und eine Unit könnte so aussehen +# +[Unit] +Description=Start Server + +[Service] +Type=simple +Restart=on-failure +ExecStart=/usr/bin/python3 -m http.server + +WorkingDirectory=/ +#Namespace tricks +#macht Verzeichnise readOnly +#ReadOnlyPaths=/var /usr +#zeigt sie leer an +InaccessiblePaths=/sys /proc +#eignes tmp +PrivateTmp=yes +ProtectSystem=strict +#PrivatUser=yes + +#limit tricks +#darf nur 1 Process geben +#LimitNPROC=1 +#darf keine Files schreiben +#LimitFSIZE=0 +#entfert ~ capability +#CapabilityBoundingSet=~cap_net_raw cap_chown +#CapabilityBoundingSet=cap_net_bind_service +#Run as user +CapabilityBoundingSet=cap_net_bind_service +AmbientCapabilities=cap_net_bind_service +#User=nutzer16 +#Group=users +DynamicUser=yes + diff --git a/hostname b/hostname new file mode 100644 index 0000000..0dcb806 --- /dev/null +++ b/hostname @@ -0,0 +1,3 @@ +hostnamectl +# hostname "Profi" #wird sofort gesetzt + diff --git a/härtung b/härtung new file mode 100644 index 0000000..1a9012a --- /dev/null +++ b/härtung @@ -0,0 +1,23 @@ +#namespace Beispiele +[Unit] +Description=Start Server + +[Service] +Type=simple +Restart=on-failure +ExecStart=/usr/bin/python3 -m http.server + +WorkingDirectory=/ +#Namespace tricks +#macht Verzeichnise readOnly +ReadOnlyPaths=/var /usr +#zeigt sie leer an +InaccessiblePaths=/sys /proc +#eignes tmp +PrivateTmp=yes +ProtectSystem=strict +#PrivateUser=yes + +########################################################### +#read man systemd-exec +# diff --git a/jounalctl_helper b/jounalctl_helper new file mode 100644 index 0000000..2e18a9d --- /dev/null +++ b/jounalctl_helper @@ -0,0 +1,19 @@ +###journalctl main command +#-e dreht es um +#-b boot section +#--list-boots +#-b 0 -1 -n 100 #die letzten hundert +#--since 2000-01-01 --until +#--since "2 minutes ago" +#-p err #zeigt errors an +#-b 0 /usr/bin/sshd +# Die log db liegt in /var/log/journal +# eigene journal konfig create /etc/systemd/journald.conf.d Ordner +# cp journald.conf rein und füge echo -e "[Journal]\nSystemMaxUse=515" > /etc/journald.conf.d/expire.conf +#-b 0 -e -ax #all alles x catelog +#-b 0 -o json# ausgabe als json +#-b 0 _UID=1001 or _PID=600 +#-b 0 _COMM=logger #abfragen der vars in systemd.journal-fields +# +#apt install systemd-coredump +#coredump diff --git a/network b/network new file mode 100644 index 0000000..3c9f233 --- /dev/null +++ b/network @@ -0,0 +1,18 @@ +##systemd-network +networkctl +##aktiveren anlegen +mkdir /etc/systemd/network +vim 00-enp0s25.network + +[Match] +Name=enp0s25 + +[Network] +DHCP=ipv4 +Address=10.25.25.16/24 +#Gateway= +#Route= + +#disbale +systemctl disable --now NetworkManager.service networking.service ; sleep 3 systemctl enable --now systemd-networkd.service + diff --git a/systemdanalyze b/systemdanalyze new file mode 100644 index 0000000..0d2d831 --- /dev/null +++ b/systemdanalyze @@ -0,0 +1,8 @@ +## +systemd-analyze + +blame # +critical-chaim +plot > datie +security +security serivce diff --git a/trigger b/trigger new file mode 100644 index 0000000..9d52446 --- /dev/null +++ b/trigger @@ -0,0 +1,96 @@ +# Mount Beispiel +# automount -> mount +# socket (Accept no) -> service +# socket (Accept yes) -> service@ +# path -> service +# Automatically generated by systemd-fstab-generator +[Unit] +Documentation=man:fstab(5) man:systemd-fstab-generator(8) +SourcePath=/etc/fstab +Before=local-fs.target +After=blockdev@dev-disk-by\x2dlabel-srvfs.target + +[Mount] +What=/dev/disk/by-label/srvfs +Where=/srv +Type=xfs +########################## +#Es gibt ein Target für fs mounts +[Unit] +Documentation="Mount" + +[Mount] +What=/dev/disk/by-label/srvfs +Where=/srv +Type=xfs + +[Install] +WantedBy=local-fs.target +################################### +# /etc/systemd/system/srv.mount +[Unit] + +[Mount] +What=/dev/disk/by-label/srvfs +Where=/srv +Type=xfs + +[Install] +WantedBy=local-fs.target + +# /etc/systemd/system/srv.mount.d/override.conf +[Unit] + +[Mount] +What=/dev/disk/by-label/srvfs +Where=/srv +Type=xfs + +# /etc/systemd/system/srv.automount +[Unit] + +[Automount] +Where=/srv +TimeoutIdleSec=2min + +[Install] +WantedBy=local-fs.target +###################################### +#Eintrag über die fstab Datei +LABEL=srvfs /srv xfs defaults,x-systemd.automount,x-systemd.idle-timeout=2min +systemctl daemon-reload +################################# +#Trigger wenn das Verzechnis ändert +# /etc/systemd/system/trig.path +[Unit] +Description=demo path +[Path] +MakeDirectory=yes +PathChanged=/var/tmp/abba +PathChanged=/tmp/baab +PathChanged=/home/nutz + +# /etc/systemd/system/trig.service +[Unit] +Description=Trigger + +[Service] +Type=oneshot +ExecStart=/usr/bin/echo "Hier ist %n" +################################################################# +###Timer Trigger +#systemd-analyze timespan "1w 6h 35min" +#system-analyze calender "24.12" +#systemd-analyze calendar "9..17:3/15" --iterations=4 +#Beipiel + +[Unit] +Description=demo + +[Timer] +OnActiveSec=15 +#Nach Kalender +#OnCalender=OnCalendar=*-*-* *:2/5:30 +#jede Minunt +Persistent=yes +####################################### diff --git a/vmanlegen b/vmanlegen index 2d2e573..63f0ee8 100644 --- a/vmanlegen +++ b/vmanlegen @@ -2,7 +2,7 @@ #Verzeichnis anlegen mkdir /etc/systemd/nspawn #Konfig anlegen -echo "[Exec]\nPrivateUsers=pick" > /etc/systemd/rocky7.nspawn +echo -e "[Exec]\nPrivateUsers=pick" > /etc/systemd/rocky7.nspawn #VM anlegen vom Template systemctl start systemd-nspawn@rocky7.service #enable diff --git a/wichtig b/wichtig new file mode 100644 index 0000000..0f7ac7b --- /dev/null +++ b/wichtig @@ -0,0 +1,3 @@ +###nspawn machinen id löschen +rm /var/lib/dbus/machine-id +rm /etc/machine-id