reedho belajar ngeblog

Semoga bermanfaat buat kita semua. Amin.

Rabu, 30 Juni 2010

Rescuing Email Problem

Jika suatu saat anda bosan dengan kelakuan outlook express yang lamban karena file inbox yang besar, berikut catatan tips untuk bermain-main dengannya.

Pertama, ada software yang dulu pernah saya gunakan untuk mengconvert format dbx menjadi mbox, namanya DbxConv.exe, ini linknya:

DbxConv - DBX to MBOX converter

Cara menggunakannya mudah saja, jalankan DbxConv.exe tanpa argumen atau option -? untuk melihat sinopsis usagenya.


DbxConv.exe Inbox.dbx
No conversion options selected, using MBOXO-converter...
Processing mailbox "Inbox.dbx" (5357 messages)...
1 of 1 mailboxes converted to MBOXO-format!


Maka akan dihasilkan file output Inbox.mbx yang sudah dalam format mbox.

Kedua, mungkin anda percaya bahwa format maildir lebih baik dari pada format mbox, ada beberapa tools konversi dari mbox ke maildir yang tersedia pada freebsd (or linux), diantaranya mb2md atau mbox2mdir, tapi keduanya tidak bekerja sebagaimana yang saya inginkan, dimana mb2md menyatakan file mbox hasil dari DbxConv.exe bukan dalam format mbox, sementara mbox2mdir tidak membuat layout maildir sebagaimana mestinya (tidak ada direktori cur, new, dan tmp) jadi sepertinya mbox2mdir lebih seperti utiliti formail bawaan procmail yang hanya memisahkan satu file mbox menjadi banyak file-file mail terpisah. Akhirnya, ternyata script perl yang cukup sederhana ini yang bekerja seperti yang saya inginkan:

http://untroubled.org/mbox2maildir

Contoh penggunaan:


$ mkdir Maildir
$ ./scripts/perls/mbox2maildir Inbox.mbx ~Maildir/inbox-m8-2009


Ketiga, ya tentu saja anda menginginkan untuk bisa searching, ya ngga? dari hasil pencarian, yang cukup melelahkan, karena kata kuncinya terlalu umum (belum ketemu yang pas), sepertinya utiliti yang terbaik yang saya dapatkan adalah mairix

Tanpa baca dulu dokumentasinya mairix(1) dan mairixrc(5) terlebih dulu, saya jamin (hehe) anda akan bingung cara menggunakannya, berikut panduan singkat saja berdasarkan apa yang saya lakukan:


$ cat <<EOF > ~/.mairixrc
base=~/Maildir
mformat=maildir
maildir=inbox-m8-????
mfolder=mfolder
mformat=maildir
database=~/Maildir/mairix_database
EOF
$ mairix
$ mairix s:reedho
Matched 6 messages
$ mairix -r s:reedho
/home/reedho/Maildir/inbox-m8-2009/cur/1277869084.29442.mbox:2,S
/home/reedho/Maildir/inbox-m8-2009/cur/1277869085.29442.mbox:2,S
/home/reedho/Maildir/inbox-m8-2009/cur/1277869100.29442.mbox:2,S
/home/reedho/Maildir/inbox-m8-2009/cur/1277869108.29442.mbox:2,S
/home/reedho/Maildir/inbox-m8-2009/cur/1277869227.29442.mbox:2,S
/home/reedho/Maildir/inbox-m8-2009/cur/1277869228.29442.mbox:2,S


Keempat, tentu saja ini karena semuanya formatnya sudah maildir kita cari MUA yang support, sebelumnya saya pake Alpine yang nampaknya pada standard port install freebsd tidak support maildir, akhirnya kembali menggunakan The Mutt E-Mail Client.

Konfigurasi mutt lebih membingungkan lagi daripada mairix, karena waktu sudah mendesak, searching mutt maildir ke google, akhirnya working configuration saya yang bekerja berdasarkan tutorial di sini Mutt & Maildir Mini-HOWTO adalah sebagai berikut:


$ cat .muttrc
set mbox_type=Maildir
set folder="~/Maildir"
set mask="!^\\.[^.]"
set mbox="~/Maildir/mfolder"
set record="+.Sent"
set postponed="+.Drafts"
set spoolfile="~/Maildir/mfolder"
mailboxes `echo -n "+ "; find ~/Maildir -maxdepth 1 -type d -name "inbox*" | xargs`
macro index c "?" "open a different folder"
macro pager c "?" "open a different folder"
macro index C "?" "copy a message to a mailbox"
macro index M "?" "move a message to a mailbox"
macro compose A "?" "attach message(s) to this message"


Terakhir, kelima, mungkin terpikir juga bisa gak ya kalo mau disearch via web, seperti The Mail Archive gitu dech.. hm, karena waktu nya sudah habis, saya belum sempat setup MHonArc: A mail-to-HTML converter, silahkan diexplore.

Rabu, 16 Juni 2010

Perl chap password checker

If your NAS performing chap authentication to RADIUS server (e.g. FreeRADIUS), this article will briefly show a simple perl script to check the chap authentication given you have the "Cleartext-password" and the "auth_detail" log for a given authentication request.

For example, the log request is follow:


Wed Jun 16 00:00:00 2010
Packet-Type = Access-Request
User-Name = "xxxxxxxxxxxxxxxxxxxxxxx"
CHAP-Password = 0x01427b3a4c7121b834d330159a44487597
NAS-IP-Address = x.x.x.x
Service-Type = Framed-User
Framed-Protocol = PPP
Calling-Station-Id = "xxxxxxxxxxxxxxx"
CHAP-Challenge = 0xe9d3017252bc81d810d6fb37e4d60bee


And you have the Cleartext-password is for example m@!s3curEp455w0Rd, then the following is the perl script to do the job:


#!/usr/bin/env perl

use warnings;
use strict;
use Digest::MD5 qw(md5 md5_hex md5_base64);

my $chap_password = shift || die;
my $chap_challenge = shift || die;
my $cleartext_password = shift || die;

$chap_password =~ s/^0x//;
$chap_challenge =~ s/^0x//;

my $chap_id = substr($chap_password, 0, 2);
my $chap_id_binstr = pack('H2', $chap_password);
my $chap_challenge_binstr = pack('H32', $chap_challenge);

my $md5_hash = md5_hex($chap_id_binstr,$cleartext_password,$chap_challenge_binstr);
substr($chap_password, 0, 2, '');

print $md5_hash eq $chap_password ? "OK" : "INCORRECT", "\n";


Here the example of running the script:


reedho>./radchk.pl 0x01427b3a4c7121b834d330159a44487597 0xe9d3017252bc81d810d6fb37e4d60bee m@!s3curEp455w0Rd
INCORRECT

Sabtu, 05 Juni 2010

Install php5 oci8 on SLES-10-SP3 dan instantclient

Cara termudah menginstall module oracle (oci8) untuk php5 yang pernah saya temui adalah dengan menggunakan pecl. Berikut catatan instalasinya pada SuSE Linux Enterprise 10 SP3:

  1. Instalasi rpm php5-pear (php5-pear-5.2.5-9.20) tidak menginclude "pecl" wrapper script, tetapi tetap ada script php dari command pecl tersebut disini: /usr/share/php5/PEAR/peclcmd.php.

  2. Wrapper script "phpize" kita dapatkan dari package php5-devel (php5-devel-5.2.5-9.20).

  3. Install instant-client-basic (oracle-instantclient11.2-basic-11.2.0.1.0-1) dan instant-client-devel (oracle-instantclient11.2-devel-11.2.0.1.0-1) yang rpm nya bisa kita download dari website oracle.com.

  4. Install oci8 module via pecl dengan command:
    php /usr/share/php5/PEAR/peclcmd.php install oci8
    .

Minggu, 16 Mei 2010

Linux: Bonding on Vlan Tagged (Trunking) Interface

Menurut halaman web ini http://www.linuxhorizon.ro/vlans.html, lihat di bagian paling bawah halamannya, bonding on a vlan tagged should just work.

Berikut ini kopi script bagian terakhir halaman tersebut yang menunjukkan individual commands untuk membuat bonding dan vlan pada mesin linux secara umum:

#!/bin/bash

modprobe 8021q
modprobe bonding mode=0 miimon=100

ifconfig eth0 down
ifconfig eth1 down
ifconfig eth2 down

ifconfig bond0 hw ether 00:11:22:33:44:55
ifconfig bond0 10.1.1.3 up
ifenslave bond0 eth1
ifenslave bond0 eth0

ifconfig bond0 0.0.0.0
ifconfig eth0 0.0.0.0
ifconfig eth1 0.0.0.0

vconfig add bond0 2
vconfig add bond0 3
vconfig add bond0 4
vconfig add bond0 5
vconfig add bond0 6

ifconfig bond0.2 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255 up
ifconfig bond0.3 192.168.3.1 netmask 255.255.255.0 broadcast 192.168.3.255 up
ifconfig bond0.4 192.168.4.1 netmask 255.255.255.0 broadcast 192.168.4.255 up
ifconfig bond0.5 192.168.5.1 netmask 255.255.255.0 broadcast 192.168.5.255 up
ifconfig bond0.6 192.168.6.1 netmask 255.255.255.0 broadcast 192.168.6.255 up

echo 1 > /proc/sys/net/ipv4/ip_forward

Minggu, 09 Mei 2010

Blog via Email

Just recently try out this feature, go to your blogger settings and navigate to "Email & Mobile", pick your secretword on "Email Posting Address" text field and save, you're done.
Sent from my BlackBerry® via SmartFREN EVDO Network.

Mengenai Saya

r.e.e.d.h.o
Network system administrator, love unix, love to code.
Lihat profil lengkapku