Sign in to follow this  
Viking

HowTo - Setup Screenshot Management System by Stormyy

Recommended Posts

Alright ladies and gentlemen,

since I found this release topic from stormyy about his 'screenshot management tool' and finally got it running with his support I decided to write a little guide about how to set it up.
I hope this helps other people and the tool becomes more popular, because it's really epic.


I. Foreword

The 'screenshot management tool' is a working alternative to Echelon, the known online application to perform moderation tasks on B3 supported servers.

For this guide I am using the 'standalone' because I did not try the other one yet.
It was set up on a Linux Debian 8 server, so don't expect a guide for windows.
I am using the Apache webserver (v 2.4) and had to make it switch between multiple php versions because the website of my gamepanel does not support php 7.1
A little tutorial about how to do that is also included within this guide.
To edit config files i used winscp - simply because it's easier to view the files within an editor.

The tool is based on 'laravel' which means that it requires to be the root folder of your webserver.


II. Requirements

Server:

  • SSH access for root and a sudo user
  • PHP 7 or higher
  • Composer
  • Apache2 webserver

B3:

  • Enabled plugin: Status
  • Enabled plugin: Chatlogger

Tool:

  • The standalone version of the tool itself: HERE
  • The claimplayer plugin for CoD4x: HERE
  • A modified version of nehoscreenshotuploader plugin for CoD4x: HERE


III. Preparation

  1. Install Composer
 
    Login with ssh to a non-root sudo user and update the package manager cache

sudo apt-get update

    To download and run Composer you need 'curl', 'php5-cli' and 'git'

sudo apt-get install curl php5-cli git

    You are ready to install composer now

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

    Verify that Composer is correctly installed by checking it's version   

composer --version

 2. Optional - depending on the other websites you are running -
     Modify apache to make it switch between multiple php versions
    
    Install php 5.6 and php7.1 fpm including dev-tools

sudo apt-get -y install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt-get update
sudo apt-get install libapache2-mod-fastcgi php5.6-fpm php5.6 php5.6-dev php5.6-mcrypt php5.6-mbstring php5.6-mysql php5.6-zip php5.6-gd php5.6-xml php7.1-fpm libapache2-mod-fastcgi php7.1-fpm php7.1 php7.1-dev php7.1-mbstring php7.1-mysql php7.1-zip php7.1-gd php7.1-xml php7.1-curl php7.1-intl php7.1-json php7.1-mcrypt


    Enable the necessary Apache modules

sudo a2enmod actions
sudo a2enmod fastcgi

    Add handlers for both version to your default Apache vhost
    Add this after <VirtualHost *:80> in /etc/apache2/sites-available/000-default.conf
   

    <IfModule mod_fastcgi.c>
        AddHandler php56-fcgi-www .php
        Action php56-fcgi-www /php56-fcgi-www
        Alias /php56-fcgi-www /usr/lib/cgi-bin/php56-fcgi-www
        FastCgiExternalServer /usr/lib/cgi-bin/php56-fcgi-www -socket /run/php/php5.6-fpm.sock -pass-header Authorization
        <Directory "/usr/lib/cgi-bin">
              Require all granted
         </Directory>
    </IfModule>

    <IfModule mod_fastcgi.c>
        AddHandler php71-fcgi-www .php
        Action php71-fcgi-www /php71-fcgi-www
         Alias /php71-fcgi-www /usr/lib/cgi-bin/php71-fcgi-www
         FastCgiExternalServer /usr/lib/cgi-bin/php71-fcgi-www -socket /run/php/php7.1-fpm.sock -idle-timeout 1800 -pass-header Authorization
         <Directory "/usr/lib/cgi-bin">
              Require all granted
         </Directory>
    </IfModule>

    <IfModule mod_fastcgi.c>
        <FilesMatch ".+\.ph(p[345]?|t|tml)$">
            #Uncomment the SetHandler you want to use by default
            #SetHandler php56-fcgi-www
            #SetHandler php71-fcgi-www
        </FilesMatch>
    </IfModule>


    In the same file add a new directory definition for the site which later uses the non-default (second) php version
    In the default config this belongs below the part which defines the 'DocumentRoot' folder.
    

    Alias /example "/var/www/html/example/"
    <Directory "/var/www/html/example/">
        <FilesMatch ".+\.ph(p[345]?|t|tml)$">
            #Uncomment the SetHandler with the opposite php version
            #SetHandler php56-fcgi-www
            #SetHandler php71-fcgi-www
        </FilesMatch>
    </Directory>   

   
    Save and restart apache
   

service apache2 restart


  3. Enable mod_rewrite for Apache
 
    Enable the modules and restart apache

sudo a2enmod rewrite
sudo mkdir -p /var/run/apache2
sudo chown -R www-data /var/run/apache2
sudo a2enmod actions
service apache2 restart

    Enable the forwarding within the default Apache vhost in /etc/apache2/apache2.conf
    Change 'AllowOverride' from None to All

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride NONE
    Require all granted
</Directory>

 
  4. Download and install stormyys 'screenshot management tool'
 
    Change the directory to var/www/   

cd /var/www/

   
    Download the tool via composer as a non-root user!   

composer create-project stormyy/b3cod4x-standalone

  
    Update the files via composer (as a non-root user!) just in case.

cd /var/www/b3cod4x-standalone
composer update

   
    Depending on the user you have used to download stormyys tool you might have to change the owner/group and the permissions of the files and folders.
    
    Edit the config (hidden .env file) which is located in the root folder of b3cod4x-standalone
    !If your APP_NAME contains spaces you have to put it into double quotes!
    !DB_DATABASE is a new database which will be auto-generated - THIS IS NOT YOUR B3 DATABASE!

APP_NAME="B3 Webinterface (by Stormyy)"
APP_ENV=local
APP_KEY=THIS_IS_AUTOGENERATED_BY_THE_TOOL
APP_DEBUG=false
APP_LOG_LEVEL=debug
APP_URL=http://www.mywebsite.com

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=my_NEW_database_name
DB_USERNAME=my_database_user
DB_PASSWORD=my_database_password

 

    Migrate the required tables for the database   

php artisan migrate

  
    Change the DocumentRoot within the default Apache vhost config /etc/apache2/sites-available/000-default.conf to   

DocumentRoot /var/www/b3cod4x-standalone/public

   
    Save and restart apache

service apache2 restart

   
    Move all your public files (websites, fastdl etc.) to /var/www/b3cod4x-standalone/public else they will not work anymore!
    
  5. Optional - Adjust the permissions for the different b3 groups
    - This will affect the website of the tool only, not b3 in general! -
    Edit the config b3cod4x.php within the config folder

'screenshot' => 8, //Ability to take a screenshot
'remove' => 128, //Ability to remove server
'unban' => 32,  //Ability to uban
'setrank' => 64, //Ability to set rank
'ban' => 32, //Ability to ban
'chat' => 32 //Ability to chat

   
    These are the available values - do not edit them:

* Permission groups:
* Superadmin = 128
* Senioradmin = 64
* Fulladmin = 32
* Admin = 16
* Moderator = 8
* Regular = 2
* User = 1
* Guest = 0

   
  6. Download the CoD4x plugins 'claimplayer' and 'nehoscreenshotuploader' (links in II. Requirements) and upload them to the plugins folder of your server.

  7. Head to your b3 plugins and edit the config for the chatlogger: Enable 'save_to_database'

  8. Now edit the config of the status plugin:

interval: 10 (Refreshes 10 seconds, same as the panel)
enableDBsvarSaving: yes
enableDBclientSaving: yes
svar_table: current_svars
client_table: current_clients

 
  9. Enable the b3 plugins 'status' and 'chatlogger' within the config of your b3 bot and restart b3.
    
IV. First use of the tool

  1. Change the Admin Credentials
    
    Navigate to your website and login with the default credentials

Username: admin@admin.com
Password: ChangeMeFast

 
    When you are logged-in click on 'Super Admin' and 'My Account'.
    Change the credentials and save them.
    
  2. Add your b3 server and follow the instructions on your screen about what to add to your server.cfg
 
     It tells you to add something similar to this to your server.cfg   

set nehoscreenshot_identkey your_personal_ident_key
set nehoscreenshot_url "http://www.yourwebsite.com/b3/screenshot"
loadplugin nehoscreenshotuploader
loadplugin claimplayer

   
  3. Once you have added the stuff to your server.cfg execute the server.cfg to load the plugins.

  4. Claim your player to gain admin access

  •     The claimed player will only gain access to the admin functions when he is a member of a b3 admin group -
  •     Moderators are only able to capture and view screenshots by default -

    
    After your first login you will notice a big red panel asking you to claim your player.
    Click this button and you will receive a random code you have to write in chat on the server.

/claimplayer 12random34and56so78on90

    Copy this text, including the slash and connect to your server.
    Paste the text into the chat and send it.
    
    If the plugin was enabled correctly your text should not be visible.
    Instead a command will be executed which is visible as a colorized text bottom left.
    

CONGRATULATIONS - YOU ARE READY TO USE THE TOOL


V. Used Sources

Composer install guide:
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-debian-8

Multiple PHP Setup:
https://packages.sury.org/php/README.txt
https://medium.com/@sbuckpesch/run-multiple-php-version-on-the-same-server-using-php-fpm-and-xdebug-on-ubuntu-16-04-6a84f5b7d7ce

  • Thanks 5

Share this post


Link to post
Share on other sites

image.thumb.png.2053473ebde2ac00b7a8fcb2e0d71acd.png

please help I followed the whole tutorial but I get this error..
sorry for my english but I'm using google translator

Share this post


Link to post
Share on other sites
2 hours ago, blanco said:

image.thumb.png.2053473ebde2ac00b7a8fcb2e0d71acd.png


please help I followed the whole tutorial but I get this error..

sorry for my english but I'm using google translator

no way to help at this point. learn how to setup a webserver with php correctly and analyze the php errors. 

Share this post


Link to post
Share on other sites
On 30/3/2018 at 9:11 AM, Viking said:

contains spaces you have to put it into double quotes

please help now in the app to take screens there is this error

Sin título.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this