May 31, 2009
[Maven] Continuum と Apache HTTP Server + AJP 経由で呼び出す
Continuum は Jetty を内包しており、自前で Web サーバ機能を提供している。 今回は Apache HTTP Server から AJP 経由で Jetty を呼び出す方法をメモ。 使用した Continuum のバージョンは 1.2.3 で、同梱の Jetty は 6.1.11。
- Continuum
- http://continuum.apache.org/
- Jetty
- http://jetty.mortbay.com/jetty/
設定方法
既に Continuum 1.2.3 がインストールされており、起動可能な状態になっていることが前提。 Continuum がインストールされているディレクトリを $CONTINUUM_HOME と記述する。 実際に設定した環境は Debian Etch + JDK 1.5.0。
Continuum に Jetty の AJP モジュールを組み込む
Continuum に同梱されている Jetty には AJP 用のモジュールが含まれていない。 そのため、別途 Jetty をダウンロードしてモジュールを入手し、組み込む必要がある。
- Jetty 6.1.11
- http://dist.codehaus.org/jetty/jetty-6.1.11/
Jetty の設定変更
$CONTINUUM_HOME/conf/jetty.xml の以下の 2 箇所を変更する。
以下の <Call name="addConnector"> をコメントアウト。
<!-- Use this connector for many frequently idle connections
and for threadless continuations.
-->
<!-- START SNIPPET: jetty_port -->
<!--
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">5000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
-->
<!-- END SNIPPET: jetty_port -->
以下を追記。
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.ajp.Ajp13SocketConnector">
<Set name="port">8009</Set>
</New>
</Arg>
</Call>
変更完了後に Continuum を再起動する。
Apache HTTP Server の設定変更
httpd.conf に以下を追記(実際には、各環境に合わせた /etc/apache2/sites-available 内のファイル)。
変更完了後に Apache HTTP Server を再起動する。<Location "/continuum"> ProxyPass ajp://localhost:8009/continuum Order allow,deny allow from all </Location>
設定変更の確認
http://example.com/continuum に Web ブラウザで接続する。
May 30, 2009
[Misc] Sender Policy Framework メモ
Wikipedia によると、SPF(Sender Policy Framework) というのは
Sender Policy Framework(センダー・ポリシー・フレームワーク)とは、電子メールにおける送信ドメイン認証のひとつ。差出人のメールアドレスが他のドメインになりすましていないかどうかを検出することができる。 SPF もしくは SPF認証 とも呼ばれる。というものらしい。 稼働中のメールサーバが SPF に対応したメールサーバにメールを転送しようとしてエラーメールを返してきたのでメモ。 Wikipedia の記載にある通り、DNS に txt レコードを追加すれば対応できる様だ。 DNS の設定はしたが、故あって未テスト。 なので、本当に DNS の設定だけで大丈夫なのかは現時点では未検証。
- Sender Policy Framework
- http://ja.wikipedia.org/wiki/Sender_Policy_Framework
- Sender Policy Framework
- http://www.openspf.org/
Hi. This is the James mail server at example.co.jp. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out. Below I include the list of recipients and the reason why I was unable to deliver your message. hoge@example.co.jp Remote mail server told me: 550 See http://spf.pobox.com/why.html?sender=me%40example.com&ip=192.168.1.1&receiver=example.co.jp (#5.7.1) The original message is attached.
May 29, 2009
[Linux] rkhunter を試してみた。
rkhunter は rootkit を検出してくれるツール。 chkrootkit に引き続きこちらも試してみた。 rkhunter の方がより詳細な情報を出してくれて楽しい。
- The Rootkit Hunter project
- http://rkhunter.sourceforge.net/
rkhunter のインストール
Debian Etch に rkhunter 1.2.9 をインストールした。 apt でインストール出来るので非常に楽。
# apt-get install rkhunter Reading package lists... Done Building dependency tree... Done Recommended packages: libmd5-perl The following NEW packages will be installed: rkhunter (SNIP) Unpacking rkhunter (from .../rkhunter_1.2.9-2_all.deb) ... Setting up rkhunter (1.2.9-2) ... # rkhunter --version Rootkit Hunter 1.2.9 #
rkhunter の実行
# rkhunter -c
Rootkit Hunter 1.2.9 is running
Determining OS... Unknown
Warning: This operating system is not fully supported!
All MD5 checks will be skipped!
Checking binaries
* Selftests
Strings (command) [ OK ]
* System tools
Skipped!
Check rootkits
* Default files and directories
Rootkit '55808 Trojan - Variant A'... [ OK ]
ADM Worm... [ OK ]
Rootkit 'AjaKit'... [ OK ]
Rootkit 'aPa Kit'... [ OK ]
Rootkit 'Apache Worm'... [ OK ]
Rootkit 'Ambient (ark) Rootkit'... [ OK ]
Rootkit 'Balaur Rootkit'... [ OK ]
Rootkit 'BeastKit'... [ OK ]
Rootkit 'beX2'... [ OK ]
Rootkit 'BOBKit'... [ OK ]
Rootkit 'CiNIK Worm (Slapper.B variant)'... [ OK ]
Rootkit 'Danny-Boy's Abuse Kit'... [ OK ]
Rootkit 'Devil RootKit'... [ OK ]
Rootkit 'Dica'... [ OK ]
Rootkit 'Dreams Rootkit'... [ OK ]
Rootkit 'Duarawkz'... [ OK ]
Rootkit 'Flea Linux Rootkit'... [ OK ]
Rootkit 'FreeBSD Rootkit'... [ OK ]
Rootkit 'Fuck`it Rootkit'... [ OK ]
Rootkit 'GasKit'... [ OK ]
Rootkit 'Heroin LKM'... [ OK ]
Rootkit 'HjC Kit'... [ OK ]
Rootkit 'ignoKit'... [ OK ]
Rootkit 'ImperalsS-FBRK'... [ OK ]
Rootkit 'Irix Rootkit'... [ OK ]
Rootkit 'Kitko'... [ OK ]
Rootkit 'Knark'... [ OK ]
Rootkit 'Li0n Worm'... [ OK ]
Rootkit 'Lockit / LJK2'... [ OK ]
Rootkit 'MRK'... [ OK ]
Rootkit 'Ni0 Rootkit'... [ OK ]
Rootkit 'RootKit for SunOS / NSDAP'... [ OK ]
Rootkit 'Optic Kit (Tux)'... [ OK ]
Rootkit 'Oz Rootkit'... [ OK ]
Rootkit 'Portacelo'... [ OK ]
Rootkit 'R3dstorm Toolkit'... [ OK ]
Rootkit 'RH-Sharpe's rootkit'... [ OK ]
Rootkit 'RSHA's rootkit'... [ OK ]
Sebek LKM... [ OK ]
Rootkit 'Scalper Worm'... [ OK ]
Rootkit 'Shutdown'... [ OK ]
Rootkit 'SHV4'... [ OK ]
Rootkit 'SHV5'... [ OK ]
Rootkit 'Sin Rootkit'... [ OK ]
Rootkit 'Slapper'... [ OK ]
Rootkit 'Sneakin Rootkit'... [ OK ]
Rootkit 'Suckit Rootkit'... [ OK ]
Rootkit 'SunOS Rootkit'... [ OK ]
Rootkit 'Superkit'... [ OK ]
Rootkit 'TBD (Telnet BackDoor)'... [ OK ]
Rootkit 'TeLeKiT'... [ OK ]
Rootkit 'T0rn Rootkit'... [ OK ]
Rootkit 'Trojanit Kit'... [ OK ]
Rootkit 'Tuxtendo'... [ OK ]
Rootkit 'URK'... [ OK ]
Rootkit 'VcKit'... [ OK ]
Rootkit 'Volc Rootkit'... [ OK ]
Rootkit 'X-Org SunOS Rootkit'... [ OK ]
Rootkit 'zaRwT.KiT Rootkit'... [ OK ]
* Suspicious files and malware
Scanning for known rootkit strings [ OK ]
Scanning for known rootkit files [ OK ]
Testing running processes... [ Skipped ]
Miscellaneous Login backdoors [ OK ]
Miscellaneous directories [ OK ]
Software related files [ OK ]
Sniffer logs [ OK ]
[Press to continue]
* Trojan specific characteristics
shv4
Checking /etc/rc.d/rc.sysinit [ Not found ]
Checking /etc/inetd.conf [ Clean ]
Checking /etc/xinetd.conf [ Skipped ]
* Suspicious file properties
chmod properties
Checking /bin/ps [ Clean ]
Checking /bin/ls [ Clean ]
Checking /usr/bin/w [ Clean ]
Checking /usr/bin/who [ Clean ]
Checking /bin/netstat [ Clean ]
Checking /bin/login [ Clean ]
Script replacements
Checking /bin/ps [ Clean ]
Checking /bin/ls [ Clean ]
Checking /usr/bin/w [ Clean ]
Checking /usr/bin/who [ Clean ]
Checking /bin/netstat [ Clean ]
Checking /bin/login [ Clean ]
* OS dependant tests
Linux
Checking loaded kernel modules... [ OK ]
Checking file attributes [ OK ]
Checking LKM module path [ OK ]
Networking
* Check: frequently used backdoors
Port 2001: Scalper Rootkit [ OK ]
Port 2006: CB Rootkit [ OK ]
Port 2128: MRK [ OK ]
Port 14856: Optic Kit (Tux) [ OK ]
Port 47107: T0rn Rootkit [ OK ]
Port 60922: zaRwT.KiT [ OK ]
* Interfaces
Scanning for promiscuous interfaces... [ OK ]
[Press to continue]
System checks
* Allround tests
Checking hostname... Found. Hostname is Ouverture
Checking for passwordless user accounts... OK
Checking for differences in user accounts... [ NA ]
Checking for differences in user groups... Creating file It seems this is your first time.
Checking boot.local/rc.local file...
- /etc/rc.local [ OK ]
- /etc/rc.d/rc.local [ Not found ]
- /usr/local/etc/rc.local [ Not found ]
- /usr/local/etc/rc.d/rc.local [ Not found ]
- /etc/conf.d/local.start [ Not found ]
- /etc/init.d/boot.local [ Not found ]
Checking rc.d files... [ Not found ]
Checking history files
Bourne Shell [ OK ]
* Filesystem checks
Checking /dev for suspicious files... [ OK ]
Scanning for hidden files... [ Warning! ]
---------------
/etc/.java
/etc/.pwd.lock /dev/.static
/dev/.udev
/dev/.initramfs
/dev/.initramfs-tools
---------------
Please inspect: /etc/.java (directory) /dev/.static (directory) /dev/.udev (directory) /dev/.initramfs (directory)
[Press to continue]
Application advisories
* Application scan
Checking Apache2 modules ... [ OK ]
Checking Apache configuration ... [ OK ]
* Application version scan
- Exim MTA 4.63 [ Unknown ]
- GnuPG 1.4.6 [ Unknown ]
- Bind DNS 9.3.4-P1.1 [ Unknown ]
- OpenSSL 0.9.8c [ Unknown ]
- OpenSSH 4.3p2 [ Unknown ]
Your system contains some unknown version numbers. Please run Rootkit Hunter
with the --update parameter or contact us through the Rootkit Hunter mailinglist
at rkhunter-users@lists.sourceforge.net.
Security advisories
* Check: Groups and Accounts
Searching for /etc/passwd... [ Found ]
Checking users with UID '0' (root)... [ OK ]
* Check: SSH
Searching for sshd_config...
Found /etc/ssh/sshd_config
Checking for allowed root login... Watch out Root login possible. Possible risk!
info: "PermitRootLogin yes" found in file /etc/ssh/sshd_config
Hint: See logfile for more information about this issue
Checking for allowed protocols... [ OK (Only SSH2 allowed) ]
* Check: Events and Logging
Search for syslog configuration... [ OK ]
Checking for running syslog slave... [ OK ]
Checking for logging to remote system... [ OK (no remote logging) ]
[Press to continue]
---------------------------- Scan results ----------------------------
MD5 scan
Skipped
File scan
Scanned files: 342
Possible infected files: 0
Application scan
Vulnerable applications: 0
Scanning took 66 seconds
-----------------------------------------------------------------------
Do you have some problems, undetected rootkits, false positives, ideas
or suggestions? Please e-mail us through the Rootkit Hunter mailinglist
at rkhunter-users@lists.sourceforge.net.
-----------------------------------------------------------------------
#
"hidden files" で chkrootkit とは異なるファイルが指摘された。
こちらも特に問題は無い様だ。
chkrootkit に引き続き rkhunter も恙なく終了して何より。
May 28, 2009
[Linux] chkrootkit を試してみた。
chkrootkit は rootkit を検出してくれるツール。 面白そうなので試してみた。
- chkrootkit
- http://www.chkrootkit.org/
chkrootkit のインストール
chkrootkit 0.47 を Debian Etch にインストールした。 apt でインストール出来るので非常に楽。
# apt-get install chkrootkit Reading package lists... Done Building dependency tree... Done The following NEW packages will be installed: chkrootkit (SNIP) Unpacking chkrootkit (from .../chkrootkit_0.47-2_i386.deb) ... Setting up chkrootkit (0.47-2) ... # chkrootkit -V chkrootkit version 0.47
chkrootkit の実行
"suspicious file" で指摘されたファイルは調べてみたところ特に危険では無い様だ。 特に問題は無くて何より。# chkrootkit ROOTDIR is `/' Checking `amd'... not found Checking `basename'... not infected Checking `biff'... not found Checking `chfn'... not infected Checking `chsh'... not infected Checking `cron'... not infected Checking `crontab'... not infected Checking `date'... not infected Checking `du'... not infected Checking `dirname'... not infected Checking `echo'... not infected Checking `egrep'... not infected Checking `env'... not infected Checking `find'... not infected Checking `fingerd'... not found Checking `gpm'... not found Checking `grep'... not infected Checking `hdparm'... not found Checking `su'... not infected Checking `ifconfig'... not infected Checking `inetd'... not infected Checking `inetdconf'... not infected Checking `identd'... not found Checking `init'... not infected Checking `killall'... not found Checking `ldsopreload'... not infected Checking `login'... not infected Checking `ls'... not infected Checking `lsof'... not found Checking `mail'... not infected Checking `mingetty'... not found Checking `netstat'... not infected Checking `named'... not infected Checking `passwd'... not infected Checking `pidof'... not infected Checking `pop2'... not found Checking `pop3'... not found Checking `ps'... not infected Checking `pstree'... not found Checking `rpcinfo'... not infected Checking `rlogind'... not found Checking `rshd'... not found Checking `slogin'... not infected Checking `sendmail'... not infected Checking `sshd'... not infected Checking `syslogd'... not infected Checking `tar'... not infected Checking `tcpd'... not infected Checking `tcpdump'... not infected Checking `top'... not infected Checking `telnetd'... not found Checking `timed'... not found Checking `traceroute'... not infected Checking `vdir'... not infected Checking `w'... not infected Checking `write'... not infected Checking `aliens'... no suspect files Searching for sniffer's logs, it may take a while... nothing found Searching for HiDrootkit's default dir... nothing found Searching for t0rn's default files and dirs... nothing found Searching for t0rn's v8 defaults... nothing found Searching for Lion Worm default files and dirs... nothing found Searching for RSHA's default files and dir... nothing found Searching for RH-Sharpe's default files... nothing found Searching for Ambient's rootkit (ark) default files and dirs... nothing found Searching for suspicious files and dirs, it may take a while... /usr/lib/iceape/.autoreg /lib/init/rw/.ramfs Searching for LPD Worm files and dirs... nothing found Searching for Ramen Worm files and dirs... nothing found Searching for Maniac files and dirs... nothing found Searching for RK17 files and dirs... nothing found Searching for Ducoci rootkit... nothing found Searching for Adore Worm... nothing found Searching for ShitC Worm... nothing found Searching for Omega Worm... nothing found Searching for Sadmind/IIS Worm... nothing found Searching for MonKit... nothing found Searching for Showtee... nothing found Searching for OpticKit... nothing found Searching for T.R.K... nothing found Searching for Mithra... nothing found Searching for OBSD rk v1... nothing found Searching for LOC rootkit... nothing found Searching for Romanian rootkit... nothing found Searching for Suckit rootkit... nothing found Searching for Volc rootkit... nothing found Searching for Gold2 rootkit... nothing found Searching for TC2 Worm default files and dirs... nothing found Searching for Anonoying rootkit default files and dirs... nothing found Searching for ZK rootkit default files and dirs... nothing found Searching for ShKit rootkit default files and dirs... nothing found Searching for AjaKit rootkit default files and dirs... nothing found Searching for zaRwT rootkit default files and dirs... nothing found Searching for Madalin rootkit default files... nothing found Searching for Fu rootkit default files... nothing found Searching for ESRK rootkit default files... nothing found Searching for rootedoor... nothing found Searching for ENYELKM rootkit default files... nothing found Searching for anomalies in shell history files... nothing found Checking `asp'... not infected Checking `bindshell'... not infected Checking `lkm'... chkproc: nothing detected Checking `rexedcs'... not found Checking `sniffer'... lo: not promisc and no packet sniffer sockets eth0: PACKET SNIFFER(/usr/sbin/snort[647]) Checking `w55808'... not infected Checking `wted'... chkwtmp: nothing deleted Checking `scalper'... not infected Checking `slapper'... not infected Checking `z2'... chklastlog: nothing deleted #
May 27, 2009
[Misc] SnortAlog で snort のレポート出力
Snort を入れてはあるものの。 レポートはデイリーでメールされてくるものの。 最近は全く見ていなかったりする。 Snort を入れてある意味が全然無いので、Snort のレポートに目を通す気になるようにすべく SnortAlog を入れてみた。
- SnortAlog : IDS/IPS and Firewall log Analyzer
- http://jeremy.chartier.free.fr/snortalog/
SnortAlog のインストール
Debian にインストールしたときのログ。 HTML 形式のレポート作成には GD Graph が必要なので、予め apt でインストールしておく。
$ apt-get install libgd-graph-perl
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
libgd-gd2-noxpm-perl libgd-text-perl libgd2-noxpm
Suggested packages:
ttf-dustin libgd-tools
The following NEW packages will be installed:
libgd-gd2-noxpm-perl libgd-graph-perl libgd-text-perl libgd2-noxpm
0 upgraded, 4 newly installed, 0 to remove and 3 not upgraded.
Need to get 835kB of archives.
After unpacking 2232kB of additional disk space will be used.
Do you want to continue [Y/n]? y
(SNIP)
Setting up libgd-text-perl (0.86-3.1) ...
Setting up libgd-graph-perl (1.43.08-2.1) ...
$ wget http://jeremy.chartier.free.fr/snortalog/downloads/snortalog/snortalog_v2.4.2.tgz
--23:38:54-- http://jeremy.chartier.free.fr/snortalog/downloads/snortalog/snortalog_v2.4.2.tgz
=> `snortalog_v2.4.2.tgz'
(SNIP)
23:38:59 (165.67 KB/s) - `snortalog_v2.4.2.tgz' saved [795050/795050]
$ tar zxvf ./snortalog_v2.4.2.tgz
snortalog/CHANGES
snortalog/conf/
(SNIP)
snortalog/picts/p_27.gif
snortalog/snortalog.pl
$ mv ./snortalog ./snortalog-2.4.2
$ mv ./snortalog-2.4.2 /opt
$ ln -s /opt/snortalog-2.4.2 /opt/snortalog
$
デイリー HTML レポートの作成
以下の様なシェルスクリプトをでっち上げてデイリーで HTML レポートを作成する。
$ cat /etc/cron.daily/snortalog
#!/bin/sh
SNORTLOG_DIR=/var/log/snort
SNORTALOG_HOME=/opt/snortalog
OUTPUT_DIR=/var/www/html/snort
REPORT_HTML=index.html
DATE=`date --date 'yesterday' +'%Y%m%d'`
mkdir -p ${OUTPUT_DIR}/${DATE}/picts
cd ${SNORTLOG_DIR}
gzip -d ./alert.1.gz
cd ${SNORTALOG_HOME}
./snortalog.pl -file ${SNORTLOG_DIR}/alert.1 -3 -r -pictsdir ../picts -g gif -report -o ${OUTPUT_DIR}/${DATE}/${REPORT_HTML}
mv ./*.gif ${OUTPUT_DIR}/${DATE}
cd ${SNORTLOG_DIR}
gzip ./alert.1
May 26, 2009
[Library] iCal4j にチャレンジ
iCal4j とは
iCal4j は iCalendar を Java で扱うライブラリ。 公式サイトによると
iCal4j is a Java API that provides support for the iCalendar specification as defined in RFC2445. This support includes a Parser, Object Model and Generator for iCalendar data streams.というものらしい。
- iCal4j
- http://ical4j.sourceforge.net/
- iCal4j - API Documents
- http://m2.modularity.net.au/projects/ical4j/apidocs/
- iCal4j - Download
- http://sourceforge.net/project/showfiles.php?group_id=107024
- iCal4j - Source Repository
- http://ical4j.cvs.sourceforge.net/viewvc/ical4j/iCal4j/
Maven2 での iCal4j の利用
iCal4j は Maven Central Repository に登録されている。便利。場所は こちら。 Maven2 で管理しているプロジェクトであれば pom.xml に
<project>
<dependencies>
<dependency>
<groupId>ical4j</groupId>
<artifactId>ical4j</artifactId>
<version>0.9.20</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
を追記するだけで利用出来るようになる。
サンプルコード
イベントを作成し、文字列として書き出すコードのサンプルはこちら。
// イベントの生成
VEvent event = new VEvent();
// UID
event.getProperties().add(new Uid("id"));
// タイムゾーン
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance()
.createRegistry();
net.fortuna.ical4j.model.TimeZone timezoneAsIcalTimeZone = registry
.getTimeZone(this.timeZone.getValue());
VTimeZone tz = timezoneAsIcalTimeZone.getVTimeZone();
event.getProperties().add(tz.getTimeZoneId());
// サマリ
event.getProperties().add(new Summary("サマリ"));
// 詳細
event.getProperties().add(new Description("詳細"));
// 場所
event.getProperties().add(new Location("場所"));
// 最終更新日時
event.getProperties().add(
new LastModified(new DateTime(System.currentTimeMillis())));
// 開始日時
event.getProperties().add(
new DtStart(new DateTime(System.currentTimeMillis())));
// 終了日時
event.getProperties().add(
new DtEnd(new DateTime(System.currentTimeMillis() + 60 * 60 * 1000)));
// カレンダの生成
Calendar calendar = new Calendar();
calendar.getProperties().add(new ProdId("productId"));
calendar.getProperties().add(CalScale.GREGORIAN);
calendar.getProperties().add(Version.VERSION_2_0);
// カレンダにイベントを追加
calendar.getComponents().add(event);
// カレンダを文字列として書き出す
ByteArrayOutputStream baos = new ByteArrayOutputStream();
CalendarOutputter outputter = new CalendarOutputter();
outputter.output(calendar, baos);
String calendarAsString = baos.toString("UTF-8");
公式サイトに様々なサンプルコードが紹介されている。
- iCal4j - Examples
- http://wiki.modularity.net.au/ical4j/index.php?title=Examples
May 25, 2009
[Misc] IE6, IE7, IE8 の共存方法メモ
Microsoft 謹製の比較ツール。
- Microsoft Expression Web SuperPreview for Windows Internet Explorer
- http://www.microsoft.com/downloads/details.aspx?FamilyID=8e6ac106-525d-45d0-84db-dccff3fae677&displaylang=en
おなじみ IETester。
それぞれインストールする方法も。こちらは IT戦記さんの 「IE6 と IE7 と IE8 を同じマシンで共存させる方法」 からの情報。多謝。ただ、残念なことに Windows XP Professional (on Parallels) + IE8 環境で試してみたら IE6 のテキストボックスがキー入力を受け付けなかった orz
- Internet Explorer 7 running side by side with IE6.
- http://tredosoft.com/IE7_standalone
- Install multiple versions of IE on your PC
- http://tredosoft.com/Multiple_IE
May 24, 2009
[Subversion] Subversion サーバの移行
Subversion のサーバを移行した。 新しいサーバから全プロジェクトをチェックアウトし直すのは面倒だし時間がかかるので、svn switch でリポジトリの移動をすることに。 異なるサーバ間のワーキングコピー移動は svn switch に --relocate オプションを指定する必要がある。 ちなみに、Subclipse では --relocate オプションを付ける方法が見つからなかった。
異なるサーバ間のワーキングコピー移動方法
$ cd workspace/MyProject $ svn switch --relocate https://oldsvn.example.com/repos/MyProject/trunk https://newsvn.example.com/repos/MyProject/trunk
Subclipse が Subvesion ver.1.4 ベースで、コマンドラインの svn が ver.1.5 以上の環境(要は私の環境)では、svn 実行後にワーキングコピーをダウングレードする必要がある。
詳細は Subversion で削除したファイルをリポジトリから復元する方法と・・・ を参照。$ cd workspace $ ./change-svn-wc-format.py ./MyProject 1.4
May 22, 2009
[Linux] 古い Fedora Core における yum のエラー
Fedora Core 5, 6 辺りで 2009/05 現在 yum を実行すると以下の様なエラーが発生することがある。
# yum check-update Loading "installonlyn" plugin Setting up repositories Error: Cannot find a valid baseurl for repo: updates #
昔は動いていたはずなので、どうも yum リポジトリのミラーリスト取得方法が変更された様だ。 対応方法をメモしておく。# yum check-update Loading "installonlyn" plugin Setting up repositories Error: Cannot find a valid baseurl for repo: extras #
yum リポジトリの設定変更方法
・・・Fedora 5 か。懐かしい響きだ。# cp /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora-updates.repo.original # vi /etc/yum.repos.d/fedora-updates.repo # diff /etc/yum.repos.d/fedora-updates.repo.original /etc/yum.repos.d/fedora-updates.repo 4c4 < mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-fc$releasever&arch=$basearch --- > mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch 12c12 < mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-debug-fc$releasever&arch=$basearch --- > mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-debug-f$releasever&arch=$basearch 20c20 < mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-fc$releasever&arch=$basearch --- > mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-f$releasever&arch=$basearch # cp /etc/yum.repos.d/fedora-extras.repo /etc/yum.repos.d/fedora-extras.repo.original # vi /etc/yum.repos.d/fedora-extras.repo # diff /etc/yum.repos.d/fedora-extras.repo.original /etc/yum.repos.d/fedora-extras.repo 5c5 < enabled=1 --- > enabled=0 #
May 21, 2009
[Misc] iCalendar メモ
iCalendar とはスケジュールや TODO, イベントといったカレンダーで扱われるデータを相互交換するための標準フォーマット。RFC にて仕様が規定されている。
- RFC2445 Internet Calendaring and Scheduling Core Object Specification (iCalendar)
- http://www.ietf.org/rfc/rfc2445.txt
- RFC2446 iCalendar Transport-Independent Interoperability Protocol (iTIP)
- http://www.ietf.org/rfc/rfc2446.txt
- RFC2447 iCalendar Message-Based Interoperability Protocol (iMIP)
- http://www.ietf.org/rfc/rfc2447.txt
- Wikipedia - iCalendar
- http://ja.wikipedia.org/wiki/ICalendar
May 11, 2009
[WebService] 「Amazon アソシエイト Web サービス」改め「Product Advertising API」メモ
Amazon アソシエイト Web サービスが Product Advertising API という名称に変更されるそうだ。 それに伴い、API に対する全てのリクエストで認証が必要となるとのこと。 移行期間は 2009/05/11 から 2009/08/14 の 3 ヶ月間で、2009/08/15 以降は認証が必須になるそうな。 結構オオゴトだ。
Secret Access Key の取得
今までは Access Key ID で呼び出し元を識別していたが、新仕様では Access Key ID に加えて Secret Access Key というものが必要となる。 Secret Access Key は既に Access Key ID を持っているのであれば、http://aws.amazon.com/から Your Account > Access Identifiers で取得できる(要ログイン)。
リクエストの組み立て
次にリクエストを組み立てる。現行仕様での以下のリクエストを認証に対応させてみる。
http://webservices.amazon.co.jp/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=*********************&Operation=ItemLookup&ItemId=4101162069&ResponseGroup=ItemAttributes,Offers,Images,Reviews&Version=2009-01-06まずはパラメータ部分のみをリスト化する。
これに Timestamp を付加する。amazon.co.jp の場合、Timestamp は JST を使用(amazon.com の場合は GMT)し、フォーマットは yyyy-MM-dd'T'HH:mm:ss'Z' とする。Service=AWSECommerceService AWSAccessKeyId=********************* Operation=ItemLookup ItemId=4101162069 ResponseGroup=ItemAttributes,Offers,Images,Reviews Version=2009-01-06
パラメータをソートする。Service=AWSECommerceService AWSAccessKeyId=********************* Operation=ItemLookup ItemId=4101162069 ResponseGroup=ItemAttributes,Offers,Images,Reviews Version=2009-01-06 Timestamp=2009-05-011T12:00:00Z
パラメータを '&' で繋げる。AWSAccessKeyId=********************* ItemId=4101162069 Operation=ItemLookup ResponseGroup=ItemAttributes%2COffers%2CImages%2CReviews Service=AWSECommerceService Timestamp=2009-05-011T12%3A00%3A00Z Version=2009-01-06
AWSAccessKeyId=*********************&ItemId=4101162069&Operation=ItemLookup&ResponseGroup=ItemAttributes%2COffers%2CImages%2CReviews&Service=AWSECommerceService&Timestamp=2009-05-011T12%3A00%3A00Z&Version=2009-01-06'&' で繋げたパラメータの前に以下の 3 行を付加する。
この 4 行のデータを Secret Access Key をキーとして RFC 2104-compliant HMAC with the SHA256 でハッシュ化する。 Java の場合、以下のロジックでハッシュ化できる。GET webservices.amazon.co.jp /onca/xml AWSAccessKeyId=*********************&ItemId=4101162069&Operation=ItemLookup&ResponseGroup=ItemAttributes%2COffers%2CImages%2CReviews &Service=AWSECommerceService&Timestamp=2009-05-011T12%3A00%3A00Z&Version=2009-01-06 ※AWSAccessKeyID 〜 Version=2009-01-06 は一行。
- Java Sample Code for Calculating Signature Version 2 Signatures
- http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/AuthJavaSampleSig2.html
ハッシュ値を URL Encode する。uIwCHHLMsvxxUmd+IX+KqNh9/+eNXlUB2X+L21woSZE=
URL Encode されたハッシュ値をパラメータの最後に付加する。uIwCHHLMsvxxUmd%2BIX%2BKqNh9%2F%2BeNXlUB2X%2BL21woSZE%3D
http://webservices.amazon.co.jp/onca/xml?AWSAccessKeyId=*********************&ItemId=4101162069&Operation=ItemLookup&ResponseGroup=ItemAttributes%2COffers%2CImages%2CReviews&Service=AWSECommerceService&Timestamp=2009-05-011T12%3A00%3A00Z&Version=2009-01-06&Signature=uIwCHHLMsvxxUmd%2BIX%2BKqNh9%2F%2BeNXlUB2X%2BL21woSZE%3Dこれでリクエストは完成。
上記手順のより詳細な情報はこちら
- Example REST Requests
- http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/rest-signature.html
API にアクセス
上で組み立てたリクエストで API にアクセスして正常応答があれば成功。
参考
より詳細な情報は Amazon Product Advertising API のドキュメントを参照のこと。
- Product Advertising API - Request Authentication
- http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/RequestAuthenticationArticle.html



