Farlock.org

Farlock.org

What you want to hack today?

Farlock.org RSS Feed
 
 
 
 

Install Debian HotSpot server

NB: this is only a memo for me, i’m going to rewrite it in a decent way :P

apt-get update && apt-gt dist-upgrade

apt-get install squid

apt-get install build-essentials debhelper

wget http://ap.coova.org/chilli/coova-chilli-1.0.X.tar.gz
 tar xzf coova-chilli-1.0.X.tar.gz
 cd coova-chilli-1.0.X/
 dpkg-buildpackage -rfakeroot

dpkg -i coova-chilli_1.0.12-1_amd64.deb

apt-get install libapache2-mod-php5  cedar-backup2 frox squid
apt-get install bzip2 cdrdao cdrecord chrony
apt-get install mysql-server freeradius freeradius-mysql
apt-get install genisoimage mkisofs
apt-get install mysql-server maradns iptraf hdparm
apt-get install nut ntpdate nullmailer nut-usb
apt-get install pwgen php5-mysql phpmyadmin arping
apt-get install setserial smartmontools tofrodos ulogd

dpkg-reconfigure -plow nullmailer

chmod 750 /usr/sbin/arping
chgrp operator /usr/sbin/arping
chmod u+s /usr/sbin/arping

wget http://internap.dl.sourceforge.net/sourceforge/haserl/haserl-0.8.0.tar.gz
./configure make make install

adduser backup cdrom
adduser www-data dialout
adduser --disabled-login --no-create-home --home /opt/frox --system --ingroup nogroup frox
adduser --no-create-home --home /tmp --ingroup operator --system --disabled-password hotspot
mkdir /opt/frox /opt/squid
mkdir /mnt/backup/collect /mnt/backup/hotspot /mnt/backup/stage /mnt/backup/tmp
mkdir /mnt/log/coova /mnt/log/frox /mnt/log/iptables /mnt/log/squid

export PS1='$(hostname -f):\w\$ ' in /root/.bashrc

in /etc
frox.conf cback.conf hosts modules smartd.conf syslog.conf ulogd.conf

/etc/apache/sites-available
abilitare i due eth e disabilitare il default

/etc/chilli (editare)
/etc/chrony/chrony.conf
/etc/cron.d -> hotspot_status archive_log cedar-backup2
/etc/cron.daily/sysklogd
/etc/cron.weekly/sysklogd
/etc/freeradius
/etc/default -> chilli frox smartmontools
/etc/logrotate.d/ -> squid iptables_log
/etc/maradns
/etc/php5/apache2/php.ini
/etc/nut
/etc/squid/squid.conf (editare)

controllare file per ip e hosts

chown proxy.proxy /opt/squid/
squid -z

chown frox.nogroup /opt/frox/
chown frox.nogroup /mnt/log/frox
chown proxy.proxy /mnt/log/squid

Huawei E220 - NSLU2 OpenWrt

#ipkg install http://downloads.openwrt.org/snapshots/ixp4xx/packages/huaweiaktbbo_1_armeb.ipk

VPN Client with NSLU2 and OpenWrt

  • Login again in your hacked nslu2
  • Install needed package:

# ipkg install ppp openvpn chat openntpd

# ipkg install http://downloads.openwrt.org/snapshots/ixp4xx/packages/hwclock_2.13.0.1-2_armeb.ipk

  • And let configure them:

# vi /etc/ntpd.conf

server 193.204.114.232
server 193.204.114.233
server
ntp1.inrim.it # or a ntp server near you
server
ntp2.inrim.it # or another ntp server near you
listen on *

# /etc/init.d/ntpd disable

# /etc/init.d/ntpd start

  • We use a bridge configuration for network, edit /etc/config/network and add this line in eth0 section:

option type ‘bridge’

  • Copy gprsd.sh in /usr/scripts
  • Copy gprsd in /etc/default and edit it
  • Copy custom-user-startup into /etc/init.d/

# /etc/init.d/custom-user-startup enable

  • run # crontab -e and add

*/3 * * * * /usr/script/gprsd.sh checkrunning &

  • copy chat and peers directory into /etc/ppp
  • Copy openvpn into /etc
  • Edit /etc/default/openvpn, add “ENABLED=1” and change config file
  • Edit /etc/init.d/openvpn, add “ENABLED=0″ and this to start () function:

if [ "$ENABLED" != "1" ] ; then
echo “$BIN disabled, check $DEFAULT”
exit 0
fi

  • run #/etc/init.d/openvpn enable
  • bla bla bla (nice in openvpn.conf)

Configure OpenWrt on Nslu2

  • Point a browser to your new nslu2 IP (in my case 10.1.20.26) and set a new password.
  • Set your time zone (with web interface is easier ;-) )
  • Login into your nslu2 with ssh (user root, password whichever password you set previously)
  • Disable Web interface (we don’t need it ;-) ):

# /etc/init.d/webif disable

# /etc/init.d/httpd disable

  • Change the hostname:

# vi /etc/config/system and edit the “option hostname” line

  • Fresh our installation:

# ipkg update && ipkg upgrade

  • Install kernel modules for usb support:

# ipkg install kmod-usb2 kmod-usb-storage kmod-usb-ohci kmod-usb-serial

  • Install kernel modules for some cellular (Motorola, Samsung,…):

# ipkg install kmod-usb-acm

  • Install kernel modules for some USB modem (Huawei E220):

# ipkg install kmod-usb-serial-option

  • Install any other kernel modules for (almost) all serial converter (such usb modem):

# ipkg install kmod-usb-serial-visor kmod-usb-serial-sierrawireless kmod-usb-serial-pl2303 kmod-usb-serial-mct kmod-usb-serial-ftdi kmod-usb-serial-belkin kmod-usb-serial-airprime

  • Install kernel modules for usb disk:

# ipkg install kmod-nls-cp1250 kmod-nls-utf8 kmod-nls-base kmod-fs-vfat

  • Install useful package:

# ipkg install usbutils pciutils minicom ntpclient

  • Add this line into start() function of /etc/init.d/boot:

echo 0 > /sys/class/leds/status/brightness
echo 0 > /sys/class/leds/ready/brightness

Install OpenWrt on Nslu2

  • Download latest version of openwrt binaries from http://www.slug-firmware.net/ (or http://downloads.openwrt.org/snapshots/ixp4xx/openwrt-ixp4xx-squashfs.img for development version)
  • Install UpSlug2 (utility to upgrade the firmware of a LinkSys NSLU2 via the network), into Debian-based system, simply type “apt-get install upslug2″
  • Put Nslu2 in upgrade mode (hold-on the reset switch, turn-on the nslu2, wait 10 seconds until “Ready/Status” led blink alternatively red/green, release reset switch)
  • Connect network cable ;-)
  • On command line type: upslug2 - you should receive an output similar to this one:

etch:~/nslu2/709# upslug2
NSLU2     00:14:bf:70:dc:86 Product ID: 1 Protocol ID: 0 Firmware Version: R23V63 [0x2363]

  • Now upload the downloaded image:

etch:~/nslu2/709# upslug2 -i openwrt-kamikaze-7.09-nslu2.bin

  • The ouput should end with:

Rebooting… done

  • Now, if you have a DHCP server enabled on your network, Nslu2 take IP address from it.

Nslu2 RS232 - Adding serial connector

Adding a serial port to our nslu2 is very easy. You can solder a Male or a Female DB9 serial connector, remember, if you use a male connector (such a normal pc) you can plug any kind of serial device and you it as a console port (with a correct cable); if you use a female connector you can plug that port directly into another computer and use only as console.

NSLU2 has one serial port with TTL signal-level (3.3V), for more information read this.

I don’t want to see anything outside the nslu2 (only the connector itself) so i’ve looked for a microchip that doesn’t need anything else than RX-TX and power supply.

So i found MAX3233 (datasheet), it’s fantastic! You need only one 0.1uF capacitor for spurious power supply (really, i don’t use it ;-) ).

Here is the tipical schematic of MAX3233 from www.maxim-ic.com:

As you can see we can have up to two serial port, and no need of external capacitor.

Starting opening our nslu2 and looking near battery. You can see four unused hole, this one is RS232 pins (looking image 1).

The first one (near battery) is 3.3 V, the second one is RX, third is TX and fourth is GND. Take 4 piece of cable and:

- connect pin 1 of nslu2 to pins 5-9-10 of MAX3233;

- pin 2 with pin 1 of MAX3233;

- pin 3 with pin 3 of MAX3233;

- pin 4 with pin 18 of MAX3233;

Now you can solder also the serial connector, pin 5 is ground so connect it with pin 18 of MAX3233.

Assuming that you are using a male connector you have to solder pin 3 of DB9 with pin 19 of MAX3233 and pin 2 of DB9 to pin 20 of MAX3233. If you use a female connector (only for console) simply invert pins 2 and 3 onto DB9 connector.

Adding SD/MMC to Fonera (Fon2200)

Fon2200 SD/MMC reader

Fon2200 SD/MMC reader

I’m going to describe how to connect an MMC card (with an home-made reader) to new Fonera.

This new model is tagged with FON2200 and have a new board design, different from the old one (FON2100).

Categories

Archives