Friday, July 23, 2010

Yeni facebook uygulamasi

Yurtdışından istekleriniz var veya olanlara yardım mı etmek istiyorsunuz, muthis icat

"Istek kutusu" uygulamasini kivancla sunuyorum.




Bu arada ilginc facebook uygulama fikri olan varsa haberim olsun ;)

Tuesday, July 6, 2010

Making google app engine use socks proxy when fetching urls

Here's a simple recipe to do this:

1) Download and install socksipy
http://socksipy.sourceforge.net/

2) Add the following three lines after the import declarations to the file google/appengine/api/urlfetch_stub.py

import socks
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 1080)
socket.socket = socks.socksocket

3) restart app engine

Now the url fetch requests go thru your socks server running on port 1080

Monday, May 17, 2010

Obix Object Browser as a Tree in Adobe Air using Swiz framework

I recently created a tree component in flex for browsing obix sources as a proof of concept and decided to share it so that it might be useful for others. It was a fun experience that enabled me to learn more about the nice swiz framework.

The harder parts had been the implementation of lazy loading and the loading of the icons from remote locations, both of which I got ideas from other people and adapted.

and the icon loading idea is from http://blog.benstucki.net/?p=42

The handling of the obix becomes pretty easy with the e4x in flex. One point worth highlighting is the need for explicitly referring to the obix namespace.

So you need to define the namespace like this

var ns:Namespace = new Namespace("http://obix.org/ns/schema/1.0");


so that you can invoke stuff like

result.child(new QName(ns, "*"));


The swiz framework provides a nice executeServiceCall method in controller classes which facilitates service calls. The source code of the Swiz 1.0.0 Beta framework is not included in view source. You can get it from its source code repository.

The demo here works as a client to the http://obix.tridium.com/obix/

Download, install, run and view source.
And Enjoy or don't! :)


Wednesday, March 17, 2010

Friday, February 12, 2010

We agnostics often envy the True Believer, who thus acquires so easily that sense of security which is forever denied to us.

Thursday, February 4, 2010

Bagli olmayi istemek

Internet e baglanmak istemenin arkasinda ne var?

Sorarim kendime

Nokia 5800 bedava ovi maps yükleme macerası

Nokia nin voice navigasyonlu ovi maps i bedava vereceğini açiklaması üzerine sevinip yüklemeye calıştıysanız hüsrana uğramış olabilirsiniz. Bunun sebebi makinanizin "product code" unun o firmware i yüklemeye izni olmaması. Yani Nokia software updater veya ovi suite veya telefonun içinden güncellemeye basınca nokia server larına giden bilgide yazan telefonunuzun "product code" u için server cevap olarak yeni firmware i vermiyor. Buna sebep olarak da her operatorün veya bölgenin her özelliği desteklememesi gösteriliyor. Telefonun orjinal ürün kodunu o bölge icin unbranded bir koda dönüstürünce, ki bu kodlar bölgeler için belli, sorun ortadan kalkıyor.


Nemesis Service Suite ile ürün kodunu bir unbranded urun koduna dönüstürün, mesela 0559373. 0559373: Euro2 Turkey BLUE.
Artık yeni firmware i yükleyip navigasyonu kullanabilirsiniz.

Burda ilginç olan bu firmware in neden turkiyede satılan ürünler için download edilemez olduğu, bu gecikmenin sebebi ne? Neden benim telefonun ürün kodunu değiştirmem gereksin bunu indirebilmem ve kullanabilmem için?

Tuesday, January 26, 2010

Stunnel ve socks proxy ile firewall gecme

Artik ayda 5$ a bir linux vps sahibi olunabildigine gore, firma firewall u ve bloke etme mekanizmalarini gecmek cok kolay bir hale gelmis oluyor. Anlatilan Ubuntu linux icindir ama diger linuxlar icin sadece stunnel ve dante kurulumu degismekte.

Burda anlatilan ssl tunel yonteminin calisma sekli su sekilde:

1) Client da calisan bir stunnel kuruyoruz, port 1080 da socks dinleyip server daki stunnel in 443 portuna ssl tunnelling yapacak.

2) Server a stunnel kuruyoruz, bu stunnel 443 a gelen baglantiyi server port 1080 deki socks proxy e yonlendiriyor.

3) Server a bir Socks proxy kuruyoruz, isminden anlasilacagi gibi bu baglantiyi proxy liyor.

Bu durumda client tarafinda calisan Firefox gibi socks proxy ile konusabilen uygulamalar firewall a takilmadan calisabilir.


Server tarafi Stunnel kurulumu:

aptitude install stunnel

veya
apt-get install stunnel
ile stunnel i kuruyoruz.

Bu asamada stunnel bulunamamasi gibi bir problem cikarsa bunun sebebi vps in ubuntu repository lerini /etc/apt/sources.list dosyasina yazmamis olmasindan olabilir, bu durumda dosyaya alttaki iki satiri ekleyin, intrepid yazan yeri kullandiginiz ubuntu version unun ismi ile degistirmeyi unutmayin.

deb http://us.archive.ubuntu.com/ubuntu/ intrepid main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid main restricted

tabi bunlari yaptiktan sonra apt-get update ile repository listelerini refresh etmeniz gerek.

Stunnel i kendiniz build edecekseniz libssl-dev e de ihtiyaciniz var

apt-get install libssl-dev


Sertifikalari yaratmak:

Stunnel calistirmak icin server ve client sertifikalarina ihtiyac var. Bunlari verisign, thawte gibi bir CA den alabileceginiz gibi kendiniz bir CA olup bu sertifikalari kendiniz yaratip yarattiginiz CA ile imzalayabilirsiniz. Burda bu yontemi uygulayacagiz.

CA yaratmak icin bu satirlari teker teker girin:

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt

Son satirdaki komut sertifikanin detaylarini soracak, bu asamada Common Name alani onemli, daha sonra server in certifikasi yaratilirken de bu alanin girilmesi gerekecek ve bu alanin ondan farkli olmasi lazim. Buraya ornek olsun diye server in ip si CA dedim, yani "xxx.xxx.xxx.xxx CA" gibi bir satir girdim.
Diger alanlari doldurabilir veya gecebilirsiniz.

Server sertifikalarini ve csr yaratmak icin:

openssl genrsa -des3 -out server.key 4096
openssl req -new -key server.key -out server.csr

Common name server in ip si olarak girdim.

Simdiki satirda Csr ile server in sertifikasini alip CA ya gidip bunu imzala demis olacagiz.
openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt

Server da calisan stunnel baslatilirken sertifikadan gelen password ü sormasin istiyorsaniz assagidaki adimi yapin
openssl rsa -in server.key -out server.key.insecure
mv server.key server.key.secure
mv server.key.insecure server.key

Client sertifalarinida benzer sekilde yaratip imzaliyoruz.
openssl genrsa -des3 -out client.key 4096
openssl req -new -key client.key -out client.csr
openssl x509 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt


Server tarafi icin Stunnel.conf

/etc/stunnel/stunnel.conf
da sertifika yollarini yani dizinleri kendinize gore duzenleyin

cert = /root/certs/server.crt
key = /root/certs/server.key

sslVersion = SSLv3

chroot = /var/lib/stunnel4/
setuid = stunnel4
setgid = stunnel4
pid = /stunnel4.pid

socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1

verify = 2
CApath = /certs
CAfile = /root/certs/ca.crt

debug = 7
output = /var/log/stunnel4/stunnel.log

[https]
accept  = 443
connect = 1080
TIMEOUTclose = 0

; vim:ft=dosini

Burda [https] alani ile port 443 de baglanti beklemesini ve 1080 e yoneltmesini soylemis oluyoruz. 1080 de socks proxy dinliyor olacak.

Bundan sonra /etc/default/stunnel4 dosyasini acip ENABLE=0 olan kismi ENABLE=1 yapiyoruz.

ve Stunnel i server da assagidaki gibi baslatiyoruz.
sudo /etc/init.d/stunnel4 start


Server a Socks proxy ( Dante ) kurulumu ve calistirilmasi

Bunu http://www.inet.no/dante/ adresinden indirip kendiniz derleyebileceginiz gibi apt ile de kurabilirsiniz.
apt-get install dante-server

Benim kullandigim dante konfigurasyon dosyasi /etc/danted.conf su sekilde
logoutput: stderr
internal: 127.0.0.1 port = 1080
external: eth0
clientmethod: none
method: none username
user.privileged: proxy
user.notprivileged: nobody
user.libwrap: nobody
extension: bind

client pass {
from: 127.0.0.1/8 port 1-65535 to: 127.0.0.1/8
method: none
}

client block {
from: 0.0.0.0/0 to: 0.0.0.0/0
method: none
}
pass {
from: 127.0.0.1/8 to: 0.0.0.0/0
command: bind connect udpassociate
method: none
}

pass {
from: 0.0.0.0/0 to: 127.0.0.1/8
command: bindreply udpreply
method: none
}
block {
from: 0.0.0.0/0 to: 0.0.0.0/0
}

Dante yi sudo /etc/init.d/danted start ile baslatiyoruz.


Client da Stunnel

Client icin config dosyasi su sekilde. Burdada sertifika yollarini ve stunnel-server-ip yi kendinize gore ayarlayin.
cert = client.crt
key = client.key
sslVersion = SSLv3

socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1

client = yes

[socks]
accept  = 127.0.0.1:1080
connect = stunnel-server-ip:443
TIMEOUTclose = 0

; vim:ft=dosini

Stunnel i client olarak ubuntu da calistirabilirsiniz.
sudo /etc/init.d/stunnel start

veya

client olacak stunnel i sertifika yollarini ve .conf dosyasini duzenleyip windows da da calistirabilirsiniz.

Bu konfigurasyon ile calistirildiginda local de 1080 port da socks server olarak baglanti bekler durumda basliyor.

Yasasin ozgurluk!!! ;)


Referanslar:
http://www.tc.umn.edu/~brams006/selfsign.html
http://www.bock.nu/blog/secure-firewall-bypass-danted-stunnel