Welcome to MyBlog_笑著流淚II
歡迎使用非Internet Explorer瀏覽器,欣賞這裡的一切資訊!!
我是武男, 24歲, 大家都叫我阿男...有的人還會叫我白目研究生...
(FreeBSD & uBuntu)Kernel Upgrade 比一比
Autor 白目研究生
今天難得SA學長發群組信
偏偏兩種OS的Server手邊都剛好有…
就開始Upgrade的不歸路了…
繼續閱讀後都是繁雜的steps…
FreeBSD Kernel Upgrade(6.2-RELEASE -> 6.3-RELEASE-p1)
Upgrade Steps:
# fetch http://people.freebsd.org/~cperciva/freebsd-update-upgrade.tgz
# tar -xf freebsd-update-upgrade.tgz
# sh freebsd-update.sh -f freebsd-update.conf -r 6.3-RELEASE upgrade
# sh freebsd-update.sh -f freebsd-update.conf installThe system must be rebooted with the newly installed kernel before continuing.
# shutdown -r nowFinally, freebsd-update.sh needs to be run one more time to installthe new userland components, and the system needs to be rebooted one times.
last time:
# sh freebsd-update.sh -f freebsd-update.conf install
# shutdown -r now
Upgrade done!!
heaven@wpmu [~] (20:53) uname -a
FreeBSD wpmu.havenlin.org 6.3-RELEASE-p1 FreeBSD 6.3-RELEASE-p1 #0: Wed Feb 13 02:40:56 UTC 2008 root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386
uBuntu Kernel Upgrade(2.6.22-server -> 2.6.24.2)
重大更新如下:
https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/190587
該program會在程式執行後直接取得root權限
user@localhost:
~/bin# gcc exploit .c -o exploit
user@localhost:~/bin# whoami
user
user@localhost:~/bin# ./exploit
——-——- ——- ——- ——-
Linux vmsplice Local Root Exploit
By qaaz
——-——- ——- ——- ——-
[+] mmap: 0×0 .. 0×1000
[+] page: 0×0
[+] page: 0×20
[+] mmap: 0×4000 .. 0×5000
[+] page: 0×4000
[+] page: 0×4020
[+] mmap: 0×1000 .. 0×2000
[+] page: 0×1000
[+] mmap: 0xb7e44000 .. 0xb7e76000
[+] rootroot@localhost:~/bin#
exploit code在這裡
Upgrade done!!
heaven@LDAP-ubuntu:~$ uname -r
2.6.24.2-2.6.24.2
heaven@LDAP-ubuntu:~$ ./test
———————————–
Linux vmsplice Local Root Exploit
By qaaz
———————————–
[+] mmap: 0×0 .. 0×1000
[+] page: 0×0
[+] page: 0×20
[+] mmap: 0×4000 .. 0×5000
[+] page: 0×4000
[+] page: 0×4020
[+] mmap: 0×1000 .. 0×2000
[+] page: 0×1000
[+] mmap: 0xb7d75000 .. 0xb7da7000
[-] vmsplice: Bad address
heaven@LDAP-ubuntu:~$
Upgrade Steps:
參考資料:
http://axp1.csie.ncu.edu.tw/~rick/blog/?p=37
http://x86virtualization.com/virtualizationnews/howto-install-vmware-server-on-ubuntu-710-part-1.html
http://ubuntuforums.org/showthread.php?t=157560
1.若使用ubuntu 6.10 的話,要先把/bin/sh換掉,因為/bin/sh在6.10中預設是指向/bin/dash,而我們要把它指向/bin/bash
#mv /bin/sh /bin/sh1
#ln -s /bin/bash /bin/sh
2. 安裝所需要的工具
#apt-get update
#apt-get install kernel-package libncurses5-dev fakeroot wget bzip2
//沒有裝libncurses5-dev不能執行menuconfig的畫面
3. 下載kernel原始碼,解開它,並建立一個link指向它
sources:ftp://ftp.isu.edu.tw/Linux/kernel/v2.6/
#cd /usr/src
#wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.24.2.tar.bz2
#tar xjf linux-2.6.18.1.tar.bz2
#ln -s linux-2.6.18.1 linux
#cd /usr/src/linux
4. 下載並套用所需要的patch
#bzip2 -dc /usr/src/patch.bz2 | patch -p1
5. configure kernel的設定
#make menuconfig
//這邊建議讀一下config option,不然編了很多用不到的東西很浪費時間
或者可以先套用目前的設定
#cp /boot/config-`uname -r` ./.config
再make menuconfig裡把它load進來
6. 開始編譯了
#make-kpkg clean
#fakeroot make-kpkg –initrd –append-to-version=-custom-version kernel_image kernel_headers
7. 安裝核心
#cd /usr/src
#ls -l
#dpkg -i linux-image-2.6.24.2-2.6.24.2_2.6.24.2-2.6.24.2-10.00.Custom_i386.deb
#dpkg -i linux-headers-2.6.24.2-2.6.24.2_2.6.24.2-2.6.24.2-10.00.Custom_i386.deb
//這邊需要需要提醒的就是在哪裡下的make-kpkg,會在上一層產出這些檔案
8. 若需要的話,修改grub的選單
#vim /boot/grub/menu.lst
#grub-install /dev/hda
//這裡沒有做多餘的處理,因為tools已經自己把grup參數update了
9. 重開機並驗證
#shutdown -r now
#uname -a
–
一知半解最危險…
upgrade kernel真是嚇死人了…
過幾天再把Steps picture補齊了…
–
Reader's Comments
Comment
Options
-
February 15, 2008 -
FreeBSD, uBuntu, 技術文件 -
5 comments
-
Comments RSS
freebsd-update可以upgrade到patch的版本 ?
config跟*.sh沒有看到控制版號的參數
不過upgrade完的version的確可以到p1沒錯…
因為是一邊上班一邊偷偷做的…
中間的過程都還沒有紀錄= =|||
另 ubuntu應該直接用aptitude upgrade 這種應該就可以昇級了吧?
人家…人家還不太會用…(羞)
總算知道為什麼了
root@ubuntu:~# apt-get install linux-headers
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package linux-headers is a virtual package provided by:
linux-headers-2.6.22-14-xen 2.6.22-14.52
linux-headers-2.6.22-14-virtual 2.6.22-14.52
linux-headers-2.6.22-14-ume 2.6.22-14.52
linux-headers-2.6.22-14-server 2.6.22-14.52
linux-headers-2.6.22-14-rt 2.6.22-14.52
linux-headers-2.6.22-14-generic 2.6.22-14.52
linux-headers-2.6.22-14-386 2.6.22-14.52
linux-headers-2.6.22-14 2.6.22-14.52
You should explicitly select one to install.
root@ubuntu:~# apt-get install linux-image
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
linux-image-2.6.22-14-generic linux-image-generic
linux-ubuntu-modules-2.6.22-14-generic
Suggested packages:
linux-doc-2.6.22 linux-source-2.6.22
The following NEW packages will be installed:
linux-image linux-image-2.6.22-14-generic linux-image-generic
linux-ubuntu-modules-2.6.22-14-generic
0 upgraded, 4 newly installed, 0 to remove and 43 not upgraded.
Need to get 18.5MB/21.7MB of archives.
After unpacking 73.8MB of additional disk space will be used.
Do you want to continue [Y/n]?
因為還沒到2.6.24
就自己來了…