2008年3月31日月曜日

netflow の exporter

日本で debian で mipsel って言わずもがな? ぷらっとホームさんの OpenMicroServer(TM) 。で netflow の exporter を探してみたところ、debian パッケージにあったのが fprobe。ulog の方が良さげだけど、自身を通るトラヒックではなくて、promisc モードで取得する必要あり。かつ EBT の nat テーブル PREROUTING で全て取得できるか定かでは無いし、BRIDGE_EBT_ULOG は OBSOLETE だし。

なので素の fprobe を二つ動かして uptime 見たらロードアベレージが、ほぼ 2。2〜 3割落としてしまったいるようなので、どうしようか...考えたのが
  • nprobe (本家じゃない)ソースがどこにあるかわからなかった。ぷらっとホームさんでも配布しているけど未テスト
  • カーネルコンパイルして、やっぱり ebtables を使う
  • PACKET_MMAP を使った libpcap を入れて fprobe で再挑戦
いずれにしても面倒で、クロスコンパイルの環境が必要....

debian でクロスコンパイル 2

続きと言うか、ちょっと jot。Convert library packages で、こんなんならない?
# dpkg-cross -a mipsel -b libc6_2.7-6_mipsel.deb 
Building libc6-mipsel-cross_2.7-6_all.deb
dpkg-cross: building package with dpkg-deb -b failed.
dpkg-cross: conversion of libc6_2.7-6_mipsel.deb failed.
# dpkg-cross --verbose -a mipsel -b libc6_2.7-6_mipsel.deb
Excluding: gcc binutils gpm cpp debianutils xfree86-common libpam-runtime xlibs-data debconf tzdata
Trying to build: libc6_2.7-6_mipsel.deb
Going to convert libc6_2.7-6_mipsel.deb
Extracting libc6_2.7-6_mipsel.deb
Extracting information from control file
Creating destination package tree
Creating /usr/share/doc/libc6-mipsel-cross/README
Installing shlibs file
Creating control file
Creating md5sums file
dpkg-deb: building package `libc6-mipsel-cross' in `./libc6-mipsel-cross_2.7-6_all.deb'.
dpkg-deb: control directory has bad permissions 2755 (must be >=0755 and <=0775)
dpkg-cross: building package with dpkg-deb -b failed.
dpkg-cross: conversion of libc6_2.7-6_mipsel.deb failed.
# ルートで作業するなっ....て....

で悩むことしきり。結局 2755 ってパーミッションどこかで見た覚えが。dpkg-deb を string してみて、適当に。例えばカレントに tmp ってディレクトリ作った後に
# TMPDIR=tmp dpkg-cross -a mipsel -b libc6_2.7-6_mipsel.deb 
sh: tmp/dpkg-cross.0MFJb4nZ/dst/DEBIAN/md5sums: No such file or directory
Building libc6-mipsel-cross_2.7-6_all.deb
/tmp を g+s にするのって流行ではないのかしら?

2008年3月28日金曜日

debian でクロスコンパイル

ってそのままだけど DebianCrossCompilerHowto。以前は toolchain-source だっけ? 覚えておくのは
  • dpkg-cross を入れておくこと
  • binutils を TARGET=... debian/rules binary-cross でビルド
その後は眺めたままだけど...amd64 で i386 を作る場合の TARGET は i486-linux-gnu。で i486-linux-gnu-gcc は
$ cat /usr/bin/i486-linux-gnu-gcc 
#!/bin/sh
gcc -m32 $@
で VMWare 用のカーネルが出来た。

2008年3月27日木曜日

lguest on 2.6.25-rc

どこで見付たか忘れちゃったけど、2.6.25-rc7-git2 には未。
--- old/arch/x86/kernel/tsc_32.c.old    2008-03-27 23:28:27.000000000 +0900
+++ new/arch/x86/kernel/tsc_32.c 2008-03-27 23:29:51.000000000 +0900
@@ -394,13 +394,15 @@
int cpu;

if (!cpu_has_tsc)
- goto out_no_tsc;
+ return;

cpu_khz = calculate_cpu_khz();
tsc_khz = cpu_khz;

- if (!cpu_khz)
- goto out_no_tsc;
+ if (!cpu_khz) {
+ mark_tsc_unstable("could not calculate TSC khz");
+ return;
+ }

printk("Detected %lu.%03lu MHz processor.\n",
(unsigned long)cpu_khz / 1000,
@@ -433,9 +435,4 @@
tsc_enabled = 1;

clocksource_register(&clocksource_tsc);
-
- return;
-
-out_no_tsc:
- setup_clear_cpu_cap(X86_FEATURE_TSC);
}
ぷらっとホームさんの SSD/Linux を lguest で動かすにあたってスワップを加えようかと思ったところ /dev/vdb とか出来ない。udev とか動いていないから?

mknod するにもメジャー、マイナ番号わからない。と悩んでいたら、こんな方法もあった。いや、最初は CONFIG_VIRTIO_BLK=m とかしちゃって調べていたんだけど。/proc/partitions ですか。

2008年3月25日火曜日

VMWare Workstation on 2.6.25-rc

やっぱり web から。any-any-update の 116 展開した後は、この辺りから。書かれている通り vmblock-only が.... iget()read_inode() が良くわからんので通らないけど (私は) 実害なし。でパッチ
diff -ubBr old/vmmon-only/common/task.c new/vmmon-only/common/task.c
--- old/vmmon-only/common/task.c 2007-11-28 19:58:17.000000000 +0900
+++ new/vmmon-only/common/task.c 2008-03-24 22:39:29.000000000 +0900
@@ -25,7 +25,7 @@
* we do not need asm/page.h anymore in this file - not surprising, this
* is common file, yes? And Windows do not have page.h, do they?
*/
-#define _I386_PAGE_H
+#define _ASM_X86_PAGE_H
/* On Linux, must come before any inclusion of asm/page.h --hpreg */
#include "hostKernel.h"
#ifdef linux
diff -ubBr old/vmnet-only/filter.c new/vmnet-only/filter.c
--- old/vmnet-only/filter.c 2007-11-28 19:11:12.000000000 +0900
+++ new/vmnet-only/filter.c 2008-03-24 22:41:08.000000000 +0900
@@ -12,6 +12,11 @@
#include
#include "compat_skbuff.h"
#include
+
+#define NF_IP_LOCAL_OUT NF_INET_LOCAL_OUT
+#define NF_IP_LOCAL_IN NF_INET_LOCAL_IN
+#define NF_IP_POST_ROUTING NF_INET_POST_ROUTING
+
/*
* All this makes sense only if NETFILTER support is configured in our kernel.
*/
diff -ubBr old/vmnet-only/vmnetInt.h new/vmnet-only/vmnetInt.h
--- old/vmnet-only/vmnetInt.h 2007-11-28 19:25:06.000000000 +0900
+++ new/vmnet-only/vmnetInt.h 2008-03-16 21:05:28.000000000 +0900
@@ -78,8 +78,10 @@
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 65)
# define SET_SK_DEAD(_sk, _val) (_sk)->dead = (_val)
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
# define SET_SK_DEAD(_sk, _val) sock_valbool_flag(_sk, SOCK_DEAD, _val)
+#else
+# define SET_SK_DEAD(_sk, _val) sock_set_flag(_sk, SOCK_DEAD)
#endif
あれ? vmnetInt.h はいじった覚えが無いけど....

2008年3月4日火曜日

FreeRadius 〜 EAP/TLS, EAP/TTLS, EAP/PEAP 〜 Linux Debian Etch

フランス語? 全くわからないのですが、面白いものでとりあえず build だけはできました。debian etch の freeraduis ですが ssl は別となっているので、ちょっと試そうか。の都度似たような探しものばかりしていた。が、こちらのサイト が良いさげでした。ありがとうございます。毎度のことながらの勉強不足で、コマンドそのまま。ですが...でパッチを jot。
diff -ubBrN freeradius-1.1.3/debian/control freeradius-1.1.3-ssl/debian/control
--- freeradius-1.1.3/debian/control 2008-03-04 21:36:44.000000000 +0900
+++ freeradius-1.1.3-ssl/debian/control 2008-03-04 21:31:58.000000000 +0900
@@ -1,6 +1,6 @@
Source: freeradius
-Build-Depends: debhelper (>= 5), libltdl3-dev, libpam0g-dev, libmysqlclient15-dev | libmysqlclient-dev, libgdbm-dev, libldap2-dev, libsasl2-dev, libiodbc2-dev, libkrb5-dev, snmp, autotools-dev, dpatch (>= 2), libperl-dev, libtool, dpkg-dev (>= 1.13.19)
-Build-Conflicts: libssl-dev
+Build-Depends: debhelper (>= 5), libltdl3-dev, libpam0g-dev, libmysqlclient15-dev | libmysqlclient-dev, libgdbm-dev, libldap2-dev, libsasl2-dev, libiodbc2-dev, libkrb5-dev, snmp, autotools-dev, dpatch (>= 2), libperl-dev, libtool, dpkg-dev (>= 1.13.19), libssl-dev
+Build-Conflicts:
Section: net
Priority: optional
Maintainer: Stephen Gran
@@ -66,3 +66,19 @@
Description: set of PHP scripts for administering a FreeRADIUS server
These scripts provide a web-based interface for administering a FreeRADIUS
server which stores authentication information in either SQL or LDAP.
+
+Package: freeradius-eaptls
+Architecture: any
+Depends: freeradius (= ${binary:Version}), ${shlibs:Depends}
+Description: eap-tls module for FreeRADIUS server
+ Debian will not provide a binary version of the rlm_eap_tls.so library. This
+ module is required if you want to use EAP/TLS authentication, commonly used
+ for WiFi access points
+
+Package: freeradius-eappeap
+Architecture: any
+Depends: freeradius (= ${binary:Version}), ${shlibs:Depends}
+Description: eap-peap module for FreeRADIUS server
+ Debian will not provide a binary version of the rlm_eap_peap.so library. This
+ module is required if you want to use EAP/PEAP authentication, commonly used
+ for WiFi access points
\ No newline at end of file
diff -ubBrN freeradius-1.1.3/debian/freeradius-eappeap.install freeradius-1.1.3-ssl/debian/freeradius-eappeap.install
--- freeradius-1.1.3/debian/freeradius-eappeap.install 1970-01-01 09:00:00.000000000 +0900
+++ freeradius-1.1.3-ssl/debian/freeradius-eappeap.install 2008-03-04 21:56:40.000000000 +0900
@@ -0,0 +1 @@
+usr/lib/freeradius/rlm_eap_peap*.so
diff -ubBrN freeradius-1.1.3/debian/freeradius-eappeap.postinst freeradius-1.1.3-ssl/debian/freeradius-eappeap.postinst
--- freeradius-1.1.3/debian/freeradius-eappeap.postinst 1970-01-01 09:00:00.000000000 +0900
+++ freeradius-1.1.3-ssl/debian/freeradius-eappeap.postinst 2008-03-04 21:56:15.000000000 +0900
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+set -e
+
+case "$1" in
+ configure)
+ if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+ invoke-rc.d freeradius reload
+ else
+ /etc/init.d/freeradius reload
+ fi
+ ;;
+ abort-upgrade)
+ ;;
+ abort-remove)
+ ;;
+ abort-deconfigure)
+ ;;
+esac
+
+#DEBHELPER#
diff -ubBrN freeradius-1.1.3/debian/freeradius-eaptls.install freeradius-1.1.3-ssl/debian/freeradius-eaptls.install
--- freeradius-1.1.3/debian/freeradius-eaptls.install 1970-01-01 09:00:00.000000000 +0900
+++ freeradius-1.1.3-ssl/debian/freeradius-eaptls.install 2008-03-04 21:34:18.000000000 +0900
@@ -0,0 +1 @@
+usr/lib/freeradius/rlm_eap_tls*.so
diff -ubBrN freeradius-1.1.3/debian/freeradius-eaptls.postinst freeradius-1.1.3-ssl/debian/freeradius-eaptls.postinst
--- freeradius-1.1.3/debian/freeradius-eaptls.postinst 1970-01-01 09:00:00.000000000 +0900
+++ freeradius-1.1.3-ssl/debian/freeradius-eaptls.postinst 2008-03-04 21:34:48.000000000 +0900
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+set -e
+
+case "$1" in
+ configure)
+ if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+ invoke-rc.d freeradius restart
+ else
+ /etc/init.d/freeradius restart
+ fi
+ ;;
+ abort-upgrade)
+ ;;
+ abort-remove)
+ ;;
+ abort-deconfigure)
+ ;;
+esac
+
+#DEBHELPER#
diff -ubBrN freeradius-1.1.3/debian/rules freeradius-1.1.3-ssl/debian/rules
--- freeradius-1.1.3/debian/rules 2008-03-04 21:36:44.000000000 +0900
+++ freeradius-1.1.3-ssl/debian/rules 2008-03-04 21:33:21.000000000 +0900
@@ -23,8 +23,10 @@
# You will also need to add a Build-Depends on libssl-dev and libpq-dev
# and remove the Build-Conflicts on libssl-dev
# Finally you need to cat debian/control.postgresql >> debian/control
-buildssl=--without-rlm_eap_peap --without-rlm_eap_tls --without-rlm_eap_ttls --without-rlm_otp --without-rlm_sql_postgresql --without-snmp-modulelist=krb5 ldap sql_mysql sql_iodbc
+# buildssl=--without-rlm_eap_peap --without-rlm_eap_tls --without-rlm_eap_ttls --without-rlm_otp --without-rlm_sql_postgresql --without-snmp
+# modulelist=krb5 ldap sql_mysql sql_iodbc
+buildssl=--without-rlm_otp --without-rlm_sql_postgresql --without-snmp
+modulelist=krb5 ldap sql_mysql sql_iodbc eap_peap eap_tls
#buildssl=--with-rlm_sql_postgresql_lib_dir=`pg_config --libdir` --with-rlm_sql_postgresql_include_dir=`pg_config --includedir`
#modulelist=krb5 ldap sql_mysql sql_iodbc sql_postgresql
freeradius-eaptls_1.1.3-3_i386.deb freeradius-eappeap_1.1.3-3_i386.deb なるものが出来上がり。これらだけ。であれば、元サイトの下の方にアリ。