Updates from กุมภาพันธ์, 2010

  • bass

    How to restrict users to SFTP only instead of SSH

    bass 21:50 on 02/15/2010 | 0 Permalink | Reply
    Tags: allow, scp, sftp, ssh

    Sometimes you want to have users, that have access to files on your server, but don’t want them to be able to log in and execute commands on your server.

    This is done quite easily.

    Add user as usually and assign him a password. Then run the following command (replace the ‘username’ with real user name):

    root@host # usermod -s /usr/lib/sftp-server username

    This changes user’s shell to sftp-server.

    The last step for this to work is to add ‘/usr/lib/sftp-server’ to /etc/shells to make it a valid shell, eg. like this:

    root@host # echo '/usr/lib/stfp-server' >> /etc/shells

    There. Now you’ve setup a user who can only access your server with SFTP.

    Refer : http://www.debian-administration.org/articles/94

     
  • bass

    HowTo: Create sar Graphs With kSar [ Identifying Linux Bottlenecks ]

    bass 08:11 on 02/11/2010 | 0 Permalink | Reply
    Tags: , identifying, , sar

    http://www.cyberciti.biz/tips/identifying-linux-bottlenecks-sar-graphs-with-ksar.html

    Refer From : http://www.cyberciti.biz/

    ปล. เด่ว จะกลับมาเรียบเรืยงใหม่ นะครับ ขอเวลาอ่านแป๊ป

     
  • bass

    Loadavg Convert To Percent

    bass 08:45 on 01/12/2010 | 0 Permalink | Reply

    http://mail.nl.linux.org/kernelnewbies/2001-04/msg00007.html

    http://www.linuxjournal.com/article/9001

    http://mail.nl.linux.org/kernelnewbies/2002-01/msg00162.html

    http://www.howtoforge.com/forums/archive/index.php/t-22033.html

    http://www.faqs.org/docs/Linux-HOWTO/Bash-Prompt-HOWTO.html

    http://www.liamdelahunty.com/tips/linux_load_average_check.php

    เด๋ว จะมาเขียน Shell Script แจก นะครับ

     
  • bass

    ReView BenQ nScreen i91 ลง Ubuntu 9.04

    bass 23:48 on 01/03/2010 | 0 Permalink | Reply
    Tags: benq, i91, , webcam

    Link : http://tonypink.exteen.com/20090707/review-benq-nscreen-i91-ubuntu-9-04

    ReView BenQ nScreen i91 ลง Ubuntu 9.04

    พอดีที่ Office ได้สั่งเจ้าตัวนี้ มาเล่น  20 กว่าตัว และ จะสั่งมาอีกเรื่อยๆ เห็น ว่าพรุ่งนี้ จะเข้ามาอีก 20 – 30 ตัว เพื่อให้ เด็ก พิมพ์งาน

    ปัญหาที่เจอตอนนี้

    ได้ลง ubuntu 9.10 และ โมทุกอย่างแล้ว แต่มีปัญหากับระบบคือ

    Webcam มีปัญหา กับ Wireless

    และ Flash Plugin มีปัญหากับ Webcam ภาพแตก แต่พอมารัน บน java ดันได้ เซ็ง

    ตอนนี้ กำลังจะ Down ลงไปเป็น 9.04 ดูว่าจะมีปัญหาหรือ ป่าวโดยจะใช้ 9.04 amd64

    ReView Hardware: http://www.notebookspec.com/2008/modules.php?name=Content&pa=showpage&pid=2068&page=1

     
  • bass

    How to Replace the Volume Control in Ubuntu 9.04

    bass 23:42 on 01/03/2010 | 0 Permalink | Reply
    Tags: gnome, , volume

    I have recently heard someone cursing Canonical for not implementing the highly acclaimed PulseAudio volume control into the new Ubuntu 9.04 (Jaunty Jackalope) operating system, a function that exists in the newly released Mandriva 2009.1 (Spring) distribution. First, let me tell you what the PulseAudio volume control can offer. Except for the fact it is much better than the old ALSA or OSS sound servers, it will offer you the ability to individually control the volume of each running application that uses the sound server, including web-based ones, such as flash players (YouTube, Google Videos, etc). So, as usual, I thought this would be an easy-to-achieve task and I’ve created the following guide, which will teach you how to replace the default volume control in Ubuntu 9.04 with PulseAudio’s smarter one, in only five minutes!

    This is how the volume control looks like in a default installation of Ubuntu 9.04 (Jaunty Jackalope)…

    Review image

    The default playback sound server is set to ALSA…

    Review image

    Even if you switch to PulseAudio, you won’t have the “Applications” tab we talked about at the beginning of the article…

    Review image

    Therefore, you need to remove the default volume control applet. Right click on it and select the “Remove From Panel” option…

    Review image

    Now, go to System -> Administration -> Synaptic Package Manager

    Review image

    Input your password if asked. When Synaptic is loaded, type pulse in the “Quick search” box. When the results are displayed, left click on the box in front of the gnome-volume-control-pulse entry and select the “Mark for Installation” option…

    Review image

    Click the “Mark” button when asked and click the “Apply” button. When the Summary window appears click the “Apply” button to start the installation…

    Review image

    Wait for the package to be installed…

    Review image

    Close Synaptic and log out! Log back in and you will notice that you have a new volume control…

    Review image

    … one that offers you the ability to individually control the volume of each application that uses the sound server.

    Review image

    Refer : http://news.softpedia.com/news/How-to-Replace-the-Volume-Control-in-Ubuntu-9-04-with-the-PulseAudio-One-112786.shtml

     
  • bass

    IPSET Installation With Compile For iptables

    bass 12:45 on 01/01/2010 | 0 Permalink | Reply
    Tags: , , , ipset,

    The installation requires the following steps

    it is assumed that you have got the kernel source tree, configured and at least the modules compiled
    donwload and unpack the source
    run KERNEL_DIR= make to compile the userspace tool and the kernel modules
    run KERNEL_DIR= make install to install the ipset userspace tool and the kernel modules
    In order to use to the set match and SET target
    you need iptables 1.4.4 (or above), or
    due to the ipset protocol change, you have to recompile iptables before 1.4.4 to get ipset 3.0 (or above) supported:
    Copy the file kernel/include/linux/netfilter_ipv4/ip_set.h from the source tree of ipset-3.9 to include/linux/netfilter_ipv4 in the source of iptables
    Recompile iptables
    and ready!

    Refer : http://ipset.netfilter.org/install.html

     
  • bass

    ArpON: ARP Poisoning Protection -- Note ไว้ กันลืม

    bass 18:50 on 12/24/2009 | 0 Permalink | Reply
    Tags: arp, , netcut

    ArpON: ARP Poisoning Protection
    Submitted by neutron on 13 August, 2009 – 02:18. ARP ArpON networking Poisoning Protection
    ฝันร้ายของ admin ในระบบเครือข่าย อย่างหนึ่งที่เจอกันบ่อย ๆ คือ ARP poisoning หรือที่คนทั่วไปรู้จักกันในชื่อ NetCut ซึ่งปัญหานี้ เป็นช่องโหว่ของระบบเครือข่าย ซึ่งรู้โดยทั่วกันว่า หาทางแก้ได้แบบเด็ดขาดลำบากมาก เนื่องจากทางแก้ที่สมบูรณ์นั้น ต้องได้รับความร่วมมือจากผู้ใช้ด้วย

    ARP poisoning หรือ ARP spoofing คือวิธีการโจมตีลักษณะหนึ่งในระบบเครือข่ายแบบ ethernet ไม่ว่าจะเป็นแบบ มีสายหรือไร้สาย โดยอาศัยช่องโหว่ของ ARP (Address Resolution Protocol) ซึ่งมีระบบความปลอดภัยต่ำมาก เนื่องจาก ARP เป็นโพรโทคอลที่คุยกัน และให้ความเชื่อถือข้อมูลที่ถูกส่งออกมาโดยไม่มีเงื่อนไขในการตรวจสอบที่มา และความน่าเชื่อถือของข้อมูลใด ๆ ทั้งสิ้น ซึ่งช่องโหว่นี้ เป็นที่มาของการปลอมข้อมูล (spoofing) เพื่อหลอกให้ชาวบ้านหลงเชื่อตามที่โกหก

    ในการโจมตี เป้าหมายหลัก ๆ ที่พบบ่อย มีอยู่ 2 สาเหตุ คือ

    การทำ Man-In-The-Middle (MITM) คือ การที่ผู้ก่อการร้าย หลอกให้ชาวบ้านหลงเชื่อว่า ตัวเองนั้น เป็นเครื่องเกตเวย์ของเครือข่าย เพื่อให้ส่งข้อมูลต่าง ๆ มาที่เครื่องของผู้ก่อการร้าย และหลังจากนั้น ผู้ก่อการร้ายจะส่งข้อมูลต่อไปยังเกตเวย์ที่แท้จริงต่อไป ในกรณีนี้ ผู้ใช้จะยังใช้งานได้เหมือนไม่มีอะไรเกิดขึ้น ยกเว้นว่า ผู้ใช้อยู่ในระบบที่มีการตรวจสอบที่มา IP + MAC address ซึ่งกรณีนี้ ระบบอาจจะตรวจพบว่า ผู้ใช้มีการส่งข้อมูลมาจากแหล่งที่ไม่ได้รับอนุญาต แต่หากว่า เครื่องที่ผู้ก่อการร้ายใช้นั้น ได้รับอนุญาตเช่นกัน ก็จะไม่เห็นความผิดปกติใด ๆ เกิดขึ้น
    การทำ Denial-of-Service (DoS) หรือบางครั้งเรียกการทำ blackhole คือ การที่ผู้ก่อการร้าย หลอกให้ชาวบ้านหลงเชื่อว่า เครื่อง เกตเวย์อยู่ในที่ที่ไม่มีตัวตนจริงในระบบ หรือพูดง่าย ๆ คือ ส่ง MAC address ที่ไม่มีเครื่องใดเลยในระบบใช้อยู่ ผลที่ตามมาคือ ผู้ใช้ที่โดนหลอกด้วยการทำ blackhole จะไม่สามารถเชื่อมต่อกับเกตเวย์ของระบบได้ ทำให้ใช้งานเครือข่ายอินเทอร์เน็ตไม่ได้ หรือที่รู้จักกันในนาม NetCut
    โปรแกรมสำหรับทำ ARP spoofing หาได้โดยทั่วไปในอินเทอร์เน็ต และถูกใช้โดยผู้ที่รู้เท่าไม่ถึงการณ์ (และผู้ที่รู้เท่า และถึงการณ์) อย่างแพร่หลาย จึงมีความพยายามที่จะป้องกันการโจมตีในลักษณะดังกล่าวในหลาย ๆ รูปแบบ ทั้งทางฮาร์ดแวร์และซอฟต์แวร์ ซึ่งรู้โดยทั่วกันว่า ฮาร์ดแวร์ที่มีความสามารถในการจัดการเรื่องนี้ มีราคาที่ค่อนข้างสูง ถึงสูงมาก สำหรับระบบเครือข่ายที่มีทุนทรัพย์จำกัด (ทั่วไปในประเทศไทย) นั้น ทางออกที่น่าสนใจ คงตกอยู่ที่ซอฟต์แวร์

    ArpON “Arp handler inspectiON” – http://arpon.sourceforge.net เป็นซอฟต์แวร์ที่ถูกพัฒนาขึ้น เพื่อคอยตรวจสอบ และจัดการ ARP cache เพื่อให้เครื่องที่ใช้งาน ArpON ปลอดภัยขึ้นอีกระดับหนึ่ง ซึ่งเป็นการดี ที่จะติดตั้ง ArpON ไว้ที่เครื่องเกตเวย์ เพื่อที่จะป้องกันการถูกหลอกจากผู้ก่อการร้าย ซึ่งวิธีการติดตั้งเป็นดังนี้

    สำหรับ Lenny (ArpON เป็นแพกเกจใหม่ ซึ่งเข้ามาใน repository หลังจากที่ Lenny release ออกไปแล้ว)

    # cd /var/cache/apt/archives
    # wget ftp://ftp.debianclub.org/debian/pool/main/a/arpon/arpon_1.90-1_amd64|i386].deb
    ติดตั้ง ArpON

    # dpkg -i arpon_1.90-1_[amd64|i386].deb ; apt-get -f install
    สำหรับ Squeeze และ Sid

    # apt-get install arpon
    หลังจากติดตั้งเสร็จ จะต้องมีการตั้งค่า ที่ /etc/default/arpon ซึ่งในแฟ้มดังกล่าวจะมีตัวอย่างการตั้งค่าไว้ทั้งแบบ SARPI (Static ARP Inspection) และ DARPI (Dynamic ARP Inspection) ซึ่ง SARPI จะใช้กับระบบมีการ fix ค่า IP ส่วน DARPI จะใช้กับระบบที่ใช้ DHCP ซึ่งรายละเอียดสามารถอ่านเพิ่มเติมได้ที่เว็บไซต์ของ ArpON

    การกำหนดค่าใน /etc/default/arpon

    SARPI

    DAEMON_OPTS=”-d -f /var/log/arpon/arpon.log -g -i eth0 -s”
    DARPI

    DAEMON_OPTS=”-d -f /var/log/arpon/arpon.log -g -i eth0 -y”
    กำหนดค่าให้ ArpON ทำงาน

    RUN=”yes”
    สั่งให้ ArpON ทำงาน

    # /etc/init.d/arpon start
    ArpON “Arp handler inspection” version 1.90 (http://arpon.sourceforge.net)

    [07/13/2009 - 01:35:22 ICT] Task is forking to background, using /var/run/arpon.pid pid file…

    .
    ซึ่งค่าตั้งที่กำหนดไว้ข้างบน เป็นการกำหนดว่า ให้ ArpON ตรวจสอบ ARP สำหรับอินเทอร์เฟซ eth0 หากต้องการตรวจสอบมากกว่า 1 อินเทอร์เฟซ สามารถกำหนดเพิ่มเติมได้ดังนี้

    DAEMON_OPTS=”-d -f /var/log/arpon/eth0.log -g -i eth0 -s -f /var/log/arpon/eth1.log -g -i eth1 -y”
    ซึ่งจะกำหนดให้

    (-i) eth0 : (-s) SARPI ทำการ log ไปที่แฟ้ม (-f) /var/log/arpon/eth0.log
    (-i) eth1 : (-y) DARPI ทำการ log ไปที่แฟ้ม (-f) /var/log/arpon/eth1.log
    หลังจากที่ ArpON ทำงาน ก็จะตรวจสอบ ARP request/reply ให้ และคอยตรวจสอบความถูกต้องให้อยู่เสมอ ทำให้เครื่องที่เป็นเกตเวย์ปลอดภัยจาก ARP poisoning ในระดับหนึ่ง อย่างน้อยก็ป้องกันได้ “ครึ่งทาง”

    ตรวจ ARP cache table จะพบ

    # arp -n
    Address HWtype HWaddress Flags Mask Iface
    192.168.1.1 ether 00:22:57:62:xx:xx CM eth0
    Flags: CM แสดงให้เห็นว่า ArpON ทำการเพิ่ม 192.168.1.1:00:22:57:62:xx:xx เข้าไปใน ARP cache table แบบ manual ซึ่งหมายความว่า ระบบจะไม่เปลี่ยนแปลงค่านี้เองไม่ว่าจะมีการส่งค่าใด ๆ มาหลอกก็ตาม

    แต่ทว่า การป้องกันเพียงข้างเดียว (ที่เกตเวย์) ไม่เพียงพอสำหรับการแก้ปัญหา ARP poisoning ต้องมีการแก้ที่ผู้ใช้ด้วย ซึ่งหากฝั่งผู้ใช้เป็น Linux, FreeBSD, NetBSD, OpenBSD and Mac OS X สามารถใช้ ArpON เพื่อป้องกันในลักษณะเดียวกับตัวอย่างนี้ได้ แต่หากผู้ใช้เป็น MS Windows แล้ว ต้องหาซอฟต์แวร์ที่ทำงานบน Windows เพื่อมาช่วยจัดการในลักษณะเดียวกัน ซึ่งโดยประสบการณ์ของผู้เขียน ยังให้ข้อสรุปไม่ได้ว่าซอฟต์แวร์ชุดไหนที่ทำงานบน Windows ได้ดี เนื่องจากไม่ค่อยได้ใช้ Windows ถ้า ArpON มีการพอร์ตให้ใช้กับ Windows ได้ก็คงจะดี :P

    ข้อแนะนำเพิ่มเติมสำหรับ admin ที่ดูแลระบบภายในโรงเรียน หรือสถานที่ ที่เครื่องคอมพิวเตอร์ไม่ได้มีการเคลื่อนย้าย สามารถทำ Static ARP ได้เองโดยอาจจะเขียน batch file ให้ระบบทำการเพิ่ม static ARP เข้าไปในระหว่างที่เครื่องเริ่มเปิดใช้งาน หรือใช้โปรแกรมชื่อ ARPFreeze (http://www.irongeek.com/i.php?page=security/arpfreeze-static-arp-poisoni…) ซึ่งช่วยอำนวยความสะดวกในการตั้งค่าเหล่านี้ให้เรา ก็จะช่วยปิดทางการทำ ARP poisoning ได้อย่างสมบูรณ์

    โดย neutron
    Refer : http://debianclub.org/node/492

     
  • bass

    Red5 Install

    bass 20:52 on 12/20/2009 | 0 Permalink | Reply
    Tags: , red5

    Installing Red5 on Debian
    This howto was provided by Nathan P. Johansen.

    The following are steps used to get Red5 running on a Debian machine. This is the development version of Red5.

    Before beginning this make sure you are running these commands as root.

    Install Subversion:
    apt-get install subversion
    Install tools to build your own Debian packages:
    apt-get install dpkg-dev debhelper dh-make devscripts fakeroot
    Install Java (see this tutorial for more info):
    apt-get install java-package
    Install Apache Ant 1.7:
    wget http://apache.mirror.transip.nl/ant/binaries/apache-ant-1.7.1-bin.tar.gz
    tar zxvf apache-ant-1.7.1-bin.tar.gz
    mv apache-ant-1.7.1 /usr/local/ant
    export ANT_HOME=/usr/local/ant
    Once Java and Ant are all set up you simply download the latest development version of Red5 to your box.
    svn co http://red5.googlecode.com/svn/java/server/trunk red5-trunk
    That will create a folder in your current directory called red5-trunk.

    Navigate to the red5-trunk directory and run ant
    cd red5-trunk
    /usr/local/ant/bin/ant
    That will build the project on your machine.

    At this point you will need to create a red5 directory in the /usr/local/red5 directory.
    mkdir /usr/local/red5
    Then you will want to copy the contents of the dist(distribution) folder to /usr/local/red5 like so
    cp -R red5-trunk/dist/* /usr/local/red5/
    We need need to fix the permissions on the red5.sh file:
    cd /usr/local/red5
    chmod 755 red5.sh
    To run the server you have a few options using the red5.sh file. Run the server by either running
    sh red5.sh &
    or

    ./red5.sh &
    This will start the Red5 service manually.

    Verify the correct ports are being bound to:
    netstat -ant
    You may need to edit the red5.properties file in the /usr/local/red5/conf directory if you can’t connect to your server from an external location. Try to connect to the server before you modify the properties file because you may be able to connect to it with no problems.

    Refer : http://osflash.org/red5/debian

     
  • bass

    Nero to ISO On Debian or Ubuntu

    bass 09:40 on 12/18/2009 | 0 Permalink | Reply

    Debian
    apt-get install nrg2iso

    Ubuntu
    sudo apt-get install nrg2iso

    nrg2iso image.nrg image.iso

    แค่นี้ก็จบแล้ว 555+…

     
  • bass

    Ubuntu 8.04 Hardy LDAP Client เอาไว้ทดลอง

    bass 00:50 on 12/11/2009 | 0 Permalink | Reply
    Tags: desktop, , ldap client,

    Ubuntu 7.10 was a nightmare when it came to setting up ldap, but 8.04 improves this process quite a bit.

    We are going to set up a Hardy client on a desktop machine, which involves using NFS (for /home) and allowing all desktop users to do desktop tasks.

    apt-get install libpam-ldap libnss-ldap nss-updatedb libnss-db nfs-common nscd

    Answer the questions; unlike Debian they should actually be put in the configuration file.

    Make sure to transfer over your certifiate if you use SSL. I like to use /etc/ldap/ssl

    Edit /etc/ldap.conf (which both libnss and libpam use).

    host 192.168.1.1
    base dc=example,dc=com

    #This is important! Don’t use ldap:///192.168.1.1
    uri ldap://example.com/
    ldap_version 3
    rootbinddn cn=admin,dc=example,dc=com
    port 389
    bind_policy soft
    pam_password crypt
    ssl start_tls
    tls_checkpeer no
    tls_cacertfile /etc/ldap/ssl/cert.pem
    nss_initgroups_ignoreusers avahi,avahi-autoipd,backup,bin,daemon,dhcp,games,gdm,gnats,haldaemon,hplip,irc,klog,libuuid,list,lp,mail,man,messagebus,news,polkituser,proxy,pulse,root,sync,sys,syslog,uucp,www-data

    Now edit /etc/ldap/ldap.conf

    BASE    dc=example,dc=com
    URI    ldap://example.com
    TLS_CACERT /etc/ldap/ssl/cert.pem
    TLS_REQCERT never

    /etc/pam.d/common-account

    account    sufficient   pam_ldap.so
    account    required     pam_unix.so

    /etc/pam.d/common-auth

    auth       sufficient   pam_ldap.so
    auth       required     pam_unix.so nullok_secure use_first_pass

    /etc/pam.d/common-password

    password   sufficient   pam_ldap.so
    password   required     pam_unix.so nullok obscure min=4 max=8 md5

    /etc/pam.d/common-session

    session    required     pam_unix.so
    session    required     pam_mkhomedir.so skel=/etc/skel/
    session    optional     pam_ldap.so

    /etc/nsswitch.conf

    passwd: files ldap

    group: files ldap

    shadow: files ldap

    hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
    networks:       files

    protocols:      db files
    services:       db files
    ethers:         db files
    rpc:            db files

    Now we want to make sure users are assigned to the correct groups when they log in, so add the following to /etc/security/groups.conf

    gdm;*;*;Al0000-9000;floppy,audio,cdrom,video,plugdev,scanner

    Hal does not recognize this, however, so delete the following entries from /etc/dbus-1/system.d/hal.conf

    <deny send_interface=”org.freedesktop.Hal.Device.Volume”/>
    <deny send_interface=”org.freedesktop.Hal.Device.Volume.Crypto”/>

    We need to edit /etc/pam.d/gdm for the groups.conf file to take effect, so add the following

    auth optional pam_group.so

    As root, run

    nss_updatedb ldap

    To mount /home over NFS, add the following to /etc/fstab

    192.168.1.1:/home       /home   nfs defaults 0 0

    Refer : http://linuxadministration.us/2008/05/17/ubuntu-804-hardy-ldap-client/

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
esc
cancel