1. GSManager
    1. Funktionen
    2. Unterstützte Spiele
    3. Neuigkeiten
    4. Statistiken
    5. Serverliste
  2. Lexikon
  3. Filebase
  4. Entwicklung
  5. Forum
    1. Dashboard
    2. Unerledigte Themen
  6. Web-Interface
  7. Artikel
  8. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  • Anmelden
  • Registrieren
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Artikel
  • Seiten
  • Dateien
  • Forum
  • Lexikon
  • Erweiterte Suche
  1. GSManager
  2. Forum
  3. Unterstützung
  4. Benutzung

Limit amount of FTP transfers caused by "Log tracing by FTP"

  • Freekers
  • 18. Mai 2010 um 11:05
  • Geschlossen
Das Projekt GSManager (vormals ManuAdminMod) wurde am 01.01.2020 eingestellt - diese Internetpräsenz bleibt verfügbar, die Software wird aber nicht länger gepflegt. Vielen Dank für eure Unterstützung in den mehr als zehn vergangenen Jahren!
1. offizieller Beitrag
  • Freekers
    Anfänger
    Punkte
    75
    Beiträge
    12
    • 18. Mai 2010 um 11:05
    • #1

    Hi !

    Here's the situation:
    I am running ManuAdminMod on my homePC and my gameserver is hosted elsewhere (at EscapedTurkey.com) so I am using the 'Log tracing by FTP' function to trace the games_mp.log file.
    However, EscapedTurkey requires that your 'game server account must not be continuously accessed for FTP, log files, or statistics'. They have an limit of 500 FTP transfers per 24 hours, else your IP will be banned. :banned: This happened to me yesterday, so that's why I am opening this topic

    The problem is that ManuAdminMod makes an FTP transfer every 2 seconds. See the serverlogfile EscapedTurkey support sent me below:

    Code
    Mon May 17 21:57:17 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:18  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:20 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:21  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:22 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:23  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:25 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:26  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:27 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:28  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:30 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:32  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:33 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:34  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:35 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:36  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:38 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:40  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:41 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:42  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:43 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:45  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:46 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:47  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:48 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:50  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:51 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:53  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:54 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:55  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:56 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:57:58  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:57:59 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:58:01  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:58:02 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Mon May 17 21:58:03  2010 1 85.145.XXX.XXX 0 /cod4/main/games_mp.log b _ o r freek_1 ftp 0 *  c
    Mon May 17 21:58:05 2010 1 85.145.XXX.XXX 0  /cod4/main/games_mp.log b _ o r freek_1 ftp 0 * c
    Alles anzeigen

    As you can see from the times, ManuAdminMod makes an FTP transfer every 2 seconds. And since they have a limit of 500 transfers per 24 hours, my IP will get banned very quickly, causing that I cannot access my own gameserver anymore ! :banned:

    My question: Is there a way to limit the amount of FTP transfers or limit the interval between the FTP transfers ManuAdminMod makes ?
    I found that the file 'parser_ftp.class' handles the FTP logtracing. (It's located in \adminmod\classes ) and looks like this:

    PHP
    <?php
    
    
    
    
    class parser_ftp extends parser {
     private $host;
    private $user;
    private $pw;
    private $port;
     private $passive;
    private $localLogFile;
    private  $remoteLogFile;
    private $con;
    private $logging;
    private  $connected = 0;
    
    
    
    
    public function __construct($logfile,  &$success, $host, $user, $pw, $port, $passive = true) {
         $this->logging = &$GLOBALS['logging'];
        $this->host =  $host;
        $this->user = $user;
        $this->pw = $pw;
         $this->port = $port;
        $this->passive = $passive;
         $this->remoteLogFile["dir"] = dirname($logfile);
         $this->remoteLogFile["file"] = basename($logfile);
    
    
    
    
         $this->localLogFile = LOGDIR . "/ftplog.tmp";
    
    
    
    
    
    
    
        if  (!$this->connect($errmsg)) {
            $success = false;
             $this->logging->write(MOD_ERROR, "FTP error: $errmsg");
        }
         else {
            $this->logging->write(MOD_NOTICE,  "Successfully connected to FTP server: '$this->host' on port  $this->port as '$this->user'");
        }
    
    
    
    
         parent::__construct($this->localLogFile, $success);
    }
    
    
    
    
     private function connect(&$errmsg = "") {
        $this->con =  ftp_connect($this->host, $this->port, 5);
        if  (!$this->con) {
            $errmsg = "Connection to $this->host  on port $this->port failed";
            //No connection
             return false;
        }
        if (!ftp_login($this->con,  $this->user, $this->pw)) {
            $errmsg = "Login failed  with user $this->user";
            //Dir does not exist
             return false;
        }
        if (!ftp_pasv($this->con,  $this->passive)) {
            $errmsg = "Passive mode not available  at this server";
            //Passive mode not available
             return false;
        }
        if (!ftp_chdir($this->con,  $this->remoteLogFile["dir"])) {
           $errmsg = "Dir does not  exist: {$this->remoteLogFile['dir']}";
            //Dir does not  exist
            return false;
        }
    
    
    
    
        $size =  ftp_size($this->con, $this->remoteLogFile["file"]);
        if  ($size == -1) {
            $errmsg = "File  {$this->remoteLogFile["file"]} does not exist or server does not  support SIZE";
            //Server does not support "size"
             return false;
        }
        if ($this->logpos === false) {
             $this->logpos = $size;
        }
        $fp =  fopen($this->localLogFile, "w");
        if (!$fp) {
             $errmsg = "Error writing to LOCAL file $this->localLogFile, maybe not  enough permissions";
            return false;
        }
         fseek($fp, $this->logpos -1, SEEK_SET);
        fwrite($fp, "\0", 1);
         fclose($fp);
        $this->connected = time();
        return  true;
    }
    
    
    
    
    public function getNewLines() {
        if  (!is_resource($this->con)) {
            $this->error(1);
             return array();
        }
    
    
    
    
        /*
        //Reconnect after  12h
        if (time() - $this->connected > 12 * 60 * 60) {
             $this->disconnect();
            sleep(2);
            if  ($this->connect($errmsg)) {
                 $this->logging->write(MOD_NOTICE, "Successfully reconnected after  12hrs");
            }
            else {
                 $this->error(4);
            }
        }
        */
    
    
    
    
         $status = ftp_get($this->con, $this->localLogFile,  $this->remoteLogFile["file"], FTP_BINARY, $this->logpos);
    
    
    
    
         if (!$status) {
            $this->error(2);
            return  array();
        }
    
    
    
    
        clearstatcache();
        if  (filesize($this->localLogFile) - $this->logpos > 140 * 300) {  //140 Zeichen Durchnitt pro Zeile, 500 Zeilen maximal!!
             $this->error(3);
            return array();
        }
    
    
    
    
         $lines = parent::getNewLines();
    
    
    
    
        return $lines;
    }
    
    
    
    
     public function __destruct() {
        $this->disconnect();
    }
    
    
    
    
     private function disconnect() {
         file_put_contents($this->localLogFile, "");
        if  (is_resource($this->con)) {
            ftp_quit($this->con);
         }
    }
    
    
    
    
    private function error($code = 0) {
         $this->logging->write(MOD_WARNING, "Error getting new loglines by  FTP (code: $code), trying to reconnect...");
         $this->disconnect();
    
    
    
    
        $logpos = $this->logpos;
    
    
    
    
         for ($i = 1; $i <= 5; $i ++) {
             $this->logging->write(MOD_NOTICE, "waiting ".pow(2, $i)." seconds  until next try...");
            sleep(pow(2, $i));
            if  ($this->connect($errmsg)) {
                 $this->logging->write(MOD_NOTICE, "Successfully reconnected to FTP  server: '$this->host' on port $this->port as '$this->user'");
                 $this->logpos = $logpos;
                return;
             }
    
    
    
    
            $this->logging->write(MOD_WARNING,  "Reconnect ($i) failed: '$errmsg'");
        }
    
    
    
    
         $this->logging->write(MOD_ERROR, "FTP-Connection failed after 5  retries, quitting mod");
    
    
    
    
    }
    
    
    
    
    }
    Alles anzeigen

    I hope someone can help me limiting the amount/interval of FTP transfers. I think it shouldn't be too hard, I am guessing by just adding some pauses in the script above the problem can be solved.

    Without this solution, I cannot run ManuAdminMod on my server .. :omg: MANU ADMIN MOD !!

    Thanks in advance for the trouble to be taken !

  • Dennis
    Administrator
    Reaktionen
    148
    Punkte
    37.933
    Trophäen
    7
    Artikel
    4
    Dateien
    2
    Beiträge
    7.453
    • 18. Mai 2010 um 13:44
    • Offizieller Beitrag
    • #2

    FTP is not working well yet and not recommended to be used, because of that we can't give you a hint how to limit the access. This even would not work, because if the mam gets the logfiles not every 2 seconds all your commands written would be executed some minutes later ...

    • Nächster offizieller Beitrag
  • manu
    Meister
    Punkte
    10.835
    Trophäen
    3
    Beiträge
    2.113
    • 18. Mai 2010 um 14:05
    • #3

    Let me see... 500 transfers per 24 h. That means a maximum of 500/(24*60*60) transfers per second. Due that the mod can only check and parse the loglines about every 175 seconds.
    If the mod checked the logfiles only every 3 minutes then 3 minutes would pass before a command would be executed or a player would be welcomed... Its a really long time, isn't it?
    The mods base is to trace the loglines... LIVE...
    If you do not have live access to your logfile the mod won't work.
    Sorry...
    There is no chance to do it elsewise. If you do not believe me, you can test it yourself: Open daemon.php an go to line 368 and change

    Code
    sleep(1);

    to

    Code
    sleep(180);

    . But I think the ftp connection will timeout in that time anyway...

  • Dieses Thema enthält 2 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind.

Benutzer online in diesem Thema

  • 1 Besucher
  1. Mitarbeiter
  2. Datenschutzerklärung
  3. Nutzungsbedingungen
  4. Impressum
  5. Kontakt
Community-Software: WoltLab Suite™