Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Thursday, September 17, 2009

openvpn over ipv6 patch

It's baaaack. :)

Thanks to the support from my employer as 20% project, I'm (back) working on openvpn support for ipv6 endpoints (aka udp6, tcp6).

You can find the initial re-release, over openvpn-2.1_rc19
(latest as of Sep'09) at:
, obviously available as a git repository but also as a patch
snapshots at:
I'm pretty happy with this release, it has passed my unittests for {loopback,remote}{udp,tcp}{4,6} and also -it's valgrind friendly ;)

Enjoy it ! ... I'll post it to openvpn-devel ~soon.


--
--Juanjo ; echo jAjo@goMoSgleP.com | sed 's/[SPAM]//g'

Friday, June 05, 2009

select chromium, chrome else firefox as default browser

Now that google-chrome requete-alpha build is published by Google [1], I have this
handy script as my default browser "selector":

#!/bin/bash
#
# $HOME/bin/browser.sh
# Author: JuanJo ( juanjosec O gmail o com )
#
# if running, try: chromium-browser, google-chrome
# else: firefox
#
case "$(ps -oargs= -C chrome)" in
/usr/lib/chromium-browser*)
exec /usr/bin/chromium-browser "$@";;
/opt/google/chrome*)
exec /opt/google/chrome/chrome "$@";;
esac
exec /usr/bin/firefox "$@"
exit $?

# Point2 me with the output from:
for p in /desktop/gnome/{applications/browser/exec,url-handlers/http{,s}/command}; do
echo gconftool-2 -s $p -t string "$HOME/bin/browser.sh \"%s\""
done



In a related note, you can see current milestone (LinuxDev [2]) and what to expect for the next one (LinuxBeta[3]).

[1] Danger: Mac and Linux builds available
[2] Chromium LinuxDev milestone
[3] Chromium LinuxBeta milestone

Monday, June 01, 2009

ads blocking in chromium-browser

ads blocking in chromium-browser

One key missing functionality in chromium is extensibility via browser extensions or user scripts, damn useful in particular for blocking ads.
Although the support is there in the dev channel, it had been not available in the ppa binary debs for a while, but about ~2days ago user scripts started working ... yAY!! \o/

To the point:

dpkg -l chromium-browser # version: 3.0.183.0~svn200905 Chromium browser
mkdir $HOME/.config/chromium/Default/User\ Scripts # yep, nasty white space :P
cd $HOME/.config/chromium/Default/User\ Scripts
wget http://www.adsweep.org/AdSweep.user.js # ala adblock

# ... and then start chromium as:
chromium-browser --enable-user-scripts


To confirm you have it enabled, visit http://www.adsweep.org/ && you'll see a red status line, up-right, with the adsweep script version.

Friday, May 29, 2009

chromium-browser with bookmark keywords

I've been enjoooying chromium-browser on */Linux since last ~3weeks, you'll find lotsa references out there on howto install it, in my ubuntu it boils down to:

echo deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu hardy main > /etc/apt/sources.list.d/chromium.list
#echo "Acquire::http::Proxy::ppa.launchpad.net DIRECT;" > /etc/apt/apt.conf.d/85launchpad
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 4E5E17B5
apt-get update
apt-get install chromium-browser

One important functionality I was missing was the ability to create "%s" bookmarks (ala firefox), the nice thing is that it's actually support, tho not "fancy" at the moment because of laking bookmark editor (May/09).
Good news is that you can actually ride it via sql:

#!/bin/bash
# Author: JuanJo
# License: GPLv2+
# Usage: (chromium-browser must not be running)
# ./chromium-browser_keywords.sh ## *see* it, then:
# ./chromium-browser_keywords.sh | sqlite3 $HOME/.config/chromium/Default/Web?Data
# Goodies:
# at the address bar type eg:
# yh tate
# wa theta
# rae teta
# bspot juanjosec

KEYWORDS="
yh http://search.yahoo.com/search?p=%s
wa http://www.wolframalpha.com/input/?i=%s
rae http://buscon.rae.es/draeI/SrvltConsulta?TIPO_BUS=3&LEMA=%s
bspot http://%s.blogspot.com
#foo http://%s.foo.com/
"
while read k url;do
case "$k" in ""|\#*) continue;;esac
echo -n "INSERT INTO keywords (short_name, keyword, favicon_url, url) "
echo "VALUES ('$k','$k','about:blank','$url');"
done < <(echo "$KEYWORDS"| sed 's/%s/{searchTerms}/')


Incidentally nuff, I'm now at a roaming session I need to last +4hs, so I closed my ff-3.1b3 cpu toaster and left riding entirely on chrome-browser (who needs flash after all ?).

Sunday, January 18, 2009

my green alix 2c3 box

This is my beloved fanless 24x7 box: Alix 2c3 board, consisting of:
  • CPU: AMD Geode x86 500MHz, 256MB RAM, 2x USB2.0, 3x LAN 100Mb, 1xMiniPCI
    (from http://pcengines.ch/)
  • CardFlash 4GB (as root filesystem)
  • WD Passport 500Mb (USB 2.0), using board's power via USB
  • Power supply: DC 12V 20W :-D

I tried several x86 OSes on it:
  1. OpenBSD 4.4: by far the easiest and +straightforward installation via PXE
  2. Debian stable: all Debian versatility thru your serial console installation :)
  3. Voyage Linux: 1-shot copy-to-CF (no PXE needed) && boot'it && apt-get'em =)

After some back&forth, I finally kept Voyage Linux, mostly because of
  • debian versatility
  • apt-get install screen ;)
  • fully tuned for flash => root filesystem is booted readonly, with all the writable noise kept in memory by using aufs (union fs) and tmpfs
  • smaaaaall (merely less than ~150Mb after install)
  • openssl/OCF by default
  • hardware watchdog, rng, aes support by default
Hardware info:
  • /proc/cpuinfo
    processor       : 0
    vendor_id : AuthenticAMD
    cpu family : 5
    model : 10
    model name : Geode(TM) Integrated Processor by AMD PCS
    stepping : 2
    cpu MHz : 498.056
    cache size : 128 KB
    fdiv_bug : no
    hlt_bug : no
    f00f_bug : no
    coma_bug : no
    fpu : yes
    fpu_exception : yes
    cpuid level : 1
    wp : yes
    flags : fpu de pse tsc msr cx8 sep pge cmov clflush mmx mmxext 3dnowext 3dnow
    bogomips : 997.25
    clflush size : 32
    power management:
  • lspci
    00:01.0 Host bridge: Advanced Micro Devices [AMD] CS5536 [Geode companion] Host Bridge (rev 33)
    00:01.2 Entertainment encryption device: Advanced Micro Devices [AMD] Geode LX AES Security Block
    00:09.0 Ethernet controller: VIA Technologies, Inc. VT6105M [Rhine-III] (rev 96)
    00:0a.0 Ethernet controller: VIA Technologies, Inc. VT6105M [Rhine-III] (rev 96)
    00:0b.0 Ethernet controller: VIA Technologies, Inc. VT6105M [Rhine-III] (rev 96)
    00:0f.0 ISA bridge: Advanced Micro Devices [AMD] CS5536 [Geode companion] ISA (rev 03)
    00:0f.2 IDE interface: Advanced Micro Devices [AMD] CS5536 [Geode companion] IDE (rev 01)
    00:0f.4 USB Controller: Advanced Micro Devices [AMD] CS5536 [Geode companion] OHC (rev 02)
    00:0f.5 USB Controller: Advanced Micro Devices [AMD] CS5536 [Geode companion] EHC (rev 02)
  • lsusb
    Bus 002 Device 002: ID 1058:0704 Western Digital Technologies, Inc.
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  • lsmod | egrep geode (special hardware)
    geodewdt                4500  2             ## watchdog
    geode_rng 1920 0 ## random number generator
    rng_core 3716 1 geode_rng
    geode_aes 5508 0 ## aes cipher
Some measurements/stats:
  • HDD /USB 2.0 throughput:
    jjolix:~# hdparm  -t /dev/sda

    /dev/sda:
    Timing buffered disk reads: 56 MB in 3.04 seconds = 18.40 MB/sec
  • The CPU/chipset/RAM/netw are nice enough to run things like rtorrent/mlnet and serve NFS.
    This is top output at the alix box whilst doing a tar cf - /mnt/Fotos/ > /dev/null (~2K photos, ~3MB each) from a LAN NFS client:
    top - 20:51:47 up 18 days, 22:41,  1 user,  load average: 5.65, 2.39, 0.90
    Tasks: 60 total, 1 running, 58 sleeping, 0 stopped, 1 zombie
    Cpu(s): 4.0%us, 23.1%sy, 0.0%ni, 8.9%id, 31.7%wa, 21.5%hi, 10.9%si, 0.0%st
    Mem: 256860k total, 252860k used, 4000k free, 604k buffers
    Swap: 0k total, 0k used, 0k free, 197128k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    30635 p2p 20 0 57232 36m 5196 S 9.2 14.4 3:00.93 mlnet
    11028 root 20 0 0 0 0 S 4.0 0.0 0:06.09 nfsd
    11030 root 20 0 0 0 0 S 4.0 0.0 0:08.98 nfsd
    11024 root 20 0 0 0 0 D 3.6 0.0 0:06.20 nfsd
    11025 root 20 0 0 0 0 S 3.6 0.0 0:06.21 nfsd
    11027 root 20 0 0 0 0 S 3.6 0.0 0:06.16 nfsd
    11026 root 20 0 0 0 0 D 3.3 0.0 0:06.06 nfsd
    11029 root 20 0 0 0 0 S 3.3 0.0 0:06.11 nfsd
    11031 root 20 0 0 0 0 D 3.3 0.0 0:06.84 nfsd
    30349 root 15 -5 0 0 0 D 2.6 0.0 0:05.58 usb-storage
    3 root 15 -5 0 0 0 S 1.6 0.0 3:44.10 ksoftirqd/0
    88 root 15 -5 0 0 0 S 1.0 0.0 2:55.14 kswapd0


  • for above, iftop shows >70Mbit/s, ++enough to do a remote DVD toasting session :)
  • a full-steam-ahead rtorrent download at 1.5MBytes/sec makes it use ~25% CPU.


Previously I had a conventional , fanfull, noisy, old desktop (P4 1.5Ghz) for doing 24x7 stuff @home, as you can imagine it won't be missed =)

Monday, January 12, 2009

e2fsprogs utils for Android (EABI ARM)

I've been playing around with my brand new Android (cool Christmas gift from my employer ;).
Because of the security model by default you cannot store apps into /sdcard (only at /data/apps, which is mounted from the internal MTD device), and this is something you'll eagerly want for freakin'ly installing bunch of cool applications.

After some hacking around I could get it to like /data/app as a loop-mount:

/ # df
Filesystem 1k-blocks Used Available Use% Mounted on
tmpfs 49564 0 49564 0% /dev
tmpfs 4096 0 4096 0% /sqlite_stmt_journals
/dev/block/mtdblock3 69120 57248 11872 83% /system
/dev/block/mtdblock5 76544 58596 17948 77% /data
/dev/block/mtdblock4 69120 1256 67864 2% /cache
/dev/block/mmcblk0p1 991488 950448 41040 96% /sdcard
/dev/block/loop0 128949 19098 103186 16% /data/app
, where /dev/block/loop0 is actually a loop mount on /sdcard/data-extra.img ext2 image file.

I will post a more detailed mini-howto about this hack, but the 1st thing you'll need (and I couldn't find out there before) are the e2fsprogs utils built for Android.
So I went ahead, changed some e2fsprogs src bits and compiled with my android sdk arm gcc toolchain (built @my workstation from the Android git repo).

You can find them at:
http://sites.google.com/site/juanjosec/android , namely:
e2fsprogs-android.diff, e2fsprogs-base_arm-eabi.tar.gz, e2fsprogs-xtra_arm-eabi.tar.gz.

15 years have passed since I first touched my 1st Linux, 13 so far since I hacked the Linux kernel for ip aliasing support ... been a long trip, and now I can finally carry it in my pocket ;-)

Sunday, September 21, 2008

making a 3G Huawei 220 USB modem work in Linux 2.6

Context: just received a Huawei 220 3G USB modem [1] (HSDPA/UMTS/EDGE/GPRS/GSM, HSDPA <= 3.6Mbps ), have to make it work in my Linux thinkpad X60 w/ Linux 2.6.20+ , for accessing the Swisscom HSDPA service.

It didn't work out of the box, mainly because of the device's CD emulation storage (windoze drivers :P) interfering with its comm device.

First searches return pointers to a "vodafone-mobile-connect-card-driver-for-linux" [2] package, which is absolute crap: a heavy weight GUI interface that doesn't even work (at least for me).

Hey ... I just want to have my /dev/ttyUSB0 to be able to configure a pppd on it, I found a true, low level solution [3] that manages to make the device behave like the very thing it was born for :)

Here is an excerpt of the mininum required configs to make it work

  • /etc/udev/rules.d/99-huawei.rules

    ## /etc/udev/rules.d/99-huawei.rules
    ##
    ## to enable it, run: udevcontrol reload_rules
    ##
    #
    # udev rule for HUAWEI E220 3G HSDPA Modem
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # (c)opyleft OOZIE < oozie@poczta.fm >
    #
    # This file prevents the pseudo scsi cdrom device from enabling,
    # thus providing a workaround for kernel versions < 2.6.20
    #
    # Minor edition by JuanJo Ciarlante
    ##

    SUBSYSTEM=="block", \
    ACTION=="add", \
    SYSFS{idVendor}=="12d1", \
    SYSFS{idProduct}=="1003", \
    RUN="/sbin/modprobe usbserial vendor=0x12d1 product=0x1003", \
    OPTIONS="ignore_device"


  • /etc/ppp/peers/3g

    # /etc/ppp/peers/3g
    # pppd call 3g nodetach
    # (using Huawei e220 USB modem)
    /dev/ttyUSB0
    #3600000 #irrelevant
    noipdefault
    defaultroute
    user gprs
    password gprs
    #persist
    lock
    noauth
    nodetach
    usepeerdns
    nodeflate
    nobsdcomp
    nopcomp
    noaccomp
    novj
    novjccomp
    nomagic
    #asyncmap 0
    #lcp-echo-failure 10000
    #lcp-echo-interval 1000
    lcp-echo-failure 10
    lcp-echo-interval 30
    connect '/usr/sbin/chat -v -f /etc/ppp/peers/3g.chat'
    debug
    idle 180
    holdoff 10

  • /etc/ppp/peers/3g.chat

    # /etc/ppp/peers/3g.chat
    TIMEOUT 3
    ABORT BUSY
    ABORT 'NO CARRIER'
    ABORT VOICE
    ABORT 'NO DIALTONE'
    ABORT 'NO DIAL TONE'
    ABORT 'NO ANSWER'
    ABORT DELAYED
    "" ATZ
    OK ATQ0V1E1S0=0&C1&D2
    OK AT+CGDCONT=1,"IP","gprs.swisscom.ch","0.0.0.0",0,0
    OK ATDT*99#
    CONNECT ""


Friday, May 16, 2008

debian openssl bug

It has been blogged everywhere ... but the problem it's not the bug itself , "errare humanum est " ... and that's ~fair enough.

What's irritating --AGAIN!-- is Debian attitude of not feeding patches back upstream, specially when messing with such security sensitive packages, doing this would have effectively caught the bug and --albeit some deserved flame-- would have void the current situation.

By this arrogant attitude, they break the very power of FLOSS: collaboration, cross-fertilization, moooore eyes on your source.

Another thing to note: let's push against monocultures, that is: the more different distros and FLOSS OSes ... the better!

And now: something [not] completely different ...


img source: kriptopolis.org

Sunday, November 18, 2007

Using mutt for gmail via IMAP

You use mutt, you love it. You hate the user interface "latency" of every other MUA, and the fact that no other MUA has "got" how to handle mail threading as mutt does.
BUT also you, a true road warrior, want mail(box) availabilty and plenty of storage.
Well, recently gmail added IMAP support, with a very good support of the standard AND a well thought mapping between gmail labels and IMAP folders ( "virtual" folders).

The good news is that you can link your beloved mutt to gmail, use IMAP folders and also use SMTP TLS authentication via smtp.gmail.com

Here is a copy of my .mutt/muttrc (obviously must change "username" and other stuff):

## ~/.mutt/muttrc
set from=username@gmail.com
set realname="JuanJo seC"
set reverse_name=yes
set reverse_realname=no
set imap_user = 'username@gmail.com'
set spoolfile = imaps://imap.gmail.com:993/INBOX
#set sendmail="/usr/sbin/ssmtp -C$HOME/.mutt/ssmtp.conf"
set smtp_url="smtp://username@smtp.gmail.com:587/"
set folder = "imaps://imap.gmail.com:993"
#set record=+sent-mail-`date +%Y`
set record="+[Gmail]/Sent Mail"
set postponed="+[Gmail]/Drafts"
# previously do: mkdir -p ~/.mutt/cache/{headers,bodies}
set header_cache="~/.mutt/cache/headers"
set message_cachedir="~/.mutt/cache/bodies"
set certificate_file=~/.mutt/certificates
set move=no
set delete=yes
set edit_hdrs
set include
set reply_to
set abort_nosubject=no
alternates '(username|altusername)([-+].*)?@.*'
set hdr_format="%4C %Z %{%m/%d} %-15.15F (%4c) %s" # format of the index

hdr_order From: Date: User-Agent: X-Mailer To: Cc: Reply-To: Subject:
ignore *
unignore From: Date: User-Agent: X-Mailer To: Cc: Reply-To: Subject:
my_hdr Reply-To:

# setup gmail filters to apply the corresp. labels:
mailboxes ! =ml-lug-list =ml-lug-org =[Gmail]/Drafts "=[Gmail]/All Mail"

set editor="jed %s -l ~/.mutt/jed.mutt.sl"
set alias_file=~/.mutt/mail_aliases
source ~/.mutt/mail_aliases

send-hook . 'set realname="JuanJo seC"'
## hack to make $reverse_name and 'my_hdr From:' work ok (eg mlists)
send-hook . 'set from=username@gmail.com'
send-hook . 'unmy_hdr From:'
###
send-hook . 'set signature=~/.signature'

#send-hook lug-list 'set record=+sent-lug-list'
send-hook lug-.+@lugmen.org.ar 'my_hdr From: JuanJo seC <username+mlist@gmail.com>
subscribe lug-.+@lugmen.org.ar



Very cool to experiment folder switching in mutt using:
'c' ("Open Mailbox")
TAB (will show all IMAP folders)
TAB (again: will show only the 'mailboxes' mutt var)

And here is my jed rc:

% ~/.mutt/jed.mutt.sl
% emacs keybinding for jed:
() = evalfile("emacs");
% Find signature begin, position cursor there:
if (re_fsearch("^--")) {
call("previous_line_cmd");
} else {
% else search headers end
re_fsearch("^$");
call("next_line_cmd");
}
push_mark();


Yeahh... finally I can read mailing lists with an interface that doesn't suck! 8)
Enjoy!