# uname -a

mercredi 15 mai 2013

Install Team Fortress 2 server using SteamCMD on Linux (and get rid of MasterRequestRestart)

You may have noticed that the legacy HLDSUpdateTool, is deprecated for a while. Since the recent udpate from Steam that forces all TF2 clients to use the new SteamPipe system, the server downloaded by HLDSUpdateTool is definitely deprecated. The Team Fortress’ wiki is giving wrong informations, that procedure is deprecated.

If you try to run a deprecated version of your server (acquired with HLDSUpdateTool), you will get one of the following :

MasterRequestRestart
Your server is out of date.  Please update and restart.

MasterRequestRestart
Server will restart on map change.

And the client is getting the following :

The server you are connecting to is running an older version of the game

You can try to update using HLDSUpdateTool but nothing will change, you will be stuck with your old version, and you will keep getting the same errors.

The key is to get the new TF2 server software, that uses SteamPipe. To do so, you have to grab the new SteamCMD program, that replaces HLDSUpdateTool, and install the TF2 server as explained in Valve documentation.

Because the documentation is not quite clear (in particular, concerning the new AppID to use), here is a few-steps tutorial to install your new TF2 server :

  • Make sure you create a new directory for SteamCMD files, do not install it in HLDSUpdateTool directory : mkdir steamcmd && cd steamcmd
  • Download SteamCMD : wget http://media.steampowered.com/client/steamcmd_linux.tar.gz

  • Extract SteamCMD : tar -xzf steamcmd_linux.tar.gz

  • If you are running a 64bit system (every decent server does), install ia32-libs (for instance, in Debian : dpkg --add-architecture i386 && apt-get install ia32-libs).

  • Run SteamCMD : ./steamcmd.sh it will update automatically.

  • Install TF2 dedicated server, in a custom directory (for me it’s the folder tf2_server in upper directory) :
    ./steamcmd.sh +login anonymous +force_install_dir ../tf2_server/ +app_update 232250 validate +quit

  • Note that the Steam AppID is now 232250 and not 440 as HLDSUpdateTool used to prompt.
  • Now you can run your new TF2 server : get back to the upper directory (cd ..) and start it :
    ./tf2_server/srcds_run -steam_dir steamcmd/ -steamcmd_script steamcmd/steamcmd.sh -console -game tf +map cp_dustbowl -maxplayers 16

Of course, you will have to copy your existing server.cfg, mapcycle, and MODs to your new TF2 installation directory (in tf2_server/tf/ sub-folders, indeed). If you have no clue of what I am talking about, please read the Team Fortress Wiki.

 

I hope this post will help those who are stuck with these “server deprecated” errors and unable to use their server. Have fun !

lundi 18 mars 2013

Dotclear Plugin : spamTrends

You may have noticed that some of your Dotclear articles are more spamed than others. Hey, why not using that information to find “trending” posts on your blog ?

Here is a plugin that does it.

You can see the result on this blog in the right sidebar, under “SPAM Trend” section.

Try it, and enjoy ;)

samedi 16 mars 2013

Apache : globally configure HTTPS for all VirtualHosts

You want to configure “once and for all” HTTPs for all domains and sub-domains handled by your webserver, and you don’t want to redeclare the certificate in each VirtualHost. Here is the trick.

I run Debian. In a default Apache installation, the directory /etc/sites-enabled contains a file named 000-default which declares a default VirtualHost for HTTP.

You have to know that when Apache loads an entire directory of configuration files, the files are read in alphabetical order. So if you want to declare something before something else, you can cheat on its name in the loaded configuration. It is exactly what 000-default does.

In /etc/apache2/sites-available, you have a file named default-ssl. Edit this file to fit your needs (path to certificate, etc). Note that this certificate will be the same for all the domains hosted on your server. It’s what we want : only one configuration. If you are hosting multiple domains on the same server, the certificate will probably be invalid for at least one of your domains, and you should use mod_macro instead of a global HTTPs configuration.

Now, enable the website the common way : a2ensite default-ssl. Don’t restart Apache yet.

Rename the file default-ssl created in /etc/apache2/sites-enabled/ to 000-default-ssl.

Configure your other VirtualHost with a *:80 section and a *:443 section, as usual but without specifying certificate and SSL informations for VirtualHosts on *:443.

If you restart Apache, you will notice something like this :

_default_ virtualhost overlap on port 443

To get rid of these warnings, just add to your ports.conf, in the right section :

NameVirtualHost *:443
Listen 443 http

When you finally restart Apache, every VirtualHost declared as *:443 will use the certificate defined in 000-default-ssl without mentioning it.

vendredi 15 mars 2013

Getsimple : exotic char causes website crash

Input sanitizing while editing pages is not efficient in GetSimple, incorrect char such as NULL or EOT corrupt XML files and crashes the CMS :

Warning: simplexml_load_string(): Entity: line 106: parser error : CData section not finished 

Here is a patch :

--- admin/inc/basic.php
+++ admin/inc/basic.php
@@ -654,8 +654,15 @@
     } else {
         $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
     }
-    $text = str_replace(chr(12), '', $text);
-    $text = str_replace(chr(3), ' ', $text);
+    $badchars = array();
+    for ($code = 0; $code < 32; $code++) {
+        $badchars[] = chr($code);
+    }
+    unset($badchars[13]);
+    unset($badchars[10]);
+    $text = str_replace($badchars, '', $text);
+    //$text = str_replace(chr(12), '', $text);
+    //$text = str_replace(chr(3), ' ', $text);
     return $text;
 }
Note that it does not fixes the corrupted XML files, it prevents the corrupted files to appear.

samedi 15 décembre 2012

UFW: ValueError: too many values to unpack

I was trying to use LXCs at home while using UFW.

I configured a network interface named ‘veth_something’, and to have the network bridge working I had to add a rule to UFW.

It didn’t liked it :

  File "/usr/sbin/ufw", line 89, in <module>
    ui = ufw.frontend.UFWFrontend(pr.dryrun)
  File "/usr/lib/python2.7/dist-packages/ufw/frontend.py", line 155, in __init__
    self.backend = UFWBackendIptables(dryrun)
  File "/usr/lib/python2.7/dist-packages/ufw/backend_iptables.py", line 45, in __init__
    ufw.backend.UFWBackend.__init__(self, "iptables", dryrun, files)
  File "/usr/lib/python2.7/dist-packages/ufw/backend.py", line 53, in __init__
    self._read_rules()
  File "/usr/lib/python2.7/dist-packages/ufw/backend_iptables.py", line 630, in _read_rules
    (dtype, interface) = tmp[-1].split('_')
ValueError: too many values to unpack

As a consequence, I totally messed up my UFW rules, and UFW was crashing at startup.

I had to edit the rules stored in /lib/ufw/user.rules and /lib/ufw/user6.rules to fix the lignes that contained the ‘_’.

Do not use a ‘_’ on interfaces name if you plan to add UFW rules on it.

- page 21 de 32 -