68 lines
2.0 KiB
Bash
Executable File
68 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Restart usługi dnsmasq w kontenerze
|
|
incus exec deb1 -- systemctl restart dnsmasq
|
|
|
|
# Włącz automatyczne uruchamianie dnsmasq przy starcie
|
|
incus exec deb1 -- systemctl enable dnsmasq
|
|
|
|
# Sprawdź status usługi dnsmasq
|
|
incus exec deb1 -- systemctl status dnsmasq
|
|
|
|
# Test DNS — nslookup
|
|
incus exec deb1 -- nslookup example.local 192.168.1.10
|
|
|
|
# Utwórz nowy kontener deb1 z obrazu Debian 12
|
|
incus create images:debian/12 deb1
|
|
|
|
# Konfiguracja bezpieczeństwa dla kontenera deb1
|
|
incus config set deb1 security.syscalls.intercept.mount true
|
|
incus config set deb1 security.nesting true
|
|
incus config set deb1 security.privileged true
|
|
|
|
# Uruchom kontener deb1
|
|
incus start deb1
|
|
|
|
# Aktualizacja pakietów w kontenerze deb1
|
|
incus exec deb1 -- apt update
|
|
|
|
# Instalacja potrzebnych pakietów
|
|
incus exec deb1 -- apt install -y \
|
|
netplan.io \
|
|
sudo vim nano git tmux mc zip unzip curl wget htop lynx \
|
|
iproute2 termshark bridge-utils \
|
|
python3 python3-ipython python3-pyroute2 python3-scapy \
|
|
docker.io docker-compose
|
|
|
|
# Ustaw hasło root
|
|
incus exec deb1 -- bash -c 'echo "root:passroot" | chpasswd'
|
|
|
|
# Dodaj użytkownika "user" z hasłem "pass" i grupą "sudo" i " docker" (opcja dla wewnątrz kontenera i z ns1
|
|
# Wariant ns1
|
|
sudo incus exec deb1 -- su - sudo useradd -m -s /bin/bash -G sudo,docker user && echo 'user:pass' | sudo chpasswd
|
|
|
|
# Wariant inside container
|
|
sudo useradd -m -s /bin/bash -G sudo,docker user && echo 'user:pass' | sudo chpasswd
|
|
|
|
# Wejście do powłoki bash w kontenerze (opcjonalne)
|
|
incus exec deb1 -- bash -c "echo 'Wchodzimy do bash...'; exec bash"
|
|
|
|
# Aktualizacja pakietów ponownie
|
|
incus exec deb1 -- apt update
|
|
|
|
# Instalacja dnsmasq
|
|
incus exec deb1 -- apt install dnsmasq -y
|
|
|
|
# Edycja konfiguracji Netplan
|
|
incus exec deb1 -- nano /etc/netplan/01-netcfg.yaml
|
|
|
|
# Zastosowanie zmian konfiguracji sieciowej
|
|
incus exec deb1 -- netplan apply
|
|
|
|
# Edycja konfiguracji dnsmasq.conf
|
|
incus exec deb1 -- nano /etc/dnsmasq.conf
|
|
|
|
echo "Skrypt zakończony."
|
|
|
|
#made by mbiast and babcia (siah)
|