This commit is contained in:
root 2026-11-06 09:39:52 +05:00
parent 52e406b578
commit 46e3ee87e1
6 changed files with 54 additions and 36 deletions

3
dhcp
View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
read -p "Ввеедите интерфейс(v200): " In
read -p "Введите начало диапазона(192.168.4.2): " S read -p "Введите начало диапазона(192.168.4.2): " S
read -p "Введите конец диапазона(192.168.4.6): " K read -p "Введите конец диапазона(192.168.4.6): " K
read -p "Введите подсеть(192.168.4.0): " Q read -p "Введите подсеть(192.168.4.0): " Q
@ -93,7 +94,7 @@ EOF
chmod 600 /etc/dhcp/dhcpd.conf chmod 600 /etc/dhcp/dhcpd.conf
cat > /etc/sysconfig/dhcpd << EOF cat > /etc/sysconfig/dhcpd << EOF
DHCPDARGS="enp0s8" DHCPDARGS="$In"
EOF EOF
echo "_________________Перезагрузка и старт dncpd________________________" echo "_________________Перезагрузка и старт dncpd________________________"

25
dns
View file

@ -30,7 +30,7 @@ options {
recursing-file "/var/named/data/named.recursing"; recursing-file "/var/named/data/named.recursing";
allow-query { any; }; allow-query { any; };
forward first; forward first;
forwarders { 8.8.8.8; 5.255.255.242; }; forwarders { 77.88.8.8; 8.8.8.8; };
allow-transfer { $brs; }; allow-transfer { $brs; };
}; };
@ -58,15 +58,21 @@ type master;
file "master/3.168.192.in-addr.arpa"; file "master/3.168.192.in-addr.arpa";
}; };
zone "4.168.192.in-addr.arpa" { zone "2.168.192.in-addr.arpa" {
type master; type master;
file "master/4.168.192.in-addr.arpa"; file "master/2.168.192.in-addr.arpa";
}; };
zone "4.16.172.in-addr.arpa" { #zone "4.168.192.in-addr.arpa" {
type master; #type master;
file "master/4.16.172.in-addr.arpa"; #file "master/4.168.192.in-addr.arpa";
}; #};
#zone "4.16.172.in-addr.arpa" {
#type master;
#file "master/4.16.172.in-addr.arpa";
#};
EOF EOF
@ -139,6 +145,11 @@ cat > /var/named/master/4.16.172.in-addr.arpa << EOF
2 IN PTR hq-rtr.au-team.irpo. 2 IN PTR hq-rtr.au-team.irpo.
EOF EOF
# Zone for BR-SRV
#cat > /var/named/master/2.168.192.in-addr.arpa << EOF
#\$TTL 604800 ;
#@ IN SOA
read -p "Resolution?: " res read -p "Resolution?: " res
if [[ -n $res ]]; then if [[ -n $res ]]; then
chown -R root:named /var/named/master chown -R root:named /var/named/master

View file

@ -34,6 +34,7 @@ no ipv6 forwarding
! !
interface $tun interface $tun
no ip ospf passive no ip ospf passive
ip ospf mtu-ignore
exit exit
! !
router ospf router ospf
@ -48,13 +49,13 @@ exit
interface gre1 interface gre1
ip ospf network point-to-point ip ospf network point-to-point
ip ospf authentication message-digest ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 1 ip ospf message-digest-key 1 md5 P@ssw0rd
! !
interface enp0s8 interface enp0s8
ip ospf authentication message-digest ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 1 ip ospf message-digest-key 1 md5 P@ssw0rd
! !
line vtysh line vty
! !
EOF EOF

View file

@ -35,6 +35,7 @@ no ipv6 forwarding
! !
interface $tun interface $tun
no ip ospf passive no ip ospf passive
ip ospf mtu-ignore
exit exit
! !
router ospf router ospf
@ -50,19 +51,19 @@ exit
interface gre1 interface gre1
ip ospf network point-to-point ip ospf network point-to-point
ip ospf authentication message-digest ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 1 ip ospf message-digest-key 1 md5 P@ssw0rd
! !
interface enp0s8 interface enp0s8
ip ospf authentication message-digest ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 1 ip ospf message-digest-key 1 md5 P@ssw0rd
! !
interface enp0s9 interface enp0s9
ip ospf authentication message-digest ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 1 ip ospf message-digest-key 1 md5 P@ssw0rd
! !
interface enp0s10 interface enp0s10
ip ospf authentication message-digest ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 1 ip ospf message-digest-key 1 md5 P@ssw0rd
! !
line vty line vty
! !

16
usr
View file

@ -2,14 +2,15 @@
# Задание 3, Модуль 1 (HQ-SRV / BR-SRV) # Задание 3, Модуль 1 (HQ-SRV / BR-SRV)
read -p "Введите логин: " L read -p "Введите логин: " L
read -p "Введите пароль: " P read -p "Введите пароль: " P
read -p "Введите id полльзоваелья: " I
read -p " Введите port: " Po
[ $EUID -ne 0 ] && echo "Требуется root" && exit 1 [ $EUID -ne 0 ] && echo "Требуется root" && exit 1
# 1. Пользователь remote_user # 1. Пользователь remote_user
useradd -m remote_user 2>/dev/null useradd -m remote_user 2>/dev/null
# 2. Пользователь sshuser (UID 2026, пароль P@ssw0rd) # 2. Пользователь sshuser
useradd -u 2026 -m $L 2>/dev/null useradd -u $I -m $L 2>/dev/null
echo "$L:$P" | chpasswd echo "$L:$P" | chpasswd
# 3. Sudo без пароля для sshuser # 3. Sudo без пароля для sshuser
@ -17,7 +18,7 @@ echo "$L ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
chmod 440 /etc/sudoers chmod 440 /etc/sudoers
cat > /etc/ssh/sshd_config << EOF cat > /etc/ssh/sshd_config << EOF
Port 2026 Port $Po
AllowUsers $L AllowUsers $L
MaxAuthTries 2 MaxAuthTries 2
EOF EOF
@ -28,8 +29,11 @@ SELINUX=targeted
EOF EOF
touch /etc/ssh/ban touch /etc/ssh/ban
echo "----------------------------------------------------------------------------------------------------------------------------------------"
echo ""
echo "Authorized access only" > /etc/ssh/ban echo "Authorized access only" > /etc/ssh/ban
echo ""
echo "-------------------------------------------------------------------------------------------------------------------------------------------------------"
echo "Banner /etc/ssh/ban" >> /etc/ssh/sshd_config echo "Banner /etc/ssh/ban" >> /etc/ssh/sshd_config
systemctl restart sshd systemctl restart sshd
@ -37,3 +41,5 @@ echo "Готово"
echo "" echo ""
echo "Имя: $L" echo "Имя: $L"
echo "Пароль: $P" echo "Пароль: $P"
echo "ID: $I "
echo "Port $Po"

30
vm
View file

@ -1,38 +1,36 @@
#!/bin/bash #!/bin/bash
#VBoxManage unregistervm "origin"
#VBoxManage registervm "/user4b_1/origin/origin.vbox"
if [ -z "$1" ]; then if [ -z "$1" ]; then
VBoxManage clonevm "origin" --name "ISP" --register --basefolder "/user4b_1" --options=keepallmacs read -p "Введите путиь(/mnt/disk/user_4b1): " P
VBoxManage clonevm "origin" --name "HQ-RTR" --register --basefolder "/user4b_1" --options=keepallmacs
VBoxManage clonevm "origin" --name "ISP" --register --basefolder "$P"
VBoxManage clonevm "origin" --name "HQ-RTR" --register --basefolder "$P"
VBoxManage modifyvm "HQ-RTR" --nic1 intnet --intnet1 "intnet" VBoxManage modifyvm "HQ-RTR" --nic1 intnet --intnet1 "intnet"
VBoxManage clonevm "origin" --name "BR-RTR" --register --basefolder "/user4b_1" --options=keepallmacs VBoxManage clonevm "origin" --name "BR-RTR" --register --basefolder "$P"
VBoxManage modifyvm "BR-RTR" --nic1 intnet --intnet1 "intnet" VBoxManage modifyvm "BR-RTR" --nic1 intnet --intnet1 "intnet"
VBoxManage modifyvm "BR-RTR" --nic3 none --nic4 none VBoxManage modifyvm "BR-RTR" --nic3 none --nic4 none
VBoxManage clonevm "origin" --name "HQ-SRV" --register --basefolder "/user4b_1" --options=keepallmacs VBoxManage clonevm "origin" --name "HQ-SRV" --register --basefolder "$P"
VBoxManage modifyvm "HQ-SRV" --nic1 intnet --intnet1 "intnet" VBoxManage modifyvm "HQ-SRV" --nic1 intnet --intnet1 "intnet"
VBoxManage modifyvm "HQ-SRV" --nic2 none --nic3 none --nic4 none VBoxManage modifyvm "HQ-SRV" --nic2 none --nic3 none --nic4 none
VBoxManage clonevm "origin" --name "HQ-CLI" --register --basefolder "/user4b_1" --options=keepallmacs VBoxManage clonevm "origin" --name "HQ-CLI" --register --basefolder "$P"
VBoxManage modifyvm "HQ-CLI" --nic1 intnet --intnet1 "intnet" VBoxManage modifyvm "HQ-CLI" --nic1 intnet --intnet1 "intnet"
VBoxManage modifyvm "HQ-CLI" --nic2 none --nic3 none --nic4 none VBoxManage modifyvm "HQ-CLI" --nic2 none --nic3 none --nic4 none
VBoxManage clonevm "origin" --name "BR-SRV" --register --basefolder "/user4b_1" --options=keepallmacs VBoxManage clonevm "origin" --name "BR-SRV" --register --basefolder "$P"
VBoxManage modifyvm "BR-SRV" --nic1 intnet --intnet1 "intnet" VBoxManage modifyvm "BR-SRV" --nic1 intnet --intnet1 "intnet"
VBoxManage modifyvm "BR-SRV" --nic2 none --nic3 none --nic4 none VBoxManage modifyvm "BR-SRV" --nic2 none --nic3 none --nic4 none
elif [[ $1 == "--del" ]]; then elif [[ $1 == "--del" ]]; then
VBoxManage controlvm "ISP" acpipowerbutton VBoxManage controlvm "ISP" poweroff
VBoxManage unregistervm "ISP" --delete VBoxManage unregistervm "ISP" --delete
VBoxManage controlvm "HQ-RTR" acpipowerbutton VBoxManage controlvm "HQ-RTR" poweroff
VBoxManage unregistervm "HQ-RTR" --delete VBoxManage unregistervm "HQ-RTR" --delete
VBoxManage controlvm "BR-RTR" acpipowerbutton VBoxManage controlvm "BR-RTR" poweroff
VBoxManage unregistervm "BR-RTR" --delete VBoxManage unregistervm "BR-RTR" --delete
VBoxManage controlvm "BR-SRV" acpipowerbutton VBoxManage controlvm "BR-SRV" poweroff
VBoxManage unregistervm "BR-SRV" --delete VBoxManage unregistervm "BR-SRV" --delete
VBoxManage controlvm "HQ-SRV" acpipowerbutton VBoxManage controlvm "HQ-SRV" poweroff
VBoxManage unregistervm "HQ-SRV" --delete VBoxManage unregistervm "HQ-SRV" --delete
VBoxManage controlvm "HQ-CLI" acpipowerbutton VBoxManage controlvm "HQ-CLI" poweroff
VBoxManage unregistervm "HQ-CLI" --delete VBoxManage unregistervm "HQ-CLI" --delete
elif [[ $1 == "--set" ]]; then elif [[ $1 == "--set" ]]; then