add
This commit is contained in:
39
cap
Normal file
39
cap
Normal file
@@ -0,0 +1,39 @@
|
||||
#show
|
||||
|
||||
systemctl show <service> |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
|
||||
|
||||
3
hostname
Normal file
3
hostname
Normal file
@@ -0,0 +1,3 @@
|
||||
hostnamectl
|
||||
# hostname "Profi" #wird sofort gesetzt
|
||||
|
||||
23
härtung
Normal file
23
härtung
Normal file
@@ -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
|
||||
#
|
||||
19
jounalctl_helper
Normal file
19
jounalctl_helper
Normal file
@@ -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
|
||||
18
network
Normal file
18
network
Normal file
@@ -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
|
||||
|
||||
8
systemdanalyze
Normal file
8
systemdanalyze
Normal file
@@ -0,0 +1,8 @@
|
||||
##
|
||||
systemd-analyze
|
||||
|
||||
blame #
|
||||
critical-chaim
|
||||
plot > datie
|
||||
security
|
||||
security serivce
|
||||
96
trigger
Normal file
96
trigger
Normal file
@@ -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
|
||||
#######################################
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user