Saturday, 19 October 2013

Bash script wrapper for Easy Firewall Generator IPTables

I wanted a gateway firewall, to share internet access from one interface to another.  Iptables is excellent for this, but setting it up manually is a pain.

Easy Firewall Generator provides a excellent gateway iptables script but in my environment the interface names could change and manually editing the script is no good.

This script basically a 'wrapper script' for the Easy Firewall Generator script, with a few mods.

The usage is: 
./ics.sh -i [Internet Interface] -e [Sharing Interface] -a [Sharing IP Address]
 
For example, if eth0 had internet access and I wanted to share the internet connection to hostapd wlan0 (10.0.0.1) then the command to enable sharing would be:

./ics.sh -i eth0 -e wlan0 -a 10.0.0.1


You will need to generate a iptables 'firewall script' using the Easy Firewall Generator site.
  • On the website just select arbitrary values for the interfaces and ip addresses.
  • On the website, in section "Select Type of Internet Address ", select "Dynamic Internet IP Address"
  • Click generate, save the code, comment out the "Internet Interface" and the "Local Interface Information" sections in the saved 'firewall script'.
  • In the 'firewall script' remove the first line "#!/bin/sh"
  • Then add the raw 'wrapper script' below to the top of your firewall script.
  • Save and chmod +x the file before trying it out.


Those instruction suck.
Find the script here or below:




WindyCityTech Blogger
WindyWindyCityTech Wordpress

UPDATE: Modern Bash Wifi Connection Script for Linux; goodbye network manager

An update to a previous post.  This script has some more command line features, including a random_config_mode.

The random config mode can be used to check several AP's in the area for internet access.  In internet cannot be found, the script will randomly try another connection until internet can be found again.  The timer to check for internet access is randomly set between 60 to 90 seconds for an extra touch.
A preferred AP can be initially chosen in the random mode, so if it does fail, another connection will become selected.  In no way is this script perfect, results may vary depending what distro you are using.

Completely run from the command line.  Great for Raspberry Pi.

View it here: http://pastebin.com/vcVC9iL9

or below.



WindyCityTech Blogger
WindyWindyCityTech Wordpress

GNURADIO needs a urgent overhall

From the GNURADIO website: "GNU Radio has a steep learning curve", Fuck off, what it really means is:

GNU Radio is porly written / implemented / not user fiendly / has too many obscure install options and is designed to simply waste your time.

Furthermore the build-gnuradio script is fucking stupid.  It will ruin your system, beware.  Best to stick to the deb packages if you are on Debian.



WindyCityTech Blogger
WindyWindyCityTech Wordpress

Thursday, 10 October 2013

Get back the Black Bar Toolbar on Google


Why do Google remove efficient mouse based UI's for favor touch screen based UI's on PC platforms?  After the trouble everyone was having with the Google Compose in Gmail, this is another nail in the coffin.

The issue access to apps like "Drive",  "Calendar", "News", etc is NOW restricted by the need to navigate a grid all the way on the right side of the screen.  This focus stealing design is no way efficient and only tailors a user experience for touchscreen users.
What used to be "Look, Point, Click" is now, "Scroll Right, Click, Look, Read, Click".
Great F*ckin Work

There is a solution for the new time robbing issue:
Install Stylish from Userstyles.org or from FF Addons page.
Install Google black nav bar returns from the Userstyles.org page.

On a serious note, these stop gap solutions just to gain user efficiency is wearing thin.  And it is of a similar road to being frustrated with all the baggage tolerated using Microsoft Windows products, which lead to finding alternatives.


WindyCityTech Blogger
WindyWindyCityTech Wordpress

Saturday, 5 October 2013

Installing dhcpd dhcp server on Raspberry Pi isc-dhcp-server

Quick notes for installing isc-dhcp-server on the pi.  Should work the same for other Debian based distros.

Install isc-dhcp-server.
sudo apt-get autoremove dnsmasq
sudo apt-get install isc-dhcp-server


Give your interface  a fixed ip.
sudo nano /etc/network/interfaces
#
auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
gateway 192.168.1.1


Setting isc-dhcp-server to use eth0
sudo nano /etc/default/isc-dhcp-server
#
INTERFACES="eth0"
DHCPD_CONF=/etc/dhcp/dhcpd.conf


Setting up the dhcpd.conf for eth0, comment out everything else
sudo nano /etc/dhcp/dhcpd.conf
#
ddns-update-style none;
log-facility local7;
#
subnet 192.168.1.1 netmask 255.255.255.0 {
#
range 192.168.1.10 192.168.1.20;
option routers 192.168.1.1; #this is the gateway ip for your clients
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option domain-name-servers 8.8.8.8, 208.67.222.222, 192.168.1.1; #ns.exapmle.org
default-lease-time 86400;
max-lease-time 86400;
}



To test check your syslog while running:
sudo service isc-dhcp-server start


WindyCityTech Blogger
WindyWindyCityTech Wordpress

Creating a static WLAN interface number for a wifi wireless adaptor using udev rules

If you need your USB wifi adaptor to be a certain number on boot, i.e wlan5

Using udev rules this is possible.  reference: www.backtrack-linux.org/forums/showthread.php?t=2848


Run a ifconfig and get the mac address of the adaptor:
HWaddr de:ad:be:ef:ca:fe

Create a new udev rule

sudo touch /etc/udev/rules.d/70-persistent-net.rules
sudo nano /etc/udev/rules.d/70-persistent-net.rules


Insert the following lines into the file.

# Comment for the device, the following below should be on one line!
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="de:ad:be:ef:ca:fe", ATTR{type}=="1", NAME="wlan5"



WindyCityTech Blogger
WindyWindyCityTech Wordpress

Hostapd creation bash script for Linux pi

This script can do several things:
  • Setup and start a hostapd based AP from the command line
  • Save and recall previous hostapd AP configs created by the script
  • Use default variables for the configuration if some are omitted
  • Copy the config file to /etc/hostapd/hostapd.conf so the hostapd service can use it on startup
The script has been tested on the Raspberry pi  and should work with other Debian based distros.

Apart from requiring hostapd and echo, a suitable dhcp server should be installed on the system for the interface.
Also it is mandatory that the WLAN adaptor can support AP mode, otherwise the script will not work.




WindyCityTech Blogger
WindyWindyCityTech Wordpress

Get the Gmail Compose back on Firefox source code xpi oldcompose

I hate the new compose apart from resorting to Thunderbird, there was no viable solution.  Several people suggested oldcompose.com, which offers a Chrome and Firefox extension to give back the classic gmail compose interface.

Apart from bringing back the compose window like the way is should be, the extension also displays email addresses in the TO field in full text.

The link to the Firefox xpi addon page is here.

Inside the xpi archive there are three files:
  • bootstrap.js
  • icon.png
  • install.rdf
The files appear not to have any malicious code or call home urls.







WindyCityTech Blogger
WindyWindyCityTech Wordpress