first commit

This commit is contained in:
Viyurz 2024-04-28 15:27:24 +00:00
commit 8efe43c15e
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8
12 changed files with 468 additions and 0 deletions

9
.env.example Normal file
View file

@ -0,0 +1,9 @@
# Directory where "lgsm" and "serverfiles" are located.
LGSM_ROOT="$HOME"
# ARK server passwords.
SERVER_ADMIN_PASSWORD=
SERVER_PASSWORD=
# Paths of borg repositories for backing up maps.
BORG_REPOS=("$HOME/arkbackup")

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.env

34
Game.ini Normal file
View file

@ -0,0 +1,34 @@
[ModInstaller]
# Primal Fear
ModIDS=839162288
# Auto Engrams!
ModIDS=1428596566
# Awesome SpyGlass!
ModIDS=1404697612
# Dino Storage v2
ModIDS=1609138312
# Structure Plus
ModIDS=731604991
# Ultra Stacks
ModIDS=761535755
# AlphaEverything
#ModIDS=2205699189
# Ascended 2 Evolved loot drops
#ModIDS=3108122319
[/script/shootergame.shootergamemode]
BabyCuddleGracePeriodMultiplier=2.0
BabyCuddleIntervalMultiplier=0.0625
BabyCuddleLoseImprintQualitySpeedMultiplier=0.5
BabyImprintAmountMultiplier=15
BabyMatureSpeedMultiplier=5.0
bAllowFlyerSpeedLeveling=True
bDisableFriendlyFire=True
bDisableStructurePlacementCollision=True
bIncreasePvPRespawnInterval=False
bPvEDisableFriendlyFire=True
EggHatchSpeedMultiplier=5.0
MatingIntervalMultiplier=0.5
ConfigOverrideNPCSpawnEntriesContainer=(NPCSpawnEntriesContainerClassString="DinoSpawnEntries_CW_WhiteShoals_C",NPCSpawnEntries=((AnEntryName="ChaosWyvernWhiteShoals",EntryWeight=0.00875,NPCsToSpawnStrings=("WyvernGuardian_Character_BP_Base_Child_Chaos_Tamed_C")),(AnEntryName="SpiritWyvernWhiteShoals",EntryWeight=0.00875,NPCsToSpawnStrings=("WyvernGuardian_Character_BP_Base_Child_Spirit_Tamed_C")),(AnEntryName="CelestialFireWyvernWhiteShoals",EntryWeight=0.01125,NPCsToSpawnStrings=("CelestialWyvern_Character_BP_Fire_C")),(AnEntryName="CelestialIceWyvernWhiteShoals",EntryWeight=0.01125,NPCsToSpawnStrings=("CelestialWyvern_Character_BP_Ice_C")),(AnEntryName="OmegaFireWyvernWhiteShoals",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Fire_C")),(AnEntryName="OmegaIceWyvernWhiteShoals",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Ice_C")),(AnEntryName="OmegaLightingWyvernWhiteShoals",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Lighting_C")),(AnEntryName="OmegaPoisonWyvernWhiteShoals",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Poison_C")),(AnEntryName="NecroticFireWyvernWhiteShoals",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombieFire_C")),(AnEntryName="NecroticIceWyvernWhiteShoals",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombieIce_C")),(AnEntryName="NecroticLightingWyvernWhiteShoals",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombieLighting_C")),(AnEntryName="NecroticPoisonWyvernWhiteShoals",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombiePoison_C")),(AnEntryName="ApexFireWyvernWhiteShoals",EntryWeight=0.00833,NPCsToSpawnStrings=("ApexWyvern_Character_BP_Fire_C")),(AnEntryName="ApexLightingWyvernWhiteShoals",EntryWeight=0.00833,NPCsToSpawnStrings=("ApexWyvern_Character_BP_Lighting_C")),(AnEntryName="ApexPoisonWyvernWhiteShoals",EntryWeight=0.00833,NPCsToSpawnStrings=("ApexWyvern_Character_BP_Poison_C")),(AnEntryName="AlphaFireWyvernWhiteShoals",EntryWeight=0.0166,NPCsToSpawnStrings=("AlphaFireWyvern_Character_BP_Fire_C")),(AnEntryName="AlphaLightingWyvernWhiteShoals",EntryWeight=0.0166,NPCsToSpawnStrings=("AlphaWyvern_Character_BP_Lightning_C")),(AnEntryName="AlphaPoisonWyvernWhiteShoals",EntryWeight=0.0166,NPCsToSpawnStrings=("AlphaWyvern_Character_BP_Poison_C")),(AnEntryName="TropicalCrystalWyvernWhiteShoals",EntryWeight=0.36,NPCsToSpawnStrings=("CrystalWyvern_Character_BP_WS_C")))NPCSpawnLimits=((NPCClassString="WyvernGuardian_Character_BP_Base_Child_Chaos_Tamed_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="WyvernGuardian_Character_BP_Child_Spirit_Tamed_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="CelestialWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="CelestialWyvern_Character_BP_Ice_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Ice_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Lightning_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Poison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombieFire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombieIce_CC",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombieLighting_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombiePoison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="ApexWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="ApexWyvern_Character_BP_Lighting_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="ApexWyvern_Character_BP_Poison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="AlphaFireWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="AlphaWyvern_Character_BP_Lightning_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="AlphaWyvern_Character_BP_Poison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="CrystalWyvern_Character_BP_WS_C",MaxPercentageOfDesiredNumToAllow=0.5)))
ConfigOverrideNPCSpawnEntriesContainer=(NPCSpawnEntriesContainerClassString="DinoSpawnEntries_CW_Bloodfall_C",NPCSpawnEntries=((AnEntryName="ChaosWyvernBloodfall",EntryWeight=0.00875,NPCsToSpawnStrings=("WyvernGuardian_Character_BP_Base_Child_Chaos_Tamed_C")),(AnEntryName="SpiritWyvernBloodfall",EntryWeight=0.00875,NPCsToSpawnStrings=("WyvernGuardian_Character_BP_Base_Child_Spirit_Tamed_C")),(AnEntryName="CelestialFireWyvernBloodfall",EntryWeight=0.01125,NPCsToSpawnStrings=("CelestialWyvern_Character_BP_Fire_C")),(AnEntryName="CelestialIceWyvernBloodfall",EntryWeight=0.01125,NPCsToSpawnStrings=("CelestialWyvern_Character_BP_Ice_C")),(AnEntryName="OmegaFireWyvernBloodfall",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Fire_C")),(AnEntryName="OmegaIceWyvernBloodfall",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Ice_C")),(AnEntryName="OmegaLightingWyvernBloodfall",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Lighting_C")),(AnEntryName="OmegaPoisonWyvernBloodfall",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Poison_C")),(AnEntryName="NecroticFireWyvernBloodfall",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombieFire_C")),(AnEntryName="NecroticIceWyvernBloodfall",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombieIce_C")),(AnEntryName="NecroticLightingWyvernBloodfall",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombieLighting_C")),(AnEntryName="NecroticPoisonWyvernBloodfall",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombiePoison_C")),(AnEntryName="ApexFireWyvernBloodfall",EntryWeight=0.00833,NPCsToSpawnStrings=("ApexWyvern_Character_BP_Fire_C")),(AnEntryName="ApexLightingWyvernBloodfall",EntryWeight=0.00833,NPCsToSpawnStrings=("ApexWyvern_Character_BP_Lighting_C")),(AnEntryName="ApexPoisonWyvernBloodfall",EntryWeight=0.00833,NPCsToSpawnStrings=("ApexWyvern_Character_BP_Poison_C")),(AnEntryName="AlphaFireWyvernBloodfall",EntryWeight=0.0166,NPCsToSpawnStrings=("AlphaFireWyvern_Character_BP_Fire_C")),(AnEntryName="AlphaLightingWyvernBloodfall",EntryWeight=0.0166,NPCsToSpawnStrings=("AlphaWyvern_Character_BP_Lightning_C")),(AnEntryName="AlphaPoisonWyvernBloodfall",EntryWeight=0.0166,NPCsToSpawnStrings=("AlphaWyvern_Character_BP_Poison_C")),(AnEntryName="BloodCrystalWyvernBloodfall",EntryWeight=0.36,NPCsToSpawnStrings=("CrystalWyvern_Character_BP_Blood_C")))NPCSpawnLimits=((NPCClassString="WyvernGuardian_Character_BP_Base_Child_Chaos_Tamed_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="WyvernGuardian_Character_BP_Child_Spirit_Tamed_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="CelestialWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="CelestialWyvern_Character_BP_Ice_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Ice_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Lightning_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Poison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombieFire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombieIce_CC",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombieLighting_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombiePoison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="ApexWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="ApexWyvern_Character_BP_Lighting_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="ApexWyvern_Character_BP_Poison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="AlphaFireWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="AlphaWyvern_Character_BP_Lightning_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="AlphaWyvern_Character_BP_Poison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="CrystalWyvern_Character_BP_Blood_C",MaxPercentageOfDesiredNumToAllow=0.5)))
ConfigOverrideNPCSpawnEntriesContainer=(NPCSpawnEntriesContainerClassString="CI_DinoSpawnEntries_EmberWyverns_C",NPCSpawnEntries=((AnEntryName="ChaosWyvernVolcano",EntryWeight=0.00875,NPCsToSpawnStrings=("WyvernGuardian_Character_BP_Base_Child_Chaos_Tamed_C")),(AnEntryName="SpiritWyvernVolcano",EntryWeight=0.00875,NPCsToSpawnStrings=("WyvernGuardian_Character_BP_Base_Child_Spirit_Tamed_C")),(AnEntryName="CelestialFireWyvernVolcano",EntryWeight=0.01125,NPCsToSpawnStrings=("CelestialWyvern_Character_BP_Fire_C")),(AnEntryName="CelestialIceWyvernVolcano",EntryWeight=0.01125,NPCsToSpawnStrings=("CelestialWyvern_Character_BP_Ice_C")),(AnEntryName="OmegaFireWyvernVolcano",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Fire_C")),(AnEntryName="OmegaIceWyvernVolcano",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Ice_C")),(AnEntryName="OmegaLightingWyvernVolcano",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Lighting_C")),(AnEntryName="OmegaPoisonWyvernVolcano",EntryWeight=0.00625,NPCsToSpawnStrings=("OmegaWyvern_Character_BP_Poison_C")),(AnEntryName="NecroticFireWyvernVolcano",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombieFire_C")),(AnEntryName="NecroticIceWyvernVolcano",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombieIce_C")),(AnEntryName="NecroticLightingWyvernVolcano",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombieLighting_C")),(AnEntryName="NecroticPoisonWyvernVolcano",EntryWeight=0.0075,NPCsToSpawnStrings=("NecroticWyvern_Character_BP_ZombiePoison_C")),(AnEntryName="ApexFireWyvernVolcano",EntryWeight=0.00833,NPCsToSpawnStrings=("ApexWyvern_Character_BP_Fire_C")),(AnEntryName="ApexLightingWyvernVolcano",EntryWeight=0.00833,NPCsToSpawnStrings=("ApexWyvern_Character_BP_Lighting_C")),(AnEntryName="ApexPoisonWyvernVolcano",EntryWeight=0.00833,NPCsToSpawnStrings=("ApexWyvern_Character_BP_Poison_C")),(AnEntryName="AlphaFireWyvernVolcano",EntryWeight=0.0166,NPCsToSpawnStrings=("AlphaFireWyvern_Character_BP_Fire_C")),(AnEntryName="AlphaLightingWyvernVolcano",EntryWeight=0.0166,NPCsToSpawnStrings=("AlphaWyvern_Character_BP_Lightning_C")),(AnEntryName="AlphaPoisonWyvernVolcano",EntryWeight=0.0166,NPCsToSpawnStrings=("AlphaWyvern_Character_BP_Poison_C")),(AnEntryName="EmberCrystalWyvernVolcano",EntryWeight=0.36,NPCsToSpawnStrings=("CrystalWyvern_Character_BP_Ember_C")))NPCSpawnLimits=((NPCClassString="WyvernGuardian_Character_BP_Base_Child_Chaos_Tamed_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="WyvernGuardian_Character_BP_Child_Spirit_Tamed_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="CelestialWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="CelestialWyvern_Character_BP_Ice_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Ice_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Lightning_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="OmegaWyvern_Character_BP_Poison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombieFire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombieIce_CC",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombieLighting_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="NecroticWyvern_Character_BP_ZombiePoison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="ApexWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="ApexWyvern_Character_BP_Lighting_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="ApexWyvern_Character_BP_Poison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="AlphaFireWyvern_Character_BP_Fire_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="AlphaWyvern_Character_BP_Lightning_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="AlphaWyvern_Character_BP_Poison_C",MaxPercentageOfDesiredNumToAllow=0.1),(NPCClassString="CrystalWyvern_Character_BP_Ember_C",MaxPercentageOfDesiredNumToAllow=0.5)))

230
GameUserSettings.ini Normal file

File diff suppressed because one or more lines are too long

16
README.md Normal file
View file

@ -0,0 +1,16 @@
# arkserver
Small scripts to manage my ARK server.
## Backup
Ex: Set a cronjob to backup every 2 hours:
```
0 */2 * * * ~/arksrv/runbackup.sh
```
If backing up to a SSH host, setup SSH access,
then restrict access given by the SSH key to a particular command
by putting this in authorized_keys:
```
command="borg serve --append-only --restrict-to-repo PATH_TO_REPO",restrict KEY_TYPE PUB_KEY COMMENT
```

16
arkserver.cfg Normal file
View file

@ -0,0 +1,16 @@
##################################
####### Instance Settings ########
##################################
ip="0.0.0.0"
port="7777"
queryport="27015"
# Default Map: TheIsland, Ragnarok, CrystalIsles, Aberration_P, ScorchedEarth_P, TheCenter, Extinction, Valguero_P, Genesis, Gen2
defaultmap="Fjordur"
altsavedirectoryname="${defaultmap}"
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
## Game Server Docs | https://ark.wiki.gg/wiki/Server_configuration
startparameters="${defaultmap}?AltSaveDirectoryName=${altsavedirectoryname} -MultiHome=${ip} -Port=${port} -QueryPort=${queryport} -AutoManagedMods -Crossplay -PublicIPForEpic=${publicip} -MaxNumOfSaveBackups=0"

16
arkserver.service Normal file
View file

@ -0,0 +1,16 @@
[Unit]
Description=LinuxGSM ARK Server
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
User=viyurz
WorkingDirectory=/home/viyurz
RemainAfterExit=yes
ExecStart=/home/viyurz/arkserver start
ExecStop=/home/viyurz/arkserver stop
Restart=no
[Install]
WantedBy=multi-user.target

19
copy-config-files.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
relative_path="$(dirname "$0")"
if ! source "$relative_path/.env"; then
echo "Cannot source .env file, exiting."
exit 1
fi
# Copy LGSM & ARK configuration files.
cp "$relative_path/arkserver.cfg" "$LGSM_ROOT/lgsm/config-lgsm/arkserver/arkserver.cfg"
cp "$relative_path/GameUserSettings.ini" "$LGSM_ROOT/serverfiles/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini"
cp "$relative_path/Game.ini" "$LGSM_ROOT/serverfiles/ShooterGame/Saved/Config/LinuxServer/Game.ini"
# Add passwords in config files.
sed -i "s/^ServerAdminPassword=.*/ServerAdminPassword=$SERVER_ADMIN_PASSWORD/" "$LGSM_ROOT/serverfiles/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini"
sed -i "s/^ServerPassword=.*/ServerPassword=$SERVER_PASSWORD/" "$LGSM_ROOT/serverfiles/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini"

17
install-lgsm.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
relative_path="$(dirname "$0")"
if ! source "$relative_path/.env"; then
echo "Cannot source .env file, exiting."
exit 1
fi
(cd "$LGSM_ROOT" &&
curl -Lo linuxgsm.sh https://linuxgsm.sh &&
chmod +x linuxgsm.sh &&
./linuxgsm.sh arkserver &&
rm linuxgsm.sh &&
./arkserver install
)

19
install-nftables-service.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
relative_path="$(dirname "$0")"
# Install nftables if not already installed.
sudo which nft > /dev/null || sudo apt install -y nftables
# Copy nftables.conf & sytemd service files.
sudo cp "$relative_path/nftables.conf" /etc/nftables.conf
sudo cp "$relative_path/arkserver.service" /etc/systemd/system/arkserver.service
# Enable & start both services.
sudo systemctl enable arkserver nftables
sudo systemctl restart arkserver nftables

66
nftables.conf Normal file
View file

@ -0,0 +1,66 @@
#!/usr/sbin/nft -f
flush ruleset
table inet filter {
set blackhole_ipv4 {
type ipv4_addr
timeout 1m
flags dynamic
}
set blackhole_ipv6 {
type ipv6_addr
timeout 1m
flags dynamic
}
chain input {
type filter hook input priority 0; policy drop;
iif lo accept
# Block all IPs in blackhole
ip saddr @blackhole_ipv4 set update ip saddr @blackhole_ipv4 drop
ip6 saddr @blackhole_ipv6 set update ip6 saddr @blackhole_ipv6 drop
ct state invalid drop
ct state { established, related } accept
# Prevent DDoS
# Rate limiting
meta nfproto ipv4 meter ratelimit4 \
{ ip saddr limit rate over 50/second burst 10 packets } \
add @blackhole_ipv4 { ip saddr }
meta nfproto ipv6 meter ratelimit6 \
{ ip6 saddr limit rate over 50/second burst 10 packets } \
add @blackhole_ipv6 { ip6 saddr }
# Max concurrent connections
meta nfproto ipv4 meter connlimit4 \
{ ip saddr ct count over 100 } add @blackhole_ipv4 { ip saddr }
meta nfproto ipv6 meter connlimit6 \
{ ip6 saddr ct count over 100 } add @blackhole_ipv6 { ip6 saddr }
# Allow ICMP
meta l4proto icmp accept
meta l4proto ipv6-icmp accept
# SSH
tcp dport ssh accept
# ARK
udp dport { 7777, 7778, 27015 } accept
}
chain forward {
type filter hook forward priority 0; policy drop;
}
chain output {
type filter hook output priority 0; policy accept;
# Don't waste resources responding to blocked IPs
ip daddr @blackhole_ipv4 reject
ip6 daddr @blackhole_ipv6 reject
}
}

25
run-backup.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
relative_path="$(dirname "$0")"
if ! source "$relative_path/.env"; then
echo "Cannot source .env file, exiting."
exit 1
fi
# Install borgbackup and/or cron if not already installed.
which borg > /dev/null || sudo apt install -y borgbackup
which crontab > /dev/null || sudo apt install -y cron
# ARK "Saved" directory path.
backup_target="$LGSM_ROOT/serverfiles/ShooterGame/Saved"
for repo in "${BORG_REPOS[@]}"; do
borg init -e none "$repo"
borg create -C lzma "$repo::Saved_{now:%Y-%m-%d_%H-%M-%S}" "$backup_target"
borg prune --keep-within=2d --keep-daily=7 --keep-weekly=4 --keep-monthly=12 --keep-yearly=10 "$repo"
borg compact "$repo"
done