GeekyLog - BlueT's LoGeeks, Logics of Geek Thinks.

To content | To menu | To search

Thursday 2011 March 17

HOWTO: PPTP: Ubuntu Client connect to Windows VPN Server

The company I work for just starting to use Windows ISA Server (or whatever) in some places.
And also, they use the Windows server to be a VPN server.
As Micro$oft doesn't officially support OpenVPN, and we don't consider IPsec to be used for end users, they decide to use the fu*king insecure PPTP, which I would definitely never wanna try.
That's where my Nightmare starts.

After some tries, I can use the VPN on my Android phones, and it seems works fine on iPhone, too.
But I just can't get it work on my Ubuntu boxes. The VPN connection just cannot established and I got error in my /var/log/syslog like this:
Mar 17 00:03:13 0xB1uE7 pppd17577: EAP: peer reports authentication failure


No matter what, I got it work in the end, finally.
And these are the steps how to get it work.




  1. $ apt-get install network-manager-pptp
  2. $ sudo /etc/init.d/network-manager restart
  3. Click the NetworkManager Applet
  4. VPN Connection -> Configure VPN -> <VPN> -> Add
  5. Choose <Point-to-Point Tunneling Protocol (PPTP)> -> Create
  6. Fill out those neccessary informations and click Advanced
  7. In Authentication section, CANCEL <PAP>, <CHAP>, and <EAP>, KEEP ONLY <MSCHAP> and <MSCHAPv2> SELECTED.
  8. In Security and Compression section, SELECT <Use Point-to-Point encryption (MPPE)>, and choose Security to be <All Available (Default)>
  9. OK -> Accept -> Close
  10. Now click the NetworkManager Applet
  11. Click VPN Connection and click the profile you just created.
  12. Wait for few seconds till it get connected.
  13. Done.




Hope this HOWTO can save a tree and a kitten.


Monday 2010 September 13

[Note] perlbrew + cpanm + perl 5.12.0

本文轉載自 使用 perlbrew 來安裝 perl-5.12.0 跟 cpanm 的筆記 - FourDollars Blog

perlbrew 的好處就是可以使用一般使用者的權限來安裝 perl 跟其模組,不用擔心會破壞到原本系統的穩定性。

首先去抓 gugod 在 GitHub 上的 perlbrew 接者開始安裝 perl-5.12.0

     git clone git://github.com/gugod/App-perlbrew.git
     cd App-perlbrew
     ./perlbrew install
     ./perlbrew init
     source ~/perl5/perlbrew/etc/bashrc
     perlbrew install perl-5.12.0
     perlbrew switch perl-5.12.0


然後去抓 miyagawa 在 GitHub 上的 cpanm 回來安裝

     git clone http://github.com/miyagawa/cpanminus.git
     cd cpanminus
     ./cpanm .


再回去用 cpanm 重新安裝一遍 perlbrew (因為第一次安裝時會少裝一些文件檔案)

     cd App-perlbrew
     cpanm .


以上步驟做完就可以有一個最簡單的 perl-5.12.0 的執行環境
之後使用前可以手動執行 source ~/perl5/perlbrew/etc/bashrc
或是直接把 source /.bashrc 裡面

P.S. 可以先將家目錄底下的 .cpan .cpanm .cpanplus 目錄都刪除掉 (或是更名就可以了) 再開始執行上面的步驟比較不會發生一些奇怪的問題

Saturday 2010 July 10

Web Log Visualization

$ logstalgia --output-ppm-stream - -s 10 -f --start-position 0.01 --stop-position 0.2 severity_v2_access.log.filter-118.160.72  --output-framerate 30 |  ffmpeg -y -b 256K -r 30 -f image2pipe -vcodec ppm -i - -vcodec libx264 coscup2010-register_0.01-0.2_speed10_45min-filter_118.160.72.mp4

Saturday 2009 November 28

±€231

It's ±€231 for my price.

Thursday 2009 October 29

www.ubuntu-tw.org reaches 1M hits per day, again.

Ubuntu@Taiwan 正體中文站 討論區+wiki 又重回每日點擊百萬數了。
伺服器不穩定了好一陣子,現在終於重回當年盛況,每日點擊數超過一百萬! XD
特此紀念。

Thursday 2009 September 24

KVM - build ubuntu guest, bridge network and iptables port forwarding

Once you install and setup KVM, configure kvm itself and system network bridge interface correctly on your Ubuntu server,
you can now starting to build a guest OS / disk image, run it, and use iptables to forward connections to those new VPSes.


Build guest:

HTTP_PROXY="Proxy_IP:Port" sudo ubuntu-vm-builder kvm hardy \
  --dest 'DEST_DIR'\
  --hostname 'GUEST_HOSTNAME'\
  --ip 'GUEST_IP_YOU_WANT'\
  --arch 'i386'\
  --mem '256'\
  --rootsize '4096'\
  --swapsize '1024'\
  --kernel-flavour 'virtual'\
  --domain 'bluet.org'\
  --mirror 'http://ftp.twaren.net/ubuntu'\
  --components 'main,universe,multiverse,restricted'\
  --addpkg ssh --addpkg vim  --addpkg unattended-upgrades --addpkg acpid\
  --name 'Default_User_Name'  --user 'Default_User_Account'  --pass 'Default_User_Password'\
  --mask '255.255.255.0'\
  --net '192.168.122.0'\
  --bcast '192.168.122.255'\
  --gw '192.168.122.1'\
  --dns '192.168.122.1'\
  --tmp '/dev/shm/'\
  --libvirt qemu:///system ;


Modify that to fit your needs.

Forward "connections to specific port on HostOS" to a specific port on GuestOS (VPS):

Run these commands in HostOS:

$ sudo iptables -t nat -I PREROUTING -p tcp -d HostOS_IP --dport HostOS_Port -j DNAT --to GuestOS_IP:GuestOS_Port
$ sudo iptables -A FORWARD -p tcp -d GuestOS --dport GuestOS_Port -j ACCEPT


For example, if you want to ssh to your VPS, you can pick a spare (not-using by other application) port, and forward "connections to the specified port on HostOS" to the GuestOS's port 22.
Let's say, when HostOS is using IP 192.168.1.2, GuestOS is using IP 192.168.122.2, the choosen port on HostOS is 10022, you can do the following commands.

$ sudo iptables -t nat -I PREROUTING -p tcp -d 192.168.1.2 --dport 10022 -j DNAT --to 192.168.122.2:22
$ sudo iptables -A FORWARD -p tcp -d 192.168.122.2 --dport 22 -j ACCEPT



Finally, you got a configured VPS, you can start running it and ssh into it.

Start the VPS:
If your GuestOS' hostname is "vps01", you can do this to start running it:
$ virsh start vps01
And then ssh into it:
$ ssh -v 192.168.1.2 -p 10022


Refs: KVM document page on ubuntu.com

How to flush / clean DNS cache in Linux

Sometimes your system caches too much on DNS query / records.

DNS caching helps alot on reducing time and bandwidth when your application needs DNS informations,
but just like anything else in the world; it's not a good thing when it does too over.


Let's see how to flush DNS cache in your system.


In Ubuntu:

$ sudo /etc/init.d/dns-clean restart

For Others:

Flush nscd DNS cache:

$ sudo /etc/init.d/nscd restart
OR
$ sudo service nscd restart
OR
$ sudo service nscd reload
OR
$ sudo nscd -i hosts

Flush dnsmasq dns cache

$ sudo /etc/init.d/dnsmasq restart

Flush caching BIND server dns cache

$ sudo /etc/init.d/named restart
OR
$ sudo rndc flush


Refs: How To Flush Linux / UNIX DNS Cache

Tuesday 2009 July 21

HITcon 2009 WasGame 解題分享

這次很開心跟 Dark, H4K, TW1943 一起組隊玩 wargame.
當初預定拿 200 分的目標有達到, 雖然沒拿第一名不過重點是培養了團隊默契, 感覺真的很棒.
回想起四五年前和 devil2k 一起 team hacking 德國佬網站的日子, 到現在已經很久沒有這種感覺了.
謝謝你, 2963. 啊不是, 我是說, 謝謝你們, Zuso Security 的朋友們.

其實應該可以再拿 80 分的... 因為
guestbook 在最後十分鐘 admin 沒進來, 所以沒拿到 session.
有兩題 windows 題在時間結束後十分鐘內解出來


此次 windows 題都是 Dark 跟 H4K 解的, 我只能分享 Unix 跟 Misc.


此次大多用 Perl, Firefox + Firebug + LiveHttpHeaders, telnel, strings, VirtualBox + XP 等工具解題

Unix1: 看 source code 後, 把參數準備好餵進去就行了. 在 PATH_INFO 卡一陣, 後來 h4k 找到了.

Unix2: 用黑刀 dezend 在 winxp 解出 source code, 再讀一讀就出來了.

Unix3: dump, gdb 都沒用. 會後才看 timhsu 的 DefCon 分享找出 kill -11 core dump + strings, 好像解出來了.

Unix4: 第一天 guest password 被改掉, 第二天連不上, 殘念...

Misc1: hack the _ 用 google 就行. 不過題目是五個底線, 我就找五個字母的不過都不對.....答案確是六個字母....這有點誤導不太好 Orz

Misc2: 卡了一陣,用 Perl 將亂碼的每一個 char 分開用 ord() 印出, 會發現 2xx 2xx 2xx 160 2xx 2xx 2xx 160 ..., 用 hex, 重組等方式試了好久沒結果. 後來想說 160 應該是分隔號, 用 space 代進找出 shift 數目, 處理完後用 chr() 印出就成了!

Misc3: 也卡好久, 又是找浮水印又是做圖形處理的. 後來 TW1943 在 google 提示找到特殊字行比對就成功了 XD

Misc4: git 的, 沒解出來. 因為不熟 git, 偶爾用的 github config 是 git://xxxxxx/xx/xx.git, 也不合. 會後才知道 git://xxxxx/ 也可以... Orz

Misc5: D311 網站, 改了 post data 又追 html 又追 javascript, 還找到 order -> backet -> backetsubmit -> score -> backet 和 admin.js 等等的流程, 想說這會不會是很大的題目所以追了整個 .150 的 pages... 結果 TW1943 用 input value 猜一猜試到規則...評直覺 1500 下去就過了....繞了那麼大一圈, 想當初我還猜了 1699 為什麼沒過, 1699 才是 D311 的價錢吧! XD

Misc6: 這是 timhsu 的題目....用 hexdump 跟 gdb 都沒用. 會後聽 tim 提示他的 defcon 分享看了一下才知道用 kill -11, 再把 core strings, 好像解出來了.

Misc7: 又是 git... .git 裡的 index 跟 pack 又不 match. 後來搞好久又 rebuild index 又 unpack .pack 都 error, 就在失望之際用 git gui 看了一下... 耶?! 我已經救回來啦?! XD 看 history/diff 就有 key 了 :P

Misc8: guestbook. 解 javascript 解完, 是過濾 input 的...但是這題到底要我們幹嘛? 到最後才想到是要 XSS 偷 admin cookie / php session id, 可是結束前十分鐘關主就休息沒登入了...所以沒偷到, 慚念.

Misc9: python 2.6 reverse engineering... 去年也有, 看到有點火. 這是 language specific 的東西, 跟 .git 一樣都是綁定的, 有點不是很開心. 這題試了好些 decompile tool 都沒啥用, 不然就是看不懂結果. 有參賽者把它轉成 2.5 的解開了.

Misc10: packet.pcap. 看到是 802.11 WEP encrypted, 用 aircrack 一下就成了.

Misc11: 一堆正妹圖... 又是 strings, 圖片資訊等等的都找過一次都不對, 然後又觀察圖片上有些字糊掉變型去猜, 也不對. 會後關主說是每一個 file 裡都有 gps 座標, 全連起來後一堆點點會拼成 "32E" 的字....而且說所有圖的主角都是 32E!! XDDD

Misc12: 一開始看到 cookie 改了下拿到 key, 可是 upload 後確是 error! 搞一陣 Misc13 開了, 才發現那是 Misc13 的 key XD 晚上跟 Orange 交換心得時經提示後試了下, 這題是 parent dir 有 indexing enabled, 找 config 再登入就能拿到 key.

Misc13: 參見 Misc12....是改 cookie

Misc14: 又是 python. hate.


會後,
約好名年 Zuso 要 BF 一隊, 咱四個一隊, 攻下第一二名 XD

(TBC)

Sunday 2009 July 12

FSCK Gandi's Blog Service Again.

There seems No Way to change my blog's theme/template....

I need 64bit kernel on my 32bit Ubuntu system...

1. I got 4G ram installed on my IBM X61 Laptop, with Ubuntu 9.04 Jaunty Desktop for i386 installed.
2. I need to use my whole 4G of ram bcoz I always has about 400 tabs opened in my Firefox.

All 32bit system can allocat only 33.5G of memory.

X61 uses Intel chips and VGA chip, which is some kind of shit.
Want to improve the xorg's intel driver, you got to install the latest kernel and driver, with UXA mode enabled.
Then, you might get glxgear score about 700~800fps, nice.

Now here comes the problem.
Kernel's PEM conflicts with UXA, and makes the UXA's advanced GPU memory handling unusable.
So I can only have two choice:
1. Use generic kernel and better graphic performance, but only 3G of ram. But my memory is always full.
2. Use server kernel, got whole 4G of ram, but the glxgear score is only about 220fps. Sucks!

With 64bit system, the kernel can natively support to 64G of ram, so I can use 64bit generic kernel with whole my 4G of ram and enjoy the 800fps glxgear score. That's Great!

BUT, How To Install a AMD64 (64bit) Kernel on my i386 (32bit) System?
I did some google search but still find nothing really helpful...

FSCK GANDI's Blog Service.

I spend about half of an hour of my time to write my blog post and submit.
No error, the input box became blank. It's usual when posting a post successfully.

But when I check my blog, nothing shows.

Back to the dashboard and click some link, I asks me to login again.
WTF?! Where's My Article?! Damned It!!!!

Wednesday 2009 July 8

sockstat for Linux

sockstat was only for freebsd, now it's on linux too. something like ‘lsof -i -n’ or ‘netstat -anpe‘.

You can get the 0.3-1ubuntu1 version at the "Builds": https://launchpad.net/ubuntu/+source/sockstat/0.3-1ubuntu1

I download it and install it on my jaunty i386 without any problem.
Intro by chihchun: http://people.debian.org.tw/~chihchun/2009/02/23/sockstat-for-linux/

I need Rest... 我需要放假休息...

I need Rest

Monday 2009 July 6

暌違多年

原來我還有這樣的一個 blog 被遺忘了了 :-) 科科科

Tuesday 2007 November 20

Language

What I want is a English or Chinese Interface, why does Gandi force me to use French?
Orz

Monday 2007 November 19

Premier billet

Je suis le premier billet. Modifiez moi.