Compare commits
No commits in common. "f19452ddd30e0c35b73d13643c689010ad4ad49c" and "f22545f8963e33faa425cab69a2b396c4a07c92b" have entirely different histories.
f19452ddd3
...
f22545f896
11
README.md
11
README.md
@ -6,19 +6,18 @@
|
|||||||
- [x] addons for Forge
|
- [x] addons for Forge
|
||||||
|
|
||||||
## To DO!
|
## To DO!
|
||||||
- [*] Firewall shinanigns
|
- [ ] Firewall shinanigns
|
||||||
- [*] Proxmox admin acces in firewall
|
- [ ] Proxmox admin acces in firewall
|
||||||
- [x] Auto add plugins
|
- [x] Auto add plugins
|
||||||
- [*] SystemD service
|
|
||||||
- [ ] Config of velocity.toml
|
- [ ] Config of velocity.toml
|
||||||
- [ ] IP
|
- [ ] IP
|
||||||
- [*] Tailscale
|
|
||||||
- [ ] Comments of what is doing what
|
- [ ] Comments of what is doing what
|
||||||
|
- [ ] Tailscale
|
||||||
|
|
||||||
## To learn
|
## To learn
|
||||||
- [x] What content of start.sh means
|
- [x] What content of start.sh means
|
||||||
- [ ] Requred resources
|
|
||||||
- [ ] Different types of forwarding
|
- [ ] Different types of forwarding
|
||||||
- [ ] SkinRestorer???
|
- [ ] SkinRestorer???
|
||||||
- [ ] DinMap
|
- [ ] DinMap
|
||||||
- [ ] In their docs they have pages
|
- [ ] Requred resources
|
||||||
|
- [ ] In their docs they have Configuration pages
|
||||||
|
|||||||
@ -1,31 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Proxy for Minecraft server
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecReload=/usr/bin/screen -S velocity -X stuff \"reload^M\"
|
|
||||||
|
|
||||||
ExecStart=/usr/bin/screen -DmS velocity ./start.sh
|
|
||||||
|
|
||||||
ExecStop=/usr/bin/screen -p 0 -S velocity -X eval 'stuff "end"\\015'
|
|
||||||
ExecStop=/bin/sh -c '/bin/sleep 10'
|
|
||||||
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=60s
|
|
||||||
|
|
||||||
ProtectControlGroups=true
|
|
||||||
ProtectHome=true
|
|
||||||
ProtectKernelModules=true
|
|
||||||
ProtectKernelTunables=true
|
|
||||||
ProtectSystem=full
|
|
||||||
|
|
||||||
PrivateDevices=true
|
|
||||||
PrivateUsers=true
|
|
||||||
|
|
||||||
User=velocity
|
|
||||||
Group=velocity
|
|
||||||
|
|
||||||
WorkingDirectory=/opt/velocity/
|
|
||||||
98
script.sh
98
script.sh
@ -5,7 +5,7 @@ printf "Better to run as root, because of permisions handeling.\n"
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
|
|
||||||
### Firewall
|
### Firewall ### needs to update
|
||||||
|
|
||||||
printf "Do you want to set up firewall rules by iptables? [Y/n]: \n"
|
printf "Do you want to set up firewall rules by iptables? [Y/n]: \n"
|
||||||
read ansFirewallSetup
|
read ansFirewallSetup
|
||||||
@ -18,27 +18,42 @@ if [[ "$ansFirewallSetup" =~ ("N"|"n") ]]; then
|
|||||||
|
|
||||||
elif [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z $ansFirewallSetup ]]; then
|
elif [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z $ansFirewallSetup ]]; then
|
||||||
|
|
||||||
printf "Do you want to block non-Tailscale ssh connections? [Y/n]: "
|
printf "Do you want to block non-VPN ssh connections? [Y/n/castom]: "
|
||||||
read sshBlockRange
|
read sshBlockRange
|
||||||
|
|
||||||
|
|
||||||
if [[ "$sshBlockRange" =~ ("n"|"N") ]]; then
|
### needs update from LAN to VPN
|
||||||
|
|
||||||
|
if [[ $sshBlockRange =~ ("n"|"N") ]]; then
|
||||||
|
|
||||||
|
printf "+ OK, working on next bit\n"
|
||||||
|
ipList=""
|
||||||
|
|
||||||
|
elif [[ $sshBlockRange =~ ("y"|"Y") || -z $sshBlockRange ]]; then
|
||||||
|
|
||||||
|
#Pipes all informations about ip interfaces
|
||||||
|
ipList=$(ip -o -4 a show tailscale0)
|
||||||
|
|
||||||
|
#Founds data in pattern
|
||||||
|
ipList=$(echo $ipList | grep -Eo "([0-9]*\.){3}[0-9]*/[0-9]*")
|
||||||
|
|
||||||
|
#substitues space for coma
|
||||||
|
ipList=$(echo $ipList | tr " " ",")
|
||||||
|
|
||||||
|
printf "+ Accepting SSH connections only on these ip's: $ipList\n"
|
||||||
|
|
||||||
printf "If you want input your own IP range [N/range]\n"
|
|
||||||
read sshRange
|
|
||||||
|
|
||||||
if [[ "$sshRange" =~ ("n"|"N") || -z $sshRange ]]; then
|
|
||||||
printf "+ Making your SSH connections wide and open. Think about it. /n"
|
|
||||||
ipList="*"
|
|
||||||
else
|
else
|
||||||
printf "+ Accepting SSH connections only on these ip's: $sshRange\n"
|
printf "\nHope you know what you are doing, I am not checking these :]"
|
||||||
ipList="$sshRange"
|
|
||||||
|
printf "\nSubmit your IP range to acces SSH in format 192.168.1.1/24
|
||||||
|
\nYour IP range: "
|
||||||
|
read ipList
|
||||||
|
printf "\n+ Allowing SSH on this range: $ipList \n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Update
|
### Update ###
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
@ -51,14 +66,14 @@ if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z $ansFirewallSetup ]]; then
|
|||||||
apt install iptables -y
|
apt install iptables -y
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### User managment
|
### User managment ### needs update
|
||||||
|
|
||||||
groupadd velocity
|
groupadd minecraft
|
||||||
|
|
||||||
useradd --system --shell /usr/sbin/nologin --home /opt/velocity -g velocity velocity
|
useradd --system --shell /usr/sbin/nologin --home /opt/minecraft -g minecraft minecraft
|
||||||
|
|
||||||
|
|
||||||
### File structure
|
### File structure ###
|
||||||
|
|
||||||
mkdir /opt/velocity
|
mkdir /opt/velocity
|
||||||
|
|
||||||
@ -67,14 +82,19 @@ mv data/velocity*.jar start.sh /opt/velocity/
|
|||||||
mkdir /opt/velocity/plugins
|
mkdir /opt/velocity/plugins
|
||||||
mv data/Ambassador*.jar /opt/velocity/plugins
|
mv data/Ambassador*.jar /opt/velocity/plugins
|
||||||
|
|
||||||
|
### Nestopne se samo, mozna lepsi vytvorit strukturu za nej vlozit config a spustit az pres systemD
|
||||||
|
./start.sh
|
||||||
|
end
|
||||||
|
### Screen usige alert
|
||||||
|
|
||||||
|
rm /opt/velocity/velocity.toml
|
||||||
mv data/velocity.toml /opt/velocity/
|
mv data/velocity.toml /opt/velocity/
|
||||||
mv data/forwarding.secret /opt/velocity/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Permisions
|
### Permisions ### needs update
|
||||||
|
|
||||||
chown -R velocity:velocity /opt/velocity/
|
chown -R godot:godot /opt/velocity/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -96,20 +116,7 @@ if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z "$ansFirewallSetup" ]]; then
|
|||||||
|
|
||||||
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT #Allow continuing connections
|
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT #Allow continuing connections
|
||||||
|
|
||||||
iptables -A INPUT -p tcp --dport 25577 -j ACCEPT #Allow Velocity port
|
iptables -A INPUT -p tcp --dport 25577 -j ACCEPT #Allow MC port
|
||||||
|
|
||||||
if [[ "$ipList" = "*" ]]; then
|
|
||||||
|
|
||||||
### Wide and open
|
|
||||||
|
|
||||||
iiptables -A INPUT -p tcp --dport 22 j ACCEPT
|
|
||||||
|
|
||||||
elif [[! "$ipList" -z ]]; then
|
|
||||||
|
|
||||||
### Manual IP range
|
|
||||||
|
|
||||||
iptables -A INPUT -p tcp --dport 22 --source $ipList -j ACCEPT
|
|
||||||
fi
|
|
||||||
|
|
||||||
iptables -L ### Good place to paste a manual check to not lock yourself out
|
iptables -L ### Good place to paste a manual check to not lock yourself out
|
||||||
|
|
||||||
@ -134,27 +141,6 @@ if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z "$ansFirewallSetup" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### tailsclae install ###
|
|
||||||
|
|
||||||
printf "Do you want to install Tailscale now? [Y/n]: \n"
|
|
||||||
read ansTail
|
|
||||||
|
|
||||||
if [[ "$ansTail" =~ ("y"|"Y") || -z $ansTail ]]; then
|
|
||||||
|
|
||||||
curl -fsSL https://tailscale.com/install.sh | sh
|
|
||||||
|
|
||||||
|
|
||||||
if [[ "$sshBlockRange" =~ ("y"|"Y") || -z $sshBlockRange ]]; then
|
|
||||||
tailscale up --ssh
|
|
||||||
|
|
||||||
else
|
|
||||||
tailscale up
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
### Start service ### needs update
|
### Start service ### needs update
|
||||||
|
|
||||||
printf "Do you want to start server right now? [Y/n]: \n"
|
printf "Do you want to start server right now? [Y/n]: \n"
|
||||||
@ -168,4 +154,4 @@ systemctl enable mc-forge
|
|||||||
|
|
||||||
### needs update
|
### needs update
|
||||||
printf "\nsystemctl status mc-forge"
|
printf "\nsystemctl status mc-forge"
|
||||||
printf "\nsu velocity -s /bin/bash"
|
printf "\nsu minecraft -s /bin/bash"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user