分类: Internet

  • Setup Socks Server

    Install dante in server (centos):

  • cd /tmp
    wget http://www.inet.no/dante/files/dante-1.3.2.tar.gz
    tar xvfz dante-*.tar.gz
    cd dante-*
    ./configure
    make
    make install

  • Config dante in server:
    cat /etc/sockd.conf
    #logoutput: syslog stdout /var/log/sockd.log
    #logoutput: stderr
    #logoutput: syslog
    logoutput: /var/log/sockd.log

    internal: 127.0.0.1 port = 1080
    external: venet0

    method: none
    clientmethod: none

    user.privileged: sockd
    user.unprivileged: nobody
    #user.libwrap: nobody

    #compatibility: sameport
    #compatibility: reuseaddr

    extension: bind
    timeout.negotiate: 30
    timeout.io: 86400

    #srchost: nounknown nomismatch
    #client pass {
    # from: 10.0.0.0/8 port 1-65535 to: 0.0.0.0/0
    # method: rfc931 # match all idented users that also are in passwordfile
    #}

    client pass {
    from: 127.0.0.1/8 to: 127.0.0.1/0
    log: connect error
    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
    log: connect error
    method: none
    }

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

    block {
    from: 0.0.0.0/0 to: 0.0.0.0/0
    log: connect error
    }

  • Add init script:
    cat /etc/init.d/sockd
    #!/bin/sh
    #
    # chkconfig: – 91 35
    # description: Starts and stops the sockd(dante) daemon \
    # used to provide socks services.
    #

    PID=”/var/run/sockd/sockd.pid”
    CONFIG=”/etc/sockd.conf”

    # Source function library.
    if [ -f /etc/init.d/functions ] ; then
    . /etc/init.d/functions
    elif [ -f /etc/rc.d/init.d/functions ] ; then
    . /etc/rc.d/init.d/functions
    else
    exit 1
    fi

    # Avoid using root’s TMPDIR
    unset TMPDIR

    # Source networking configuration.
    . /etc/sysconfig/network

    # Check that networking is up.
    [ ${NETWORKING} = “no” ] && exit 1

    # Check that sockd.conf exists.
    [ -f ${CONFIG} ] || exit 6

    RETVAL=0
    OPTIONS=”-D -p ${PID} -f ${CONFIG}”

    start() {
    KIND=”SOCKD”
    echo -n $”Starting $KIND services: ”
    /usr/local/sbin/sockd ${OPTIONS}
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sockd || \
    RETVAL=1
    return $RETVAL
    }

    stop() {
    KIND=”SOCKD”
    echo -n $”Shutting down $KIND services: ”
    killproc sockd
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sockd
    return $RETVAL
    }

    restart() {
    stop
    start
    }

    rhstatus() {
    status -l sockd sockd
    return $?
    }

    # Allow status as non-root.
    if [ “$1” = status ]; then
    rhstatus
    exit $?
    fi

    case “$1″ in
    start)
    start
    ;;
    stop)
    stop
    ;;
    restart)
    restart
    ;;
    status)
    rhstatus
    ;;
    condrestart)
    [ -f /var/lock/subsys/sockd ] && restart || :
    ;;
    *)
    echo $”Usage: $0 {start|stop|restart|status|condrestart}”
    exit 2
    esac

    exit $?

  • enable auto launch during boot

    chkconfig –add sockd

  • dante
    http://www.inet.no/dante/

    SS5
    http://ss5.sourceforge.net/

    DeleGate
    http://www.delegate.org/delegate/

    Srelay
    http://socks-relay.sourceforge.net/

  • DNS/firefox tunnel over ssh socket

    tunnel-dns-through-ssh-d-socks-proxy

    open firefox at URL of about:config

    change the item of network.proxy.socks_remote_dns to TRUE

  • setup git repository mirror

    ## Create empty repository on server

    cd /repo
    GIT_DIR=avxsynth.git git init
    cd avxsynth.git
    git –bare update-server-info
    cp hooks/post-update.sample hooks/post-update

    ## Clone origin repo on workstation
    git clone –mirror https://github.com/avxsynth/avxsynth.git

    ## Setup push URL to the new repo
    git remote set-url –push origin ssh://git.zhenglei.net/repo/avxsynth.git

    ##Push back to the new repo
    git fetch origin
    git push –mirror

  • Debian Wheezy: Setup RTL8192 USB wifi adaptor

    apt-get clear

    apt-get update

    apt-get install wireless-tools

    apt-get install wpasupplicant

    lsusb|grep -i wlan

    apt-cache search -i RTL8188CU

    apt-get install firmware-realtek

    dmesg|grep -i rtl

    iwlist scanning

    iwlist wlan0 scan|more

    nano /etc/network/interface

    auto wlan0
    iface wlan0 inet dhcp
            wpa-ssid               ‘my ssid’
            wpa-key-mgmt     WPA_PSK
            wpa-group            TKIP CCMP
            wpa-psk               ‘my password’

    /etc/init.d/networking restart

    ifconfig wlan0

  • Mirror SVN repository

    #!/bin/bash
    SVN=/mirror/svn
    PRJ=”DD-WRT”
    BASE=${SVN}/${PRJ}
    MIRROR=file://$BASE
    MASTER=svn://svn.dd-wrt.com/${PRJ}
    BUILD=”/build”

    [[ ! -d ${BASE} ]] && {
    svnadmin create ${BASE}

    cat > ${BASE}/hooks/pre-revprop-change <<EOF
    #!/bin/sh
    exit 0
    EOF

    chmod +x ${BASE}/hooks/pre-revprop-change

    svnsync init ${MIRROR} ${MASTER}
    }

    # list
    svn proplist –verbose –revprop -r 0 ${MIRROR}

    #sync mirror against master
    svnsync –non-interactive sync ${MIRROR}

    # list
    #svn proplist –verbose –revprop -r 0 ${MIRROR}

    exit

    # Checkout build
    mkdir ${BUILD}/${PRJ}
    cd ${BUILD}/${PRJ}
    svn checkout -q ${MIRROR}/branches/devel ${PRJ}-devel

    #Update build against mirror
    cd ${BUILD}/${PRJ}
    svn update
    svn log –verbose –limit 3

    # build image
    # http://www.dd-wrt.com/wiki/index.php/Development/zh_cn

  • FW: ddwrt captive portal

    5 Open Source Wi-Fi Hotspot Solutions

     

    DD-WRT

    DD-WRT is a firmware replacement you upload onto a supported wireless router. This changes your router’s control panel and gives you many more features, including several hotspot solutions: Chillispot, NoCatSplash, WiFiDog, and Sputnik. You might also find a use for the other new features as well. For example, you could create a separate wired or wireless network for your private network with VLANs and multiple SSIDs.

    Here’s an overview of the hotspot features in DD-WRT:

    • Chillispot: Gives you great hotspot authentication and management features for free or commercial hotspot locations, but requires an external RADIUS server. However, you can use hosted servers from companies such as Worldspot.net, HotSpotSystem.com, and WirelessOrbit.
    • NoCatSplash: Provides a quick and simple captive portal, but doesn’t include user login or management features. This is still great for single hotspot locations where you want users to agree to Terms of Service (ToS) before getting access.
    • WiFiDog: Gives you an advanced captive portal and content management for free hotspot locations. However, you must configure a proprietary external server.
    • Sputnik: Provides free and commercial hosted services that gives you user authentication and device management for use with free or pay access hotspot solutions.

    CoovaAP is another firmware replacement, based off of OpenWRT, specifically designed for Wi-Fi hotspots. It has the CoovaChilli access controller built-in, giving you captive portal, access provisioning, and accounting features. You can require hotspot users to login with accounts (self registered or defined by you) or just require users to agree to the Terms of Service (ToS).

    CoovaAP also sports WDS (wireless distribution system), great if you’re setting up multiple APs. If you or your organization has a Facebook page, you might want to check out the Facebook captive portal feature. The firmware also has traffic shaping controls so you can limit the bandwidth your guests use.

    For more information on CoovaAP or for help on setting it up, refer to one of my previous tutorial series.

    Open-Mesh

    Open-Mesh is perfect for larger hotspots requiring two or more APs, or even when covering an entire apartment complex or campus. The open source firmware provides the brains and gives you a zero-config, plug & play, and self-healing wireless mesh network. Plug a Open-Mesh node into the Internet and place other nodes nearby to repeat the wireless signal without running Ethernet cables to each. Then you can use their free Dashboard to remotely control and monitor your nodes and networks.

    Though you can flash your own supported equipment with the Open-Mesh firmware, you’ll probably want to buy their branded gear right from their site. The lower-cost model starts at $29 and the professional model with Power-over-Ethernet (PoE) and a few other enhancements goes for $59 each.

    Both Open-Mesh nodes offer two ESSIDs (network names): one for the hotspot users and a separate one that can be encrypted for secure private-use. You’ll also find captive portal features, user authentication and billing options via third-party solutions from Coova.org, WiFi-CPA.com, WorldSpot.net, or your RADIUS server. You can impose bandwidth limits on the public side.

    I’ve also done a tutorial series on Open-Mesh, check it out for more details or for help on getting it setup.

    ZoneCD

    The ZoneCD solution is not a firmware project like many other solutions here. It is a LiveCD loaded with Linux software, preconfigured to serve as a hotspot gateway. Insert the CD into an old computer with two network cards and you have yourself hotspot user authentication and web content filtering. A GUI is provided so you don’t even have to know anything about Linux.

    The hotspot gateway is configurable through a web-based control panel. The free service gives you the basic hotspot functionality. Premium services let you have more control over users and the hotspot, and gives you better support.

    FON

    FON isn’t a mundane hotspot solution. They even have their own language. Fonera is what they call their line of branded Wi-Fi routers. When you share your wireless Internet, creating a FON Spot, you’re called a Fonero. Then you can opt-in as as a Bill to receive 50% of the net revenues, or remain a Linus if you don’t want free money. You’ll also be able to use other FON Spots for free, unlike Aliens which aren’t sharing and must pay or view advertisements to use FON Spots.

    FON’s newest wireless router, called FONERA 2.0N, at $99 provides many more features than the original La Fonera and La Fonera+. Its USB port opens up a whole new world. You can go mobile by plugging in a 3G adapter, download torrents with your PC shut off, quickly upload Videos to YouTube, easily upload your photos to Picasa, Facebook, or Flickr. You might even connect a drive use to use it as a central storage spot (NAS) for all your PCs and Devices. The FONERA 2.0N can even Tweet on Twitter, for example, to let you track downloads and user connections.

    You can download and flash FON’s firmware (based on OpenWRT) for the La Fonera and La Fonera+ onto compatible Buffalo and Linksys routers. You can also experiment with the Fonera 2.0 firmware.

    RouterOS

    RouterOS isn’t just for hotspots, its a complete Linux-based network and routing operating system. Thus this solution isn’t for beginners, it requires more knowledge on network administration. You can, however, download and install RouterOS right onto regular PCs. Just make sure you have some sort of storage drive (IDE, SATA, USB, SD, etc.) and you’ll probably need at least two ethernet cards.

    The hotspot features of RouterOS include a captive portal, internal user directory, user accounting, and bypass for non-interactive devices. It even has trial user and advertisement modes. For more info or configuration help, you can visit their Wiki and documentation.

    Eric Geier is a freelance tech writer. He’s authored many networking and computing books for brands like For Dummies and Cisco Press. He is also the Founder and CEO of NoWiresSecurity, which helps businesses easily protect their Wi-Fi networks with the Enterprise mode of WPA/WPA2 encryption.

  • Open Source Captive Portal

    Coova-Chilli

    http://coova.org/CoovaChilli

    http://www.chillispot.info/

     

     

     

    PacketFence

    http://www.packetfence.org/home.html

     

    pfsense

    http://www.pfsense.com/

     

     

     

    Untangle

    http://www.untangle.com/

     

     

    https://en.wikipedia.org/wiki/Captive_portal

     

     

  • backup vps with dropbox storage

    Create account at www.dropbox.com

    Login to www.dropbox.com from web browser

    Create app of dropbox from: https://www.dropbox.com/developers/apps

    Copy App key & App secret from Dropbox result web page

    Download shell upload tool from  https://github.com/andreafabrizi/Dropbox-Uploader

    Remove config file of upload tool from home, if have:
    ~/.dropbox_uploader

    Get Dropbox exchange token by launch upload tool:
    dropbox_uploader.sh list

    Copy Token key from ~/.dropbox_uploader to your application

     

     

    ***************************************

    Update at 2014/11

    When create app on Dropbox:

    What type of app do you want to create?

    ==> Dropbox API app

     

    What type of data does your app need to store on Dropbox?

    ==>  Files and datastores

     

    Can your app be limited to its own folder?

    ==> Yes

     

    Provide an app name, and you’re on your way.

    ==> project name

     

     

  • Setup ajaxplorer on debian 6

    apt-get install nginx spawn-fcgi

    apt-get install  php5-cli php5-cgi php5-gd php5-mcrypt

     

    #change locale from C to EN UTF-8 by selecting en_US.UTF-8

    dpkg-reconfigure locales

     

    modify .brshrc by adding

    export LANG=en_US.UTF-8

     

     

     

    #config php5 nginx by install a pre-configed deb package

    dpkg -i php-nginx_0.2_all.deb

     

    # restart nginx and php

    /etc/init.d/php-fastcgi stop

    /etc/init.d/nginx restart

    /etc/init.d/php-fastcgi start

     

  • Access Google docs

    Add following URL address in c:windowssystem32driversetchosts

     

    209.85.147.109 pop.gmail.com
    209.85.147.109 smtp.gmail.com
    66.102.7.19 mail.google.com
    209.85.225.101 docs.google.com
    74.125.227.2 docs.google.com
    74.125.227.2 docs0.google.com
    74.125.227.2 docs1.google.com
    74.125.227.2 docs2.google.com
    74.125.227.2 docs3.google.com
    74.125.227.2 spreadsheets.google.com
    74.125.227.2 spreadsheets0.google.com
    74.125.227.2 spreadsheets1.google.com
    74.125.227.2 spreadsheets2.google.com
    74.125.227.2 spreadsheets3.google.com
    209.85.225.102 groups.google.com
    74.125.127.139 spreadsheets.google.com
    74.125.127.100 services.google.com
    74.125.127.100 writely.google.com
    74.125.127.100 sites.google.com
    209.85.225.104 reader.google.com
    74.125.127.101 calendar.google.com
    74.125.39.99 chrome.google.com
    74.125.39.99 clients2.google.com