vserver ubuntu IPv6 network

Since some days there is IPv6 available for my server. But I noticed it just today. Editing /etc/network/interfaces and adding a new virtual interface didn’t work at all. The /etc/init.d/networking restart just showed errors. And ifconfig venet0 wasn’t satisfying.

What works is /etc/network/interfaces just adding the loopbback

iface lo inet6 loopback
        adress ::1
        netmask 128
        gateway fe80::1

Now the trick is to add /etc/rc.local and add this before exit 0

ip addr add 2a01:238:40ab:cd12:dead:beef:dead:beef/128 dev venet0
ip route add default via fe80::1 dev venet0

Than execute /etc/rc.local
Wonder o wonder. Ifconfig works and also ping6 ipv6.example.com

Than I had to add the new ipv6 adress to my apache config

Listen [2a01:238:40ab:cd12:dead:beef:dead:beef]:80

Don’t forget a to create a symlink from rc.local to /etc/rc2.d/S21rc2.local

Change SDK for Visual Studio 2008 (VC9) express from the command line

if you wanna use the last SDK, but own only the express version you can do it this way:

Run as Administrator

C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\SetEnv.cmd" /Release

copy paste:

WindowsSdkVer.exe -version:v7.0

done!

To switch back for any reasons use

WindowsSdkVer.exe -version:v6.0A

Internet = Internet!

Woooow! So etwas hatte ich lange nicht mehr. Ich bin seit ein paar Tagen bei einem Kunden vor Ort so weit nichts außergewöhnliches. Laptop ans LAN angeklemmt und dann Firmennetzwerk ausgewählt als mein Win7 danach fragte. Ich bin ja immer ein wenig neugierig was neue Netze angeht. Deshalb habe ich erst mal das gute ipconfig /all angeguckt. Als ich dann auf wieistmeineip de geguckt habe, mußte ich erst ein mal schlucken. Internet = im Internet. Meine lokale LAN IP war gleich der IP die im Internet war. Kurz beim Admin nachgefragt, der konnte das so bestätigen. Danach habe ich erst mal schnell das Netzwerk auf öffentliches Netzwerk gestellt. Kurz vorher habe ich noch einen Blick auf das Windowsnetzwerk geworfen. Wow, viele tolle PCs ohne Firewall und auch direkt aus dem Internet zu erreichen! Win Win Situation. Also für potenzielle Hacker von außen, aber auch für mich, da hier wohl keiner den Netzwerkverkehr so einfach mitschneiden kann oder doch? Ein schnelles tracert zeigte dann aber doch, dass die Route ins Internet dann doch über 2 Router oder 2 Level-3 switche geht. Lieber Admin, wie wäre es mit NAT?!?! O_o Und einer schönen Firewall inklusive? Zu mindest könnte ich jetzt wenn ich denn wollte dort direkt einen server meine Wahl betreiben.

Nach dem ich meine Netzwerkkonfiguration geändert hatte, hatte ich mich gleich noch mal per SSH auf einem meiner server eingeloggt und von dort aus einen nmap scan gemacht. Alles zu :) Zum test noch mal kurz auf Firmemnetzwerk zurück geändert. Autsch, da waren sie die schönen offennen Port. Und wieder öffentliches Netzwerk eingestellt. Da soll mal einer sagen, dass die Windows Firewall unnütz ist. Zu mindest bei meinem Win7 ultimate kann ich hier nicht klagen.

Lavalampe wieder zum Leben erweckt

Ich hatte schon seit ein paar Wochen Probleme mit einer Lavalampe. Wie sie sehen, sehen sie nix. Und genau das war das Problem. Das Wachs ist nicht mehr aufgestiegen O_o

Ich dachte mir: vielleicht mal das Wasser austauschen… gut das ich vorher noch mal im Internet nachgelsen hab. Da ist kein Wasser drin, sondern Isopropanol oder Ethylenglycol. Wie also wiederleben?

Erst mal 10 Minuten bei 800 Watt in die Micro. Hat nicht wirklich was geholfen. Dann mit dem Wasserkocher 2 Liter Wasser erhitzt und drüber gegoßen. Schon besser! Es ist immerhin flüssig geworden. Dann bestimmt einen Teelöffel voll Spüli rein. Gut schütteln! Nun geht meine Lavalampe wieder und geköstet hat es fast nichts.

Apache AJP reverse proxy

With apache it is possible to have a reverse proxy with AJP instead of http. With the use of mod_proxy_ajp it is very simple to set up and faster than just plain http protocol

<VirtualHost *:80>
    ServerName jenkins
    DocumentRoot "/mario/Apache22/htdocs"
    <Directory "/mario/Apache22/htdocs">
        Options Indexes Includes FollowSymLinks
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Deny from none
    </Directory>
    <Location />
        ProxyPass ajp://localhost:8009/
        ProxyPassReverse ajp://localhost:8009/
    </Location>

    SetEnv vhostname jenkins
    Header add X-Server-Name %{vhostname}e
</virtualhost>

Than start the backend server, in this case only with AJP and listen only on localhost

java -jar jenkins.war --httpPort=-1 --ajp13ListenAddress=127.0.0.1

Zend framework lucene UTF-8 problem

I had issues with the zend framework and its implementation of lucene. It saved the values from my UTF-8 database in the lucene files with characters like UTF-8 in ISO 8859-1 like on the search result page. And I wasn’t able to search case insensitive.

I noticed that the apache header (zend server CE) wasn’t sending UTF-8. So I added AddDefaultCharset utf-8 to my httpd.conf. Didn’t help.

What helped: In the Bootstrap.php adding to the init of the search

Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8());
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());

In the model it is needed to decode it to ISO 8859-1 and than save it as UTF-8. Sounds insane, but it was the only thing that works for me.

$doc->addField(Zend_Search_Lucene_Field::Text('lucene_DB_CLOUMN_NAME',utf8_decode($db_apater_result['DB_CLOUMN_NAME']),'UTF-8'));

WTF Zend Lucene!

JQuery Ajax cross domain request

If you try to do an ajax request on a different domain. You’ll get nothing. Looking a bit deeper into the request I noticed that the status code isn’t 200 or 403 nor 404 like expected. Nope it is 0. (jquery ajax statusCode 0). This means the browser doesn’t allow a crossdomain request. The easiest way for me to solve this was to create a proxy php script. Now I can send my ajax request to a url on my server while the PHP script does the real request to the other server.

This is the php script

/**
* GetFromHost()
*
* @param string $host
* @param int $port
* @param string $path
* @param string $referer
* @param bool $keepalive
* @return
*/
function GetFromHost($host, $port, $path, $referer,$keepalive=false) {

 $fsocket = fsockopen($host, 80, $errno, $errstr, 30);

 if($fsocket){
 $request =     "GET $path HTTP/1.1\r\n";
 $request .= "Host: $host\r\n";
 $request .= "Referer: $referer\r\n";
 $request .= 'User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) ';
 $request .= "Gecko/20021204\r\n";
 $request .= 'Accept: text/xml,application/xml,application/xhtml+xml,';
 $request .= 'text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,';
 $request .= "image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1\r\n";
 $request .= "Accept-Language: en-us, en;q=0.50\r\n";
 //$request .= "Accept-Encoding: gzip, deflate, compress;q=0.9\r\n";
 $request .= "Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66\r\n";
 if($keepalive==true){
 $request .= "Keep-Alive: 300\r\n";
 $request .= "Connection: keep-alive\r\n";
 }
 else
 {
 $request .= "Connection: close\r\n";
 }
 //$request .= "Content-Type: application/x-www-form-urlencoded\r\n";
 //$request .= "Content-length: ". strlen($data_to_send) ."\r\n";
 $request .= "\r\n";
 //$request .= $data_to_send;

 fputs($fsocket, $request);

 $res ='';
 while(!feof($fsocket)) {
 $res .= fgets($fsocket, 1024);
 }
 fclose($fsocket);

 return $res;

 }
 else
 {
 return false;
 //echo "Fehlgeschlagen: ".$fsocket . $host .':'. $port;
 }

}

$x = GetFromHost("www.example", "80", "/deep/url/kinda/", "");
$x = explode('Content-Type: text/html',$x);
$output = preg_replace('/\s+(\r\n|\r|\n)/', '$1', $x['1']);//remove white space and tabs at the line ends
echo $output;

maybe you have to edit the explode part for server to separate the header fom the real content.