Gameserver Ports

Your gameserver has its main “port” used to connect to your game. If there are any other ports they are listed here and are based on your “server port”.
Serverport 2302 .. if the query port is “+1” it would be the serverport 2302 + 1 = 2303 .. if the steam port is +2 it would be the serverport 2302 +2 which is 2304
For almost all servers, the QUERY port will be either the same as the serverport or it will be the serverport +1

GameServerDefaut PortQuery PortRcon PortWeb PortOther
Ark
Arma/Dayz2302+1Serverport

Rsync Configuration

To install a game using rsync, the game.xml file must have this line
<installer>rsync</installer>
https://github.com/OpenGamePanel/OGP-Website/wiki/XML-Notes#installer

Install the Rsync service on Ubuntu with
apt-get install rsync
Create /etc/rsyncd.conf and put the following entries:

use chroot = yes
read only = yes
[ogp_game_installer]
path = /var/www/files/rsync
comment = RSYNC source of game installs
log file = /var/www/html/panel/rsyncd.log
dont compress = *.pk3
refuse options = delete

Change to the rsync games directory, where all current available games folders are located, as listed in the rsyncd.conf (/var/www/files/rsync)
Create a new folder for this game, in order to find out the correct name, you will need to look at the XML file and use the “query name” . I have an easier method using the Game Key which is unique and has the same name as the xml file usually.
For example, the cstrike_linux32.xml will by default be installed into a folder named halflife. My method will install into cstrike_linux32. Its up to you, its a simple edit.

Change to the new game folder, then create a folder for each OS, Linux and Windows, for example: cstrike_linux32/linux and put the files of the game server for each OS inside its respective OS folder.

At some point you will need to install the actual games into the game folders. I create a script that will update all the files at once. This is part of that script that downloads the Terraria server into our Rsync folders. At the bottom of the files I run the script that will update our sizes.list and rsync.list and then copies them to the panel.

cd /var/www/files/rsync/terraria_linux
wget http://terraria.org/server/terraria-server-1353.zip
unzip terraria-server-1353.zip
mv 1353/Linux linux
rm -r 1353
cp serverconfig.txt linux/

cd /var/www/files/rsync
./update_rsync.sh

Now lets start the Rsync daemon and then set rsync to start when the system reboots

systemctl start rsync
systemctl enable rsync

Now lets test if the rsync is running , you should get the Name and Desc from the rsync.conf file

rsync -rdt rsync://localhost:873/

Overwrite sizes.list and rsync.list at modules/gamemanager/ with your custom files.
To do this we need to CREATE these two files first. So in your Linux terminal browse to the folder you have your rsync files located (/var/www/files/rsync) and enter these two commands. You MUST run them EVERY TIME you add or update your rsync files.
The first line creates your sizes.list.
The second line creates your rsync.list
These two files MUST be copied into the gamemanager module of your OGP panel.

du -sLlk /| awk '{print $2";"$1}'>sizes.list
ls -d1 */|tr -d />rsync.list

Add your rsync domain or ip, and location, to modules/gamemanager/rsync_sites_local.list

rsync.myclan.com|My Local Rsync Server

Automatic Backups of Agents

Create a key on a server

ssh-keygen -t rsa -b 2048

Login to the other server to copy the key

ssh-copy-id frank@dallas3.iareserver.com

Then connect with rsync We want to PULL the files from remote onto local

rsync -ar --delete -e ssh user@server:/source/ /localbackup/

If servers have backup space, use that. Put these commands into a Crontab to execute daily

On Germany backup Kansas
rsync -ar --delete -e ssh gameserver@kc.iareserver.com:/home/gameserver/ /home/backup/kansas/
On Kansas backup Germany 
rsync -ar --delete -e ssh gameserver@germany.iareserver.com:/home/gameserver/ /home/backup/germany/

Also we need to keep our local ADDONS folder in /var/www/html so we can access the files with a link. Rsync those among like machines by using crontab. Using this method, if we make changes on our master SERVER, kansas it will be replicated

on Germany, backup Kansas
rsync -ar --delete -e ssh gameserver@kc.iareserver.com:/var/www/html/addons/ /var/www/html/addons/
Repeat on all other like servers so all LINUX servers have identical and all WINDOWS servers have identical

addons.iareserver.com and rsync.iareserver.com should point to the main repository

Agent Installation

Install Linux Agent

Upgrade server to latest ubuntu 64bit
There can be issues with libc6 on 16.04 and we need newer versions of Java etc so Ubuntu 18 is best

 
apt-get update  
dpkg --add-architecture i386
apt-get install gcc libxml-parser-perl libpath-class-perl perl-modules screen rsync sudo openjdk-8-jre-headless e2fsprogs unzip subversion libarchive-extract-perl pure-ftpd libarchive-zip-perl libc6 libgcc1 git curl libc6-i386 libgcc1:i386 lib32gcc1 libhttp-daemon-perl php5 php-cgi python apache2 mysql-server phpmyadmin nano libstdc++6:i386 libcurl3-gnutls:i386 libtinfo5:i386 libncurses5:i386 libc6 lib32gcc1 lib32stdc++6 libc6:i386 libtbb2:i386 python-mysqldb


If in the panel, you enable REMOTE QUERY. then php-cgi MUST be installed on the agent server.(it is above)

Manual install Linux agent to use custom name and locations
Agent name should be ‘gameserver’, install into /home/gameserver folder

wget https://github.com/OpenGamePanel/OGP-Agent-Linux/archive/master.zip

Easy installer uses ogp-agent as name and puts files in /usr … this is NOT preferred

wget -N "https://github.com/OpenGamePanel/Easy-Installers/raw/master/Linux/Debian-Ubuntu/ogp-agent-latest.deb" -O "ogp-agent-latest.deb"

sudo dpkg -i "ogp-agent-latest.deb"

adduser “gameserver” , then usermod -aG sudo “gameserver”

edit /etc/ssh/sshd_config to deny root login with ssh and restart ssh.
Login with gameserver via ssh

If running IPtables to stop intrustions. Will have to add all the ports for each game. Below has the Source games

*filter

# Allow all loopback (lo0) traffic and reject traffic
# to localhost that does not originate from lo0.
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -s 127.0.0.0/8 -j REJECT

# Allow ping.
-A INPUT -p icmp -m state --state NEW --icmp-type 8 -j ACCEPT

# Allow SSH connections.
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT

# Allow the Steam client.
-A INPUT -p udp -m udp --sport 27000:27030 --dport 1025:65355 -j ACCEPT
-A INPUT -p udp -m udp --sport 4380 --dport 1025:65355 -j ACCEPT

# Allow inbound traffic from established connections.
# This includes ICMP error returns.
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# Log what was incoming but denied (optional but useful).
-A INPUT -m limit --limit 3/min -j LOG --log-prefix "iptables_INPUT_denied: " --log-level 7
-A FORWARD -m limit --limit 3/min -j LOG --log-prefix "iptables_FORWARD_denied: " --log-level 7

# Reject all other inbound.
-A INPUT -j REJECT
-A FORWARD -j REJECT

COMMIT​

Service
/etc/init.d/ogp_agent

#!/bin/bash
#
### BEGIN INIT INFO
# Provides:          ogp_agent
# Required-Start:    $all
# Required-Stop:     $all
# Should-Start:      $all
# Should-Stop:       $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start and stop the OGP Agent
# Description:       Start and stop the OGP Agent
### END INIT INFO
#

agent_dir=/home/gameserver/OGP
agent_user=gameserver

#
# main()
#

if [ "X`whoami`" != "Xroot" ]
then
        exit 1
fi

start() {
        if [ -e "$agent_dir/ogp_agent_run.pid" ]
        then
                pid=$(cat $agent_dir/ogp_agent_run.pid)
                out=$(kill -0 $pid > /dev/null 2>&1)
                if [ $? == 0 ]
                then
                        exit 1
                fi
        fi

        # Lets the agent user to use sudo to enable FTP accounts and use renice and taskset.
        if [ "$( groups $agent_user | grep "\bsudo\b" )" == "" ]
        then
                if [ "$( egrep -i "^sudo" /etc/group )" == "" ]
                then
                        groupadd sudo >/dev/null 2>&1
                fi
                usermod -aG sudo $agent_user >/dev/null 2>&1
        fi

        user_id=$(id -u $agent_user)
        group_id=$(id -g $agent_user)
        out=$(chown -Rf $user_id:$group_id $agent_dir >/dev/null 2>&1)

        # Lets the agent user to attach screens.
        if [ "$(groups $agent_user|grep -o "\stty\s")" == "" ]
        then
                usermod -aG tty $agent_user >/dev/null 2>&1
        fi

        out=$(chmod g+rw /dev/pts/* >/dev/null 2>&1)
        out=$(chmod g+rw /dev/tty* >/dev/null 2>&1)

        # Check the FTP status
        if [ -f "/etc/init.d/pure-ftpd" ] && [ -d "/etc/pure-ftpd/conf" ]
        then
                echo no > /etc/pure-ftpd/conf/PAMAuthentication
                echo no > /etc/pure-ftpd/conf/UnixAuthentication
                echo yes > /etc/pure-ftpd/conf/CreateHomeDir

                if [ ! -f /etc/pure-ftpd/pureftpd.passwd ]
                then
                        touch /etc/pure-ftpd/pureftpd.passwd
                fi

                if [ ! -f /etc/pureftpd.passwd ]
                then
                        ln -s /etc/pure-ftpd/pureftpd.passwd /etc/pureftpd.passwd
                fi

                if [ ! -f /etc/pure-ftpd/auth/50pure ]
                then
                        ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/50pure
                fi

                if [ ! -f /etc/pureftpd.pdb ]
                then
                        ln -s /etc/pure-ftpd/pureftpd.pdb /etc/pureftpd.pdb
                fi
                out=$(pure-pw mkdb >/dev/null 2>&1)
                out=$(service pure-ftpd force-reload >/dev/null 2>&1)
        fi

        cd $agent_dir
        out=$(su -c "screen -d -m -t ogp_agent -c ogp_screenrc -S ogp_agent ./ogp_agent_run -pidfile ogp_agent_run.pid" $agent_user >/dev/null 2>&1)
        exit 0
}

stop() {
        if [ -e "$agent_dir/ogp_agent_run.pid" ]
        then
                pid=$(cat $agent_dir/ogp_agent_run.pid)
                kill -0 $pid > /dev/null 2>&1
                if [ $? == 0 ]
                then
                        kill $pid >/dev/null 2>&1
                        exit $?
                fi
        else
                exit 1
        fi
        exit 0
}

case "${1:-''}" in
        'start')
        start
        ;;
        'stop')
        stop
        ;;
        'restart')
        stop
        sleep 1
        start
        ;;
        *)
        echo "Usage: service ogp_agent start|stop|restart"
        exit 1
        ;;
esac

Install Windows Agent

Filezilla issues:
Rightclick on the Filezilla Server service, and choose “Properties”, find the section called “Logon” , after that change the password for that password you use to login with cygwin.
When installing the Agent select same custom options as Linux.

Task Manager may be configured to stop running agent after 3 days.

Remove the Agent

First stop the agent via: sudo service ogp_agent stop (or sudo /etc/init.d/ogp_agent stop) You’ll need to remove the ‘lock’ on protected files: sudo chattr -iR /home/ogp_agent/OGP_User_Files/* Next you can delete the OGP user: sudo userdel -rf ogp_agent (which will also remove all the game-server files)

As for the agent files: sudo rm -rf /usr/share/ogp_agent

You’ll need to remove the start up scripts also.

sudo update-rc.d -f ogp_agent remove sudo rm /etc/init.d/ogp_agent

After that, you can try ‘sudo locate ogp_’ (after sudo updatedb, and if the locate package is installed) to see if everything is removed. Some helpful pages on installing game servers. https://www.linode.com/docs/game-servers/

OGP Panel

Panel Installation

Website Panel:
this server should be a linux machine running Apache2, MySQL, phpMyadmin, and Rsync

Prepare the Linux server by installing this software.

sudo apt-get install apache2 curl subversion php7.0 php7.0-gd php7.0-zip libapache2-mod-php7.0 php7.0-curl php7.0-mysql php7.0-xmlrpc php-pear phpmyadmin mysql-server php7.0-mbstring php-gettext git php-bcmath rsync nano

Create your Database by browsing to the phpmyadmin page. Login with your root account and create a “local user” with all privileges to the Database.

Download the panel files,
wget https://github.com/OpenGamePanel/OGP-Website/archive/master.zip
unzip, copy to your /var/www/html folder and install by browsing to the websites install.php file.
You will need your Database information to continue: DB name, User name, User password