Rsync Configuration

. This game is installed from Steam by default? Edit the configuration xml file for this game, located at modules/config_games/server_configs/[game].xml, and remove this line: <installer>steamcmd</installer> And blacklist this xml file in the panel update.

2. Do you host your own rsync server? On each system the rsync server installation could be a little different,

If you are behind a firewall, make sure you allow tcp and udp traffic on port 873 for the rsync server Install the rsync server on you machine using the system’s native packager (yum, apt, portage etc)

Create /etc/rsyncd.conf if needed. Edit /etc/rsyncd.conf and put the following entries:

use chroot = yes
read only = yes
[rsync_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

**NOTE – /home/you/games can be any path you want. Make sure that you use the same path every where that /home/you/games is referenced here. Start the rsync server: /etc/init.d/rsyncd start Make sure you set it to startup at boot. Now, sync your site with the opengamepanel.org

rsync source: /usr/bin/rsync –archive –compress –update –verbose –delete rsync:rsync.opengamepanel.org/ogp_game_installer/ /home/you/games

When it’s done, your games directory should have an urbanterror, nexuiz, warsaw directory etc. Schedule a cronjob to run the above command once a day to keep your rsync mirror up to date:

10 14 * * * /usr/bin/rsync –archive –compress –update –verbose –delete rsync:rsync.opengamepanel.org/ogp_game_installer/ /home/you/games

This will run the update at 2:10 PM daily. Please choose a random time so all mirrors are not trying to update at the same time. Don’t worry, only new files will be pulled down, so you won’t be consuming bandwidth every time this runs unless new files are available.

Check your new rsync source with the following command:

rsync –list-only rsync:rsync.opengamepanel.org/ogp_game_installer rsync –list-only rsync:yourserver/ogp_game_installer

The listings should look the same. When your Rsync is up and running, send xgregx a private message with the details of your server and I will validate it and add it to the office OGP rsync mirror list. Thanks!

How to make rsync server script. (If you didnt have it):

-You can use xinetd to manage the start up script (best option on ubuntu/debian):

apt-get -y install xinetd

nano /etc/xinetd.d/rsync


service rsync { disable = no socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = –daemon log_on_failure += USERID }




and restart xinetd: /etc/init.d/xinetd restart

-Or create init start up script (best option on centos/redhat)

nano /etc/init.d/rsyncd


#!/bin/sh # # Startup script for rsyncd daemon # # chkconfig: 35 90 10 # description: Server data for sync to other server # processname rsync

# Source function library . /etc/rc.d/init.d/functions

prog=rsync conf=/etc/rsyncd.conf

case "$1" in start) echo -n "Starting rsync daemon: " daemon /usr/bin/$prog –daemon –config=$conf RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog ;; stop) echo -n "Shutting down $prog: " killproc -d 60 $prog RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog ;; status) status $prog ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac

exit 0




Don’t forget to give execution permission:

chmod +x /etc/init.d/rsyncd

and add it to the system startup for ubuntu/debian: update-rc.d rsyncd defaults for centos/red-hat: chkconfig rsyncd on ___

3. Add the server files to the rsync folder. Once you synced all game files from the rsync master server, make sure the games folder, and all files inside, have the rsync ownership and login to the rsync user account, if your rsync user is named “rsync” then: chown -Rf rsync:rsync /home/rsync/games su – rsync

Change to the rsync games directory, where all current available games folders are located, usually: cd games

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” Change to the new game folder, then create a folder for each OS, Linux and Windows, for example: cd halflife mkdir windows mkdir linux

And put the files of the game server for each OS inside its respective OS folder.

4. Create new sizes.list and rsync.list files: Change to the rsync games folder like in the previous step, and run these commands:

cd ~/games du -sLlk */*| awk '{print $2";"$1}'>sizes.list 
ls -d1 */|tr -d />rsync.list
Script to update the rsync files
cd /var/www/html/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/html/rsync
chown -R www-data:www-data *
./update_rsync.sh

5. Overwrite sizes.list and rsync.list at modules/gamemanager/ with your custom files, and blacklist them in the panel update.

6. Add your rsync domain or ip, and location, to modules/gamemanager/rsync_sites_local.list and blacklist it in the panel update, for example:

rsync.myclan.com|Scotland or 100.100.100.100|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

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

Download the panel files, unzip, copy to your /var/www/html folder and install by index.php

https://github.com/OpenGamePanel/OGP-Website/archive/master.zip

AMX Mod & Sourcemod

Metamod and Sourcemod

In your game monitor page press the Addons Button and select Install Plugins then choose Sourcemod.
It will install automatically. To test your install, join the game and press the backtick ` to open the console. Type

meta list

and you will see a list of installed plugins. Type

sm 

and you will get info about sourcemod.

You can login with sm_admin if you have set yourself as an admin.
To become an Admin, you can use our Utilities in the Game Panel. Retrieve your SteamID
which looks like this STEAM_0:1:1234567
and put that in the Sourcemod Admins box and you will be added automatically. Join the game and open the Console and type

sm_reloadadmins

Now you can type sm_admin, close the console and the admin menu will be displayed so you can configure your server.

Useful Links

Sourcemod at Alliedmodders
Howto add admins
Admin Commands

Useful Links

Sourcemod at Alliedmodders
Howto add admins
Admin Commands