On the Kolab IRC we have had some issues with apt-get talking about connection failed etc.

So I updated the blogpost from last year: http://www.pokorra.de/2013/10/downloading-from-obs-repo-via-php-proxy-file/

The port of the Kolab Systems OBS is now port 80, so there is not really a need for a proxy anymore. But perhaps it helps for debugging the apt-get commands.

I have extended the scripts to work for apt-get on Debian/Ubuntu as well, the original script was for yum only it seems.

I have setup a small php script on a server somewhere on the Internet.

In my sample configuration, I use a Debian server with Lighttpd and PHP.


apt-get install lighttpd spawn-fcgi php5-curl php5-cgi

changes to /etc/lighttpd/lighttpd.conf:

server.modules = (
fastcgi.server = ( ".php" => ((
                     "bin-path" => "/usr/bin/php5-cgi",
                     "socket" => "/tmp/php.socket",
                     "max-procs" => 2,
                     "bin-environment" => (
                       "PHP_FCGI_CHILDREN" => "16",
                       "PHP_FCGI_MAX_REQUESTS" => "10000"
                     "bin-copy-environment" => (
                       "PATH", "SHELL", "USER"
                     "broken-scriptfilename" => "enable"
url.rewrite-once = (
    "^/obs\.kolabsys\.com/index.php" => "$0",
    "^/obs\.kolabsys\.com/(.*)" => "/obs.kolabsys.com/index.php?page=$1"

and in /var/www/obs.kolabsys.com/index.php:

// it seems file_get_contents does not return the full page
function curl_get_file_contents($URL)
    $c = curl_init();
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($c, CURLOPT_URL, str_replace('&#038;', '&#038;', $URL));
    $contents = curl_exec($c);
    if ($contents) return $contents;
    else return FALSE;
$page = $_GET['page'];
$filename = basename($page);
debug($page . "   ".$filename);
$content = curl_get_file_contents($obsurl."/".$page);
if (strpos($content, "Error 404") !== false) {
	header("HTTP/1.0 404 Not Found");
if (substr($page, -strlen("/")) === "/")
        # print directory listing
        $content = str_replace($obsurl."/", $proxyurl."/obs.kolabsys.com/", $content);
        $content = str_replace('href="/', 'href=$proxyurl."/obs.kolabsys.com/', $content);
        echo $content;
else if (substr($filename, -strlen(".repo")) === ".repo")
        header("Content-Type: plain/text");
        echo str_replace($obsurl."/", $proxyurl."/obs.kolabsys.com/", $content);
        header("Content-Type: application/octet-stream");
        header('Content-Disposition: attachment; filename="'.$filename.'"');
        header("Content-Transfer-Encoding: binary\n");
        echo curl_get_file_contents($obsurl."/".$page);
function debug($msg){
    $fh = fopen("/tmp/mylog.log",'a+');
    fputs($fh,"[Log] ".date("d.m.Y H:i:s")." $msg\n");

Now it is possible to download the repo files like this:

cd /etc/yum.repos.d/
wget http://kolabproxy2.pokorra.de/obs.kolabsys.com/repositories/Kolab:/3.3/CentOS_6/Kolab:3.3.repo
wget http://kolabproxy2.pokorra.de/obs.kolabsys.com/repositories/Kolab:/3.3:/Updates/CentOS_6/Kolab:3.3:Updates.repo
yum install kolab

For Ubuntu 14.04:

echo "deb http://kolabproxy2.pokorra.de/obs.kolabsys.com/repositories/Kolab:/3.3/Ubuntu_14.04/ ./" > /etc/apt/sources.list.d/kolab.list
echo "deb http://kolabproxy2.pokorra.de/obs.kolabsys.com/repositories/Kolab:/3.3:/Updates/Ubuntu_14.04/ ./" >> /etc/apt/sources.list.d/kolab.list
apt-get install kolab

This works for all other projects and distributions on obs.kolabsys.com too.

Proxy for Kolab yum and apt-get repositories
Tagged on: