<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>複眼中心</title>
	<atom:link href="http://rewse.jp/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://rewse.jp/blog</link>
	<description>日本オラクルでデーターベース・パフォーマンス・エンジニアをしている柴田竜典のブログ</description>
	<lastBuildDate>Tue, 21 Feb 2012 13:18:15 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Scientific Linux 6.1 で OpenLDAP 2.4.23 をインストール</title>
		<link>http://rewse.jp/blog/p/4843</link>
		<comments>http://rewse.jp/blog/p/4843#comments</comments>
		<pubDate>Tue, 21 Feb 2012 13:16:50 +0000</pubDate>
		<dc:creator>Tats Shibata</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://rewse.jp/blog/?p=4843</guid>
		<description><![CDATA[<p>ボクの環境では複数の仮想マシンが動いており、OS / Postfix / Devecot / Samba / Apache HTTP Server などがそれぞれ別々にパスワード管理していると面倒なので、LDAPで一元管理している。以下は OpenLDAP 2.4.23 を <a href="http://www.scientificlinux.org/">Scientifc Linux</a> (SL) 6.1 にインストールする方法だが、<a href="http://www.jp.redhat.com/rhel/">Red Hat Enterprise Linux</a> (RHEL) / <a href="http://www.centos.org/">CentOS</a> / <a href="http://www.oracle.com/jp/technologies/linux/">Oracle Linux</a> でも同様だろう。</p>

<p>OpenLDAP 2.3 から非推奨になっていたslapd.confは2.4でついに廃止され、slapd-configを使う方法だけになったのだが、slapd-configでの設定方法が <a href="http://www.openldap.org/doc/admin24/">OpenLDAP Software 2.4 Administrator&#8217;s Guide</a> を読んでも <a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Directory_Servers.html">Red Hat Enterprise Linux 6 Deployment Guide: Directory Servers</a> を読んでもさっぱり分からないので、この記事では従来のsplad.confをslapd-config用に変換するという手法を取っている。公式ガイドの <a href="http://www.openldap.org/doc/admin24/quickstart.html">A Quick-Start Guide</a> もslapd.confを変換して使っているので（おい）、それほど時代遅れって感じでもないと信じたい。</p> <a href="http://rewse.jp/blog/p/4843">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="imgholder eyecatch"><img src="http://rewse.jp/blog/rsrc/uploads/2012/01/directory.png" alt="" title="Directory" width="434" height="332" class="alignnone size-full wp-image-4991" /></div>

<p>ボクの環境では複数の仮想マシンが動いており、OS / Postfix / Devecot / Samba / Apache HTTP Server などがそれぞれ別々にパスワード管理していると面倒なので、LDAPで一元管理している。以下は OpenLDAP 2.4.23 を <a href="http://www.scientificlinux.org/">Scientifc Linux</a> (SL) 6.1 にインストールする方法だが、<a href="http://www.jp.redhat.com/rhel/">Red Hat Enterprise Linux</a> (RHEL) / <a href="http://www.centos.org/">CentOS</a> / <a href="http://www.oracle.com/jp/technologies/linux/">Oracle Linux</a> でも同様だろう。</p>

<p>OpenLDAP 2.3 から非推奨になっていたslapd.confは2.4でついに廃止され、slapd-configを使う方法だけになったのだが、slapd-configでの設定方法が <a href="http://www.openldap.org/doc/admin24/">OpenLDAP Software 2.4 Administrator&rsquo;s Guide</a> を読んでも <a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Directory_Servers.html">Red Hat Enterprise Linux 6 Deployment Guide: Directory Servers</a> を読んでもさっぱり分からないので、この記事では従来のsplad.confをslapd-config用に変換するという手法を取っている。公式ガイドの <a href="http://www.openldap.org/doc/admin24/quickstart.html">A Quick-Start Guide</a> もslapd.confを変換して使っているので（おい）、それほど時代遅れって感じでもないと信じたい。</p>
<span id="more-4843"></span>
<p>そんなわけでインストール。インストール自体はRPMを入れるだけなので簡単だ。</p>

<pre class="screen">[root@oscar ~]# yum install openldap-servers openldap-clients
......
================================================================================
 Package                  Arch           Version               Repository  Size
================================================================================
Installing:
 openldap-clients         x86_64         2.4.23-15.el6         sl         157 k
 openldap-servers         x86_64         2.4.23-15.el6         sl         2.0 M
......</pre>

<p>LDAPサービスの管理者であるrootdnのパスワードを作成する。</p>

<pre class="screen">[root@oscar ~]# slappasswd
New password: <kbd><var>password</var></kbd>
Re-enter new password: <kbd><var>password</var></kbd>
{SSHA}2kMGre6X2HahyBu2pTQ/kGOgNamKsaVx</pre>

<p>slapd.confのサンプルとなるファイルをコピーし、<code>suffix</code> / <code>rootdn</code> / <code>rootpw</code>を設定する。<code>rootpw</code>は先ほど<code>slappasswd</code>で作成したものだ。</p>

<pre class="screen">[root@oscar ~]# cp -a /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf</pre>

<pre class="brush: plain; first-line: 102; highlight: [103,104,106,107,113]; title: ; notranslate">
database  bdb
#suffix    &quot;dc=my-domain,dc=com&quot;
suffix    &quot;dc=rewse,dc=jp&quot;
checkpoint  1024 15
#rootdn    &quot;cn=Manager,dc=my-domain,dc=com&quot;
rootdn    &quot;cn=Manager,dc=rewse,dc=jp&quot;
# Cleartext passwords, especially for the rootdn, should
# be avoided.  See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
# rootpw    secret
# rootpw    {crypt}ijFYNcSNctBYg
rootpw    {SSHA}2kMGre6X2HahyBu2pTQ/kGOgNamKsaVx</pre>

<p>加えてLDAPデータベースのアクセス権限を設定する。以下では、<code>userPassword</code>属性は自分自身のものであれば変更可能だが他人は認証にしか使えず、それ以外の属性は自分自身のものであれば変更可能だが他人は読込みしか行えない。</p>

<pre class="brush: plain; first-line: 137; highlight: [138,139,140,141,142,143,144,145,146,147,148,149,150,151,152]; title: /etc/openldap/slapd.conf; notranslate">
# allow onlu rootdn to read the monitor
#access to *
#        by dn.exact=&quot;cn=Manager,dc=my-domain,dc=com&quot; read
#        by * none
access to *
        by dn.exact=&quot;cn=Manager,dc=rewse,dc=jp&quot; read
        by * none

access to attrs=userPassword
  by self =rwcsx
  by anonymous auth
  by * none

access to *
  by self =rwcsx
  by * read</pre>

<p>作成したslapd.confが文法的に正しいかテストしよう。</p>

<pre class="screen">[root@oscar ~]# slaptest -f /etc/openldap/slapd.conf
config file testing succeeded</pre>

<p>すでに設定されているslapd-configの設定を削除し、<code>slaptest</code>でslapd.confの設定をslapd-configでの設定に変換する。その後、ファイル所有者を<code>ldap</code>に変更しよう。今後slapd.confを変更したら、この作業を毎回行う必要がある。</p>

<pre class="screen">[root@oscar ~]# rm -rf /etc/openldap/slapd.d/*
[root@oscar ~]# slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
config file testing succeeded
[root@oscar ~]# chown -R ldap:ldap /etc/openldap/slapd.d</pre>

<p>OpenLDAPが内部で使用している <a href="http://www.oracle.com/jp/products/database/berkeley-db/">Oracle Berkeley DB</a> の設定ファイルのサンプルをコピーし、ファイル所有者を変更する。小規模環境ならサンプル・ファイルそのままで問題ないだろう。</p>

<pre class="screen">[root@oscar ~]# cp -a /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
[root@oscar ~]# chown ldap:ldap /var/lib/ldap/DB_CONFIG</pre>

<p>OpenLDAPサーバーを起動し、OS起動時に同時起動するように設定する。</p>

<pre class="screen">[root@oscar ~]# service slapd start
slapd を起動中:                                            [  OK  ]
[root@oscar ~]# chkconfig slapd on</pre>

<p>LDAPデータベースの中身はまだ空っぽなので、ボクは以下のようなディレクトリをまずは用意した。</p>

<pre class="brush: plain; title: /var/lib/ldap/ldif/init.ldif; notranslate">dn: dc=rewse,dc=jp
objectClass: organization
objectClass: dcObject
o: Rewse Lab.
dc: rewse

dn: cn=Manager,dc=rewse,dc=jp
objectClass: organizationalRole
cn: Manager

dn: ou=People,dc=rewse,dc=jp
objectClass: organizationalUnit
ou: People

dn: ou=Services,dc=rewse,dc=jp
objectClass: organizationalUnit
ou: Services

dn: ou=Groups,dc=rewse,dc=jp
objectClass: organizationalUnit
ou: Groups

dn: ou=Machines,dc=rewse,dc=jp
objectClass: organizationalUnit
ou: Machines</pre>

<p>作成したLDIFを追加する。</p>

<pre class="screen">[root@oscar ~]# ldapadd -xW -D cn=Manager,dc=rewse,dc=jp -h localhost -f /var/lib/ldap/ldif/init.ldif
Enter LDAP Password: <kbd><var>password</var></kbd>
adding new entry "dc=rewse,dc=jp"

adding new entry "cn=Manager,dc=rewse,dc=jp"

adding new entry "ou=People,dc=rewse,dc=jp"

adding new entry "ou=Services,dc=rewse,dc=jp"

adding new entry "ou=Groups,dc=rewse,dc=jp"

adding new entry "ou=Machines,dc=rewse,dc=jp"</pre>

<p>正しく追加できたか確認し、問題なければOpenLDAPサーバーは一通り動作したことになる。</p>

<pre class="screen">[root@oscar ~]# ldapsearch -xW -D cn=Manager,dc=rewse,dc=jp -h localhost
Enter LDAP Password: <kbd><var>password</var></kbd>
# extended LDIF
#
# LDAPv3
# base <dc=rewse,dc=jp> (default) with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# rewse.jp
dn: dc=rewse,dc=jp
objectClass: organization
objectClass: dcObject
o: Rewse Lab.
dc: rewse
......</pre>

<p>ちなみにslapd-configでさっぱり分からない点は「<code>cn=config</code>の<code>olcRootPW</code>を<code>ldapadd</code>するときのパスワードってなに？ パスワードなしだとログインできないし、/etc/openldap/slapd.d 以下は直接編集するなって書いてあるし……」と「<code>include samba.schema</code> ってLDIFにどうやってするの!?」の2つ。こんな基本的なことがマニュアルに書いてないなんて絶対おかしいよ。</p>]]></content:encoded>
			<wfw:commentRss>http://rewse.jp/blog/p/4843/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scientific Linux 6.1 に MySQL 5.1.52 をインストール</title>
		<link>http://rewse.jp/blog/p/4370</link>
		<comments>http://rewse.jp/blog/p/4370#comments</comments>
		<pubDate>Wed, 15 Feb 2012 13:20:23 +0000</pubDate>
		<dc:creator>Tats Shibata</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://rewse.jp/blog/?p=4370</guid>
		<description><![CDATA[<p>ボクは <a href="http://www-jp.mysql.com/products/community/">MySQL Community Edition</a> を<a href="http://ja.wordpress.org/">WordPress</a>と<a href="http://www.zabbix.com/jp/">Zabbix</a>で使用しているが、このように自宅でちょっと使う程度の小規模環境でとりあえずMySQLを動かす方法をメモしておく。以下は <a href="http://www.scientificlinux.org/">Scientific Linux</a> (SL) 6.1 にインストールする方法だが、<a href="http://www.jp.redhat.com/rhel/">Red Hat Enterprise Linux</a> (RHEL) / <a href="http://www.centos.org/">CentOS</a> / <a href="http://www.oracle.com/jp/technologies/linux/">Oracle Linux</a> でも同様だろう。</p>

<p>MySQLのRPMは各Linuxディストリビューションに含まれるもの、<a href="http://dev.mysql.com/downloads/mysql/">MySQL純正</a>、<a href="http://iuscommunity.org/">IUS Community</a> 製などがあるが、バージョンにこだわりがないのであればLinuxディストリビューションに含まれるものが依存性解決でトラブらないので簡単だろう。</p> <a href="http://rewse.jp/blog/p/4370">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="imgholder eyecatch"><img src="http://rewse.jp/blog/rsrc/uploads/2012/01/mysql.png" alt="" title="MySQL" width="489" height="332" class="alignnone size-full wp-image-4393" /></div>

<p>ボクは <a href="http://www-jp.mysql.com/products/community/">MySQL Community Edition</a> を<a href="http://ja.wordpress.org/">WordPress</a>と<a href="http://www.zabbix.com/jp/">Zabbix</a>で使用しているが、このように自宅でちょっと使う程度の小規模環境でとりあえずMySQLを動かす方法をメモしておく。以下は <a href="http://www.scientificlinux.org/">Scientific Linux</a> (SL) 6.1 にインストールする方法だが、<a href="http://jp.redhat.com/products/enterprise-linux/">Red Hat Enterprise Linux</a> (RHEL) / <a href="http://www.centos.org/">CentOS</a> / <a href="http://www.oracle.com/jp/technologies/linux/">Oracle Linux</a> でも同様だろう。</p>

<p>MySQLのRPMは各Linuxディストリビューションに含まれるもの、<a href="http://dev.mysql.com/downloads/mysql/">MySQL純正</a>、<a href="http://iuscommunity.org/">IUS Community</a> 製などがあるが、バージョンにこだわりがないのであればLinuxディストリビューションに含まれるものが依存性解決でトラブらないので簡単だろう。</p>

<pre class="screen">[root@oscar ~]# yum install mysql-server
......
================================================================================
 Package               Arch          Version                    Repository
                                                                           Size
================================================================================
Installing:
 mysql-server          x86_64        5.1.52-1.el6_0.1           sl        8.1 M
Installing for dependencies:
 mysql                 x86_64        5.1.52-1.el6_0.1           sl        888 k
 perl-DBD-MySQL        x86_64        4.013-3.el6                sl        133 k
 perl-DBI              x86_64        1.609-4.el6                sl        704 k
......</pre>
<span id="more-4370"></span>
<p>MySQLのサーバー設定を変更する。たいていの場合はデフォルトのままでもかまわないが、ボクは以下のような値で始めることが多い。</p>

<pre class="brush: plain; highlight: [2,3,4,9,10,11,12,13,14,15,16,22,23]; title: /etc/my.cnf; notranslate">[mysqld]
#datadir=/var/lib/mysql
datadir=/var/lib/mysql/data
log-bin=/var/lib/mysql/binlog/binlog
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server=utf8
default-storage_engine=InnoDB
innodb_buffer_pool_size=50M
query_cache_size=8M
thread_cache_size=8
expire_logs_days=7
slow_query_log=1
long_query_time=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysql]
default-character-set=utf8</pre>

<p>必要なディレクトリを作成し、OS起動時にMySQLが自動起動するようにし、MySQLを起動する。</p>

<pre class="screen">[root@oscar ~]# mkdir /var/lib/mysql/data /var/lib/mysql/binlog
[root@oscar ~]# chown -R mysql:mysql /var/lib/mysql
[root@oscar ~]# chkconfig mysqld on
[root@oscar ~]# service mysqld start
MySQL データベースを初期化中:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h oscar.rewse.jp password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &amp;

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [  OK  ]
mysqld を起動中:                                           [  OK  ]</pre>

<p>初期パスワード設定などは<code>mysql_secure_installation</code>を使うのが簡単だろう。</p>

<pre class="screen">[root@oscar ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.</pre>

<p>MySQLのrootパスワードを設定する。</p>

<pre class="screen">Enter current password for root (enter for none): <kbd>[Enter]</kbd>
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] <kbd>Y</kbd>
New password: <kbd><var>password</var></kbd>
Re-enter new password: <kbd><var>password</var></kbd>
Password updated successfully!
Reloading privilege tables..
 ... Success!</pre>

<p>通常は必要ない匿名ユーザーを削除する。</p>

<pre class="screen">By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] <kbd>Y</kbd>
 ... Success!</pre>

<p>rootはリモートからログインできないようする。</p>

<pre class="screen">Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] <kbd>Y</kbd>
 ... Success!</pre>

<p>必要なければtestデータベースを削除する。</p>

<pre class="screen">By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] <kbd>Y</kbd>
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!</pre>

<p>権限テーブルを再読み込みし、設定を即座に反映させる。</p>

<pre class="screen">Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] <kbd>Y</kbd>
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!</pre>

<p>これでとりあえず動くMySQLは用意できた。つづいてバックアップを行うCronスクリプトを設置する。以下のソースコードは<a href="http://rewse.jp/license/2011.01.txt">BSDライセンスを元としたこちらのライセンス</a>に従って再頒布および使用ができる。このスクリプトの最新版は <a href="https://github.com/rewse/mysqlbackup.cron">GitHub: rewse / mysqlbackup.cron</a> にある。</p>

<pre class="brush: bash; title: /etc/cron.daily/0-mysqlbackup.cron; notranslate">#!/bin/sh

# Password for MySQL root
password=

target_dir=&quot;/var/lib/mysql/bak&quot;

mysqldump \
  --user=root \
  --password=$password \
  --lock-all-tables \
  --flush-logs \
  --default-character-set=utf8 \
  --all-databases \
  &gt; $target_dir/mysql.dump.new

if [ $? != 0 ]; then
  echo &quot;[ERROR] mysqldump was failed.&quot; 1&gt;&amp;2
  exit 1
fi

mv -f $target_dir/mysql.dump.new $target_dir/mysql.dump</pre>

<p>ボクの場合、データ量もそれほど大きくないことから、mysqldumpで表ロックをかけた状態で毎日フルバックアップしているが、そうも行かない場合は差分バックアップや <a href="http://www-jp.mysql.com/products/enterprise/backup.html">MySQL Enterprise Backup</a> を検討してほしい。ローカルに出力されたMySQLバックアップは、その後の<a href="https://github.com/rewse/backup.cron" title="GitHub: rewse / backup.cron">システム全体のバックアップ・スクリプト</a>で別サーバーにコピーされる。</p>]]></content:encoded>
			<wfw:commentRss>http://rewse.jp/blog/p/4370/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scientific Linux 6.1 にLDAP経由でログイン</title>
		<link>http://rewse.jp/blog/p/3758</link>
		<comments>http://rewse.jp/blog/p/3758#comments</comments>
		<pubDate>Wed, 08 Feb 2012 13:46:06 +0000</pubDate>
		<dc:creator>Tats Shibata</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://rewse.jp/blog/?p=3758</guid>
		<description><![CDATA[<p>LDAPデータをPOSIXユーザーとして使う、つまり、LDAPのデータでLinuxがログインできるようにしてみよう。これによってNISサーバーのようにユーザー管理が一元化できるし、NFSで共有したときのユーザーIDがぐちゃぐちゃになることもなくなる。</p>

<p>このエントリーではすでに構築済みのLDAPサーバーに <a href="http://www.scientificlinux.org/">Scientific Linux</a> (SL) 6.1 をクライアントとしてPAM経由で接続する方法を示している。<a href="http://www.jp.redhat.com/rhel/">Red Hat Enterprise Linux</a> (RHEL) / <a href="http://www.centos.org/">CentOS</a> / <a href="http://www.oracle.com/jp/technologies/linux/">Oracle Linux</a> でも同様の方法で設定できるだろう。</p>

<p>PAMでLDAPを使用できるようにするモジュールであるpam_ldapとnss-pam-ldapd（nss_ldapは Scientific Linux 6 から廃止）、設定ツールであるauthconfig、毎回LDAPサーバーにアクセスせずにローカルでキャッシュるためのネーム・サービス・キャッシング・デーモン (nscd) をインストールする。なお、この環境ではauthconfigはインストール済みであった。</p> <a href="http://rewse.jp/blog/p/3758">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="imgholder eyecatch"><img src="http://rewse.jp/blog/rsrc/uploads/2011/07/scientificlinux6.png" alt="" title="Scientific Linux" width="250" height="250" class="alignnone size-full wp-image-3462" /></div>

<p>LDAPデータをPOSIXユーザーとして使う、つまり、LDAPのデータでLinuxがログインできるようにしてみよう。これによってNISサーバーのようにユーザー管理が一元化できるし、NFSで共有したときのユーザーIDがぐちゃぐちゃになることもなくなる。</p>

<p>このエントリーではすでに構築済みのLDAPサーバーに <a href="http://www.scientificlinux.org/">Scientific Linux</a> (SL) 6.1 をクライアントとしてPAM経由で接続する方法を示している。<a href="http://www.jp.redhat.com/rhel/">Red Hat Enterprise Linux</a> (RHEL) / <a href="http://www.centos.org/">CentOS</a> / <a href="http://www.oracle.com/jp/technologies/linux/">Oracle Linux</a> でも同様の方法で設定できるだろう。</p>

<p>PAMでLDAPを使用できるようにするモジュールであるpam_ldapとnss-pam-ldapd（nss_ldapは Scientific Linux 6 から廃止）、設定ツールであるauthconfig、毎回LDAPサーバーにアクセスせずにローカルでキャッシュるためのネーム・サービス・キャッシング・デーモン (nscd) をインストールする。なお、この環境ではauthconfigはインストール済みであった。</p>

<pre class="screen">[root@oscar ~]# yum install pam_ldap nss-pam-ldapd authconfig nscd
......
================================================================================
 Package            Arch             Version                 Repository    Size
================================================================================
Installing:
 nscd               x86_64           2.12-1.25.el6           sl           199 k
 nss-pam-ldapd      x86_64           0.7.5-7.el6             sl           147 k
 pam_ldap           x86_64           185-8.el6               sl            86 k
......</pre>
<span id="more-3758"></span>
<p>authconfigを使用してLDAP認証でログインできるように設定ファイルを書き換える。</p>

<pre class="screen">[root@oscar ~]# authconfig --update --enableldap --enablecache --enableldapauth --ldapserver=ldap.rewse.jp,ldap2.rewse.jp --ldapbasedn="dc=rewse,dc=jp"
nslcd を起動中:                                            [  OK  ]
nscd を起動中:                                             [  OK  ]</pre>

<p>加えて、このままではLDAPサーバーにもし接続できなかった場合に延々とリトライしてしまうで、すぐにエラーになるように<code>bind_policy</code>を設定した。</p>

<pre class="brush: plain; first-line: 14; highlight: [17]; title: /etc/openldap/ldap.conf; notranslate">URI ldap://ldap.rewse.jp/ ldap://ldap2.rewse.jp/
BASE dc=rewse,dc=jp
TLS_CACERTDIR /etc/openldap/cacerts
bind_policy soft</pre>

<p>また、ホーム・ディレクトリが存在しない場合に自動作成するようにした。</p>

<pre class="brush: plain; first-line: 22; highlight: [27]; title: /etc/pam.d/system-auth; notranslate">session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_ldap.so
session     optional      pam_mkhomedir.so skel=/etc/skel umask=077</pre>

<p>これでLDAPサーバーの情報を参照できるようになっているはずなので、/etc/passwdに存在しないユーザー情報が見えることを確認してみよう。</p>

<pre class="screen">[root@oscar ~]# grep tats /etc/passwd
[root@oscar ~]# getent passwd tats
tats:*:1000:1000:Tatsunori Shibata:/home/tats:/bin/bash
[root@oscar ~]# id tats
uid=1000(tats) gid=1000(tats) 所属グループ=512(Domain Admins),2000(hobbit),1000(tats)</pre>

<p>以下のように、LDAP認証でログインできるようになったはずだ。</p>

<pre class="screen">[root@oscar ~]# su - tats
ディレクトリ '/home/tats' を作成中</pre>]]></content:encoded>
			<wfw:commentRss>http://rewse.jp/blog/p/3758/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scientific Linux 6 でのSELinux管理コマンドまとめ</title>
		<link>http://rewse.jp/blog/p/4825</link>
		<comments>http://rewse.jp/blog/p/4825#comments</comments>
		<pubDate>Mon, 06 Feb 2012 12:30:59 +0000</pubDate>
		<dc:creator>Tats Shibata</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://rewse.jp/blog/?p=4825</guid>
		<description><![CDATA[<p><a href="http://www.centos.org/">CentOS</a> 5 から <a href="http://www.scientificlinux.org/">Scientific Linux</a> 6 で環境再構築するタイミングで<a href="http://www.nsa.gov/research/selinux/">SELinux</a>を有効にして運用しているので、SELinux運用において必要なコマンドをまとめておく。SELinux管理について体系的に学びたい場合は <a href="http://itpro.nikkeibp.co.jp/article/COLUMN/20070827/280411/">日経Linux: 第一人者がやさしく教える新SELinux入門</a> が良いだろう。</p>

<p>SELinuxは「○○ドメインは△△タイプを□□できる」（例: smbd_tドメインはsamba_share_tタイプをreadできる）といった定義がされたポリシー・ファイルによってアクセス制御を行う。つまり（Targetedポリシーの）SELinux管理とは、このドメインとタイプを管理することが中心となる。</p> <a href="http://rewse.jp/blog/p/4825">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="imgholder eyecatch"><img src="http://rewse.jp/blog/rsrc/uploads/2012/01/nsa.png" alt="" title="National Security Agency" width="332" height="332" class="alignnone size-full wp-image-4826" /></div>

<p><a href="http://www.centos.org/">CentOS</a> 5 から <a href="http://www.scientificlinux.org/">Scientific Linux</a> 6 で環境再構築するタイミングで<a href="http://www.nsa.gov/research/selinux/">SELinux</a>を有効にして運用しているので、SELinux運用において必要なコマンドをまとめておく。SELinux管理について体系的に学びたい場合は <a href="http://itpro.nikkeibp.co.jp/article/COLUMN/20070827/280411/">日経Linux: 第一人者がやさしく教える新SELinux入門</a> が良いだろう。</p>

<h2>セキュリティ・コンテキストの読み方</h2>

<p>&lt;ユーザー名&gt;:&lt;ロール&gt;:&lt;ドメイン or タイプ&gt;:&lt;MLS&gt;</p>

<table>
  <tr>
    <th>識別子</th>
    <th>意味</th>
  </tr>
  <tr>
    <td>ユーザー名</td>
    <td>プロセスまたはファイルを作成したSELinuxユーザー名。あまり気にしなくてよい</td>
  </tr>
  <tr>
    <td>ロール</td>
    <td>Strictポリシーで使用する。Targetedポリシーでは使わないので無視してよい</td>
  </tr>
  <tr>
    <td>ドメイン or タイプ</td>
    <td>プロセスの場合はドメインと呼び、ファイルなどのリソースの場合はタイプと呼ぶ。重要な識別子</td>
  </tr>
  <tr>
    <td>MLS</td>
    <td>MLSポリシーで使用するレベルやカテゴリー。Targetedポリシーでは使わないので無視してよい</td>
  </tr>
</table>
<span id="more-4825"></span>
<p>SELinuxは「○○ドメインは△△タイプを□□できる」（例: smbd_tドメインはsamba_share_tタイプをreadできる）といった定義がされたポリシー・ファイルによってアクセス制御を行う。つまり（Targetedポリシーの）SELinux管理とは、このドメインとタイプを管理することが中心となる。</p>

<p>Targetedポリシーの場合、unconfined_tとinitrc_tドメインはすべてのリソースへのすべてのアクセスが許可されている。ログイン・ユーザーの起動したプロセスはすべてunconfined_tドメインで起動されるので、ログインして使用する限りはSELinuxにアクセス拒否されることはない。</p>

<h2>プロセスのセキュリティ・コンテキストの確認方法</h2>

<pre class="screen">[root@oscar ~]# ps auxZ | grep smbd | head -1
system_u:system_r:smbd_t:s0     root      1645  0.0  0.1 211984  2568 ?        Ss   Jan01   0:06 smbd -D</pre>

<h2>リソースのセキュリティ・コンテキストの確認方法</h2>

<pre class="screen">[root@oscar ~]# ls -dZ /var/pub
drwxrwxrwx. root root unconfined_u:object_r:samba_share_t:s0 /var/pub</pre>

<h2>動作モードの確認方法</h2>

<pre class="screen">[root@oscar ~]# getenforce
Enforcing</pre>

<table>
  <tr>
    <th>モード</th>
    <th>意味</th>
  </tr>
  <tr>
    <td>Enforcing</td>
    <td>SELinuxが有効で、ポリシー違反のアクセスは拒否される。本番モード</td>
  </tr>
  <tr>
    <td>Permissive</td>
    <td>SELinuxが有効だが、ポリシー違反のアクセスはログに記録されるだけでアクセスは拒否されない。テスト・モード</td>
  </tr>
  <tr>
    <td>Disabled</td>
    <td>SELinuxが無効</td>
  </tr>
</table>

<h2>動作モードの変更方法</h2>

<pre class="screen">setenfoce 0</pre>

<table>
  <tr>
    <th>引数</th>
    <th>意味</th>
  </tr>
  <tr>
    <td>0</td>
    <td>Permissiveモードに一時的に変更。SELinuxが原因で想定どおり動作しない場合は、このモードに変えてテストしてみるとよい</td>
  </tr>
  <tr>
    <td>1</td>
    <td>Enforceモードに一時的に変更。Permissiveモードから元に戻す場合に使用</td>
  </tr>
</table>

<p>SELinuxの有効無効を変更する、またはEnforcingモードとPermissiveモードを永続的に変更する場合は /etc/selinx/config を変更してOSを再起動する。<code>disabled</code>から<code>enforcing</code>に一気に変更してしまうとセキュリティ・コンテキストが誤っていた場合にOSが起動しないなどの問題が起きるので、<code>permissive</code>で一度起動し、以下の<code>restorecon</code>してから<code>enforcing</code>にするのが安全だろう。</p>

<h2>SELinuxでアクセス拒否されたかどうかの確認方法</h2>

<p>auditパッケージがインストールされており、<code>auditd</code>が起動していれば /var/log/audit/audit.log に<code>type=AVC</code>として記録される。以下はsmbd_tドメインのsmbdプロセスがinitrc_tmp_tタイプの /tmp/zabbix_restart.log をappendしようとしたが拒否されたログだ。</p>

<pre class="screen">[root@oscar ~]# grep type=AVC /var/log/audit/audit.log* | head -1
/var/log/audit/audit.log.1:type=AVC msg=audit(1327050451.239:26832): avc:  denied  { append } for  pid=11406 comm="smbd" path="/tmp/zabbix_restart.log" dev=dm-9 ino=22 scontext=system_u:system_r:smbd_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=file</pre>

<p>audit.logは日時が読みにくいので、<code>ausearch</code>を使うのもよい</p>

<pre class="screen">[root@oscar ~]# ausearch -m avc
----
time-&gt;Fri Jan 20 18:07:31 2012
type=SYSCALL msg=audit(1327050451.239:26832): arch=c000003e syscall=59 success=yes exit=0 a0=1e6f170 a1=1e72e70 a2=1e73610 a3=18 items=0 ppid=11405 pid=11406 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="smbd" exe="/usr/sbin/smbd" subj=system_u:system_r:smbd_t:s0 key=(null)
type=AVC msg=audit(1327050451.239:26832): avc:  denied  { append } for  pid=11406 comm="smbd" path="/tmp/zabbix_restart.log" dev=dm-9 ino=22 scontext=system_u:system_r:smbd_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=file</pre>

<p>setroubleshoot-serverパッケージがインストールされていれば /var/log/message にもアクセス拒否が記録される。</p>

<pre class="screen">[root@oscar ~]# grep setroubleshoot /var/log/messages* | grep SELinux | head -1
/var/log/messages:Jan 01 05:20:47 oscar setroubleshoot: SELinux is preventing the spamd daemon from reading users' home directories. For complete SELinux messages. run sealert -l 301adeba-8de8-4b94-aaa4-be18f4a4ecad</pre>

<p>ログに記された<code>sealert</code>を実行すると、どのようにすればアクセス拒否を解除できるのかのアドバイスがもらえる。ただ、このアドバイスで拒否が解除できるのは五分五分って感じかな。</p>

<pre class="screen">[root@oscar ~]# sealert -l 301adeba-8de8-4b94-aaa4-be18f4a4ecad
要約:

SELinux is preventing the spamd daemon from reading users' home directories.

詳細説明:

[SELinux は許容モードになっています。このアクセスは拒否されませんでした。]

SELinux has denied the spamd daemon access to users' home directories. Someone
is attempting to access your home directories via your spamd daemon. If you only
setup spamd to share non-home directories, this probably signals an intrusion
attempt.

アクセス許可:

If you want spamd to share home directories you need to turn on the
spamd_enable_home_dirs boolean: "setsebool -P spamd_enable_home_dirs=1"

Fix コマンド:

setsebool -P spamd_enable_home_dirs=1

追加情報:

ソースコンテキスト               system_u:system_r:spamd_t:s0
ターゲットコンテキスト           unconfined_u:object_r:admin_home_t:s0
ターゲットオブジェクト           /root/.razor/server.c302.cloudmark.com.conf [ file
                              ]
ソース                           spamd
ソースパス                       /usr/bin/perl
ポート                           &lt;不明&gt;
ホスト                           oscar.rewse.jp
ソース RPM パッケージ            perl-5.10.1-119.el6_1.1
ターゲット RPM パッケージ
ポリシー RPM                     selinux-policy-3.7.19-126.el6_2.4
Selinux 有効化                   True
ポリシータイプ                   targeted
強制モード                       Permissive
プラグイン名                     spamd_enable_home_dirs
ホスト名                         oscar.rewse.jp
プラットフォーム                 Linux oscar.rewse.jp 2.6.32-220.2.1.el6.x86_64 #1
                                 SMP Thu Dec 22 11:15:52 CST 2011 x86_64 x86_64
通知カウント                     1
最初の画面                       Tue Jan 01 05:20:28 2012
最後の画面                       Tue Jan 01 05:20:28 2012
ローカル ID                      301adeba-8de8-4b94-aaa4-be18f4a4ecad
行番号

生の監査メッセージ

node=oscar.rewse.jp type=AVC msg=audit(1327350028.189:3734): avc:  denied  { write } for  pid=13429 comm="spamd" name="server.c302.cloudmark.com.conf" dev=dm-0 ino=5571 scontext=system_u:system_r:spamd_t:s0 tcontext=unconfined_u:object_r:admin_home_t:s0 tclass=file

node=oscar.rewse.jp type=SYSCALL msg=audit(1327350028.189:3734): arch=c000003e syscall=2 success=yes exit=9 a0=4ae3c30 a1=241 a2=1b6 a3=3a6371dba0 items=0 ppid=13427 pid=13429 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=244 comm="spamd" exe="/usr/bin/perl" subj=system_u:system_r:spamd_t:s0 key=(null)</pre>

<p>/var/lib/setroubleshoot/email_alert_recipients にメールアドレスを記述しておくと、setroubleshootがアクセス拒否を見つけ次第、sealeartの結果をメールしてくれるので「SELinuxが原因で動作しない」という状況にすぐに気づくことができる。</p>

<pre class="brush: plain; title: /var/lib/setroubleshoot/email_alert_recipients; notranslate">example@gmail.com</pre>

<p>/etc/setroubleshoot/setroubleshoot.cfg の<code>from_address</code>に記述されたメールアドレスからメールが届くが、私の環境ではドメイン部分がホスト名で補完されると送信拒否されてしまうので、以下のように変更している。</p>

<pre class="brush: plain; first-line: 84; highlight: [85,86]; title: /etc/setroubleshoot/setroubleshoot.cfg; notranslate"># from_address: The From: email header
# from_address = SELinux_Troubleshoot
from_address = SELinux_Troubleshoot@rewse.jp</pre>

<h2>セキュリティ・コンテキストを初期化する</h2>

<p>リソースに正しいセキュリティ・コンテキストがついていないためにアクセス拒否されている場合、<code>restorecon</code>でデフォルトのセキュリティ・コンテキストに初期化できる。</p>

<pre class="screen">[root@oscar ~]# restorecon filename
[root@oscar ~]# restorecon -R /</pre>

<p>セキュリティ・コンテキストはリソースが生成されたタイミングで /etc/selinux/targeted/contexts/files/file_contexts に記述されたパスに従ってデフォルト値が設定される。つまり、<code>cp</code>では新たなコンテキストが設定されるが、<code>mv</code>ではコンテキストは更新されない。圧縮ファイルを/tmpに展開して、そこから<code>mv</code>したときは必ず<code>restorecon</code>で初期化しよう。</p>

<h2>条件付きポリシーを変更する</h2>

<p>デフォルトでは厳しいポリシーになっていてアクセス拒否されてしまうが、用途に合わせてポリシーを緩める必要がある場合に簡単に変更できるのが条件付きポリシーだ。どのような条件付きポリシーが用意されているかは<code>getsebool</code>で分かる。</p>

<pre class="screen">[root@oscar ~]# getsebool -a
abrt_anon_write --&gt; off
abrt_handle_event --&gt; off
allow_console_login --&gt; on
allow_cvs_read_shadow --&gt; off
allow_daemons_dump_core --&gt; on
......</pre>

<p>条件付きポリシーは<code>setsebool</code>で変更する。</p>

<pre class="screen">[root@oscar ~]# setsebool -P samba_enable_home_dirs 1</pre>

<p>条件付きポリシーは手軽ではあるが、onにすればするほどSELinuxの防御は弱くなるので、onにするべきかどうかは慎重に判断しよう。</p>

<h2>セキュリティ・コンテキストを一時的に変更する</h2>

<p>一部のリソースのセキュリティ・コンテキストを手動で変更する場合は<code>chcon</code>を使用する。</p>

<pre class="screen">[root@oscar ~]# chcon system_u:object_r:samba_share_t:s0 /var/pub</pre>

<h2>セキュリティ・コンテキストを永続的に変更する</h2>

<p><code>chcon</code>で変更したセキュリティ・コンテキストは<code>restorecon</code>してしまうと再びデフォルトに戻ってしまうので、<code>semanage</code>でfile_contextsに新たなルールを追加しておくのが良いだろう。追加するパスは正規表現で記述する。</p>

<pre class="screen">[root@oscar ~]# semanage fcontext -a -t samba_share_t "/var/pub(/.*)?"
[root@oscar ~]# restorecon -R /var/pub</pre>

<p>file_contextsは直接開いても良いが、<code>semanage</code>からは以下のように一覧できる。</p>

<pre class="screen">[root@oscar ~]# semanage fcontext -l
SELinux fcontext                                   タイプ                コンテキスト

/                                                  directory          system_u:object_r:root_t:s0
/.*                                                all files          system_u:object_r:default_t:s0
/[^/]+                                             regular file       system_u:object_r:etc_runtime_t:s0
......</pre>

<p>追加したルールを削除する場合は以下のように行う。</p>

<pre class="screen">[root@oscar ~]# semanage fcontext -d -t samba_share_t "/var/pub(/.*)?"
[root@oscar ~]# restorecon -R /var/pub</pre>

<h2>新しいポリシーを追加する</h2>

<p>「○○ドメインは△△タイプを□□できる」というポリシーを新たに追加する必要がある場合は、audit.logからテキスト形式のTEファイルを作成し、TEファイルからバイナリ形式のPPファイルというモジュール・パッケージを作成し、PPファイルをポリシー・ファイルに追加するという手順になる。</p>

<p>/var/log/audit/audit.log をそのまま使うと今までアクセス拒否されたすべてがごちゃ混ぜになってしまうので、抽出してから使用するのが良いだろう。

<pre class="screen">[root@oscar ~]# grep type=AVC /varlog/audit/audit.log | grep amavis &gt; /tmp/audit.log</pre>

<p>抽出されたaudit.logから<code>audit2allow</code>を使ってTEファイルを作成する。</p>

<pre class="screen">[root@oscar ~]# audit2allow -M amavislocal -i /tmp/audit.log
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i amavislocal.pp</pre>

<p>作成されたTEファイルを見てみよう。</p>

<pre class="brush: plain; title: /usr/share/selinux/devel/amavislocal.te; notranslate">module amavislocal 1.0;

require {
  type amavis_t;
  type initrc_t;
  type lib_t;
  type var_run_t;
  class unix_dgram_socket sendto;
  class file execute_no_trans;
  class sock_file write;
}

#============= amavis_t ==============
allow amavis_t initrc_t:unix_dgram_socket sendto;
allow amavis_t lib_t:file execute_no_trans;
allow amavis_t var_run_t:sock_file write;</pre>

<p>PPファイルは<code>audit2allow</code>が自動生成してくれるが、手動でTEファイルを編集した場合などは /usr/share/selinux/devel ディレクトリにTEファイルを移動して<code>make</code>する必要がある。</p>

<pre class="screen">[root@oscar ~]# cd /usr/share/selinux/devel
[root@oscar devel mv /tmp/amavislocal.te .
[root@oscar devel]# make
/usr/bin/checkmodule:  loading policy configuration from tmp/amavislocal.tmp
/usr/bin/checkmodule:  policy configuration loaded
/usr/bin/checkmodule:  writing binary representation (version 10) to tmp/amavislocal.mod
Creating targeted amavislocal.pp policy package
......</pre>

<p>作成したPPファイルをインストールする。</p>

<pre class="screen">[root@oscar devel]# semodule -i amavislocal.pp</pre>

<p>現在のモジュール一覧を以下のように取得できる。</p>

<pre class="screen">[root@oscar ~]# semodule -l</pre>

<p>インストールされたモジュールを削除する場合は以下のように行う。</p>

<pre class="screen">[root@oscar ~]# semodule -r amavislocal</pre>]]></content:encoded>
			<wfw:commentRss>http://rewse.jp/blog/p/4825/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle OpenWorld Tokyo 2012 &#124; JavaOne Tokyo 2012 お申込み受付開始</title>
		<link>http://rewse.jp/blog/p/4409</link>
		<comments>http://rewse.jp/blog/p/4409#comments</comments>
		<pubDate>Wed, 25 Jan 2012 12:23:31 +0000</pubDate>
		<dc:creator>Tats Shibata</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://rewse.jp/blog/?p=4409</guid>
		<description><![CDATA[<p><a href="http://www.oracle.co.jp/openworld/">Oracle OpenWorld Tokyo 2012</a> と <a href="http://www.oracle.co.jp/javaone/">JavaOne Tokyo 2012</a> のお申込み受付が始まりました。Oracle OpenWorld Tokyo 2012 は4月4日から6日まで、JavaOne Tokyo 2012 は4月4日から5日まで、それぞれ六本木ヒルズなどで開催されます。参加費は Oracle OpenWorld Tokyo 2012 が無料で、JavaOne Tokyo 2012 が5,250円です。</p>

<p>以下のバナーからお申込みいただき、招待コードに「<code>2715</code>」を入力していただくと、Oracle OpenWorld Tokyo 2012 では Leaders Club メンバーとして招待者限定セッションに参加できるようになります。JavaOne Tokyo 2012 では招待コードを入れるメリットは参加者の皆さまには特にないのですが……、私がほんの少し上司にほめられるかもしれません。</p> <a href="http://rewse.jp/blog/p/4409">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="imgholder eyecatch"><img src="http://rewse.jp/blog/rsrc/uploads/2012/01/owjo.png" alt="" title="Oracle OpenWorld | JavaOne" width="500" height="265" class="alignnone size-full wp-image-4806" /></div>

<p><a href="http://www.oracle.co.jp/openworld/">Oracle OpenWorld Tokyo 2012</a> と <a href="http://www.oracle.co.jp/javaone/">JavaOne Tokyo 2012</a> のお申込み受付が始まりました。Oracle OpenWorld Tokyo 2012 は4月4日から6日まで、JavaOne Tokyo 2012 は4月4日から5日まで、それぞれ六本木ヒルズなどで開催されます。参加費は Oracle OpenWorld Tokyo 2012 が無料で、JavaOne Tokyo 2012 が5,250円です。</p>

<p>以下のバナーからお申込みいただき、招待コードに「<code>2715</code>」を入力していただくと、Oracle OpenWorld Tokyo 2012 では Leaders Club メンバーとして招待者限定セッションに参加できるようになります。JavaOne Tokyo 2012 では招待コードを入れるメリットは参加者の皆さまには特にないのですが……、私がほんの少し上司にほめられるかもしれません。</p>

<div class="imgholder"><img src="http://rewse.jp/blog/rsrc/uploads/2012/01/oow_250x100.jpg" alt="" title="Oracle OpenWorld Tokyo 2012" width="250" height="100" class="alignnone size-full wp-image-4838" /></a><a href="https://oj-events.jp/public/application/add/46"><img src="http://rewse.jp/blog/rsrc/uploads/2012/01/jvo_250x100.jpg" alt="" title="JavaOne Tokyo 2012" width="250" height="100" class="alignnone size-full wp-image-4411" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://rewse.jp/blog/p/4409/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scientific Linux 6 をインストールして最初に行なう18の設定</title>
		<link>http://rewse.jp/blog/p/3405</link>
		<comments>http://rewse.jp/blog/p/3405#comments</comments>
		<pubDate>Mon, 23 Jan 2012 13:35:37 +0000</pubDate>
		<dc:creator>Tats Shibata</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[trouble]]></category>

		<guid isPermaLink="false">http://rewse.jp/blog/?p=3405</guid>
		<description><![CDATA[<p>ボクが <a href="http://www.scientificlinux.org/">Scientific Linux</a> 6 を使う始めるときに、必ず設定やインストールしている項目をここでまとめておく。これらの設定は <a href="http://jp.redhat.com/products/enterprise-linux/">Red Hat Enterprise Linux</a> (RHEL) / <a href="http://www.centos.org/">CentOS</a> / <a href="http://www.oracle.com/jp/technologies/linux/">Oracle Linux</a> でも同様に使用できるだろう。</p>

<h2>rootユーザーのメールアドレスの設定</h2>

<p>Scientific Linux から管理者であるroot宛に様々なメールが届くが、そのままではrootで当該マシンにログインしないと読めないので、いつも使っているメールアドレスに届くように変更する。ボクの場合、rewse.jpのメールアドレスをメインに使っているけど、そのメール・サーバーに障害が起きたときにそれを通知するメールが受け取れないので、<a href="mail.google.com/">Gmail</a>のアドレスを設定している。</p> <a href="http://rewse.jp/blog/p/3405">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="imgholder eyecatch"><img src="http://rewse.jp/blog/rsrc/uploads/2011/07/scientificlinux6.png" alt="" title="Scientific Linux" width="250" height="250" class="alignnone size-full wp-image-3462" /></div>

<p>ボクが <a href="http://www.scientificlinux.org/">Scientific Linux</a> 6 を使う始めるときに、必ず設定やインストールしている項目をここでまとめておく。これらの設定は <a href="http://jp.redhat.com/products/enterprise-linux/">Red Hat Enterprise Linux</a> (RHEL) / <a href="http://www.centos.org/">CentOS</a> / <a href="http://www.oracle.com/jp/technologies/linux/">Oracle Linux</a> でも同様に使用できるだろう。</p>
</p>

<h2>rootユーザーのメールアドレスの設定</h2>

<p>Scientific Linux から管理者であるroot宛に様々なメールが届くが、そのままではrootで当該マシンにログインしないと読めないので、いつも使っているメールアドレスに届くように変更する。ボクの場合、rewse.jpのメールアドレスをメインに使っているけど、そのメール・サーバーに障害が起きたときにそれを通知するメールが受け取れないので、<a href="http://mail.google.com/">Gmail</a>のアドレスを設定している。</p>

<pre class="brush: plain; first-line: 95; highlight: [97]; title: /etc/aliases; notranslate"># Person who should get root's mail
#root:          marc
root:           example@gmail.com</pre>
<span id="more-3405"></span>
<p>/etc/aliasesを編集しただけでは設定は有効にならないので、忘れずに<code>newaliases</code>を実行する。</p>

<pre class="screen">[root@charlie ~]# newaliases</pre>

<p>ボクの自宅サーバーで使っている固定IPアドレスは逆引き設定できず、逆引きすると契約ISPのドメインが戻ってしまうため、Gmailに直接メール送信すると The IP you&#8217;re using to send mail is not authorized to 550-5.7.1 send email directly to our servers. で受信拒否されてしまう。対策方法は <a href="http://mail.google.com/support/bin/answer.py?answer=10336">Gmail: The IP you&#8217;re using to send email is not authorized&#8230;</a> に載っているとおりなので、契約ISPのSMTPサーバーに中継するように設定変更する。</p>

<p>Postfixに中継サーバーを設定する。SMTPサーバー名を指定する場合には必ず [ ] をつけることを忘れずに。</p>

<pre class="brush: plain; first-line: 304; highlight: [309]; title: /etc/postfix/main.cf; notranslate">#relayhost = $mydomain
#relayhost = [gateway.my.domain]
#relayhost = [mailserver.isp.tld]
#relayhost = uucphost
#relayhost = [an.ip.add.ress]
relayhost = [mail.asahi-net.or.jp]</pre>

<p>また、Postfixのデフォルト設定では送信元メールアドレスのドメイン部分はホスト名になっているが、このままだと Sender address rejected: Domain not found エラーで受信拒否される場合があるので、ドメイン部分を変更する。</p>

<pre class="brush: plain; first-line: 92; highlight: [94]; title: /etc/postfix/main.cf; notranslate">#myorigin = $myhostname
#myorigin = $mydomain
myorigin = $mydomain</pre>

<p>設定ファイルを再読み込みする。</p>

<pre class="screen">[root@charlie ~]# service postfix reload
Reloading postfix:                                         [  OK  ]</pre>

<p>このように受信側メール・サーバーのいろいろなポリシーで拒否される場合があるので、必ずテスト・メールを送ってみよう。<code>mail</code>では本文を書き終えたら<code>.</code>（ピリオド）だけの行を入力すると本文終了の意味になる。</p>

<pre class="screen">[root@charlie ~]# mail -s "Test Mail" root
This is a test mail.
.
EOT</pre>

<h2>NTPの設定</h2>

<p>時刻がずれていると今後のいろいろ編集するファイルの更新時刻もずれてしまってよく分からなくなるので、時刻は早めに正しくてしまおう。なお、Xenなどの仮想マシンは物理マシンの時刻に完全に同期しているので、仮想マシンでNTPを設定する必要はない。</p>

<p>ボクの環境ではNTPが入っていなかったので、まずはインストール。</p>

<pre class="screen">[root@charlie ~]# yum install ntp
......
================================================================================
 Package        Arch          Version                           Repository
                                                                           Size
================================================================================
Installing:
 ntp            x86_64        4.2.4p8-2.el6                     sl        444 k
Installing for dependencies:
 libedit        x86_64        2.11-4.20080712cvs.1.el6          sl         73 k
 ntpdate        x86_64        4.2.4p8-2.el6                     sl         57 k
......</pre>

<p>海外NTPサーバーだとレイテンシーが大きいので、国内NTPサーバーを追加する。ボクは <a href="http://www2.nict.go.jp/w/w114/tsp/PubNtp/">情報通信研究機構</a> (NICT) / <a href="http://www.jst.mfeed.ad.jp/">INTERNET MULTIFEED</a> の定番に加えて、契約ISPの<a href="http://asahi-net.jp/">ASAHIネット</a>を追加した。なお、強制的にIPv4で通信するように<code>-4</code>をすべて追加している。</p>

<pre class="brush: plain; first-line: 20; highlight: [25,26,27]; title: /etc/ntp.conf; notranslate"># Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server -4 0.rhel.pool.ntp.org
server -4 1.rhel.pool.ntp.org
server -4 2.rhel.pool.ntp.org
server -4 ntp.nict.jp
server -4 ntp.jst.mfeed.ad.jp
server -4 ntp.asahi-net.or.jp</pre>

<p>NTPサーバーとの時刻が違いすぎると自動調整が利かないので、一度、手動で合わせてしまう。</p>

<pre class="screen">[root@charlie ~]# ntpdate ntp.nict.jp
28 May 22:45:46 ntpdate[5030]: step time server 133.243.238.244 offset -18.324051 sec</pre>

<p>NTPサービスを起動時から有効になるように設定変更し、サービスを開始する。</p>

<pre class="screen">[root@charlie ~]# chkconfig ntpd on
[root@charlie ~]# service ntpd start
ntpd を起動中:                                             [  OK  ]</pre>

<p>しばらくすると以下のコマンドでNTPの同期状況が分かるようになる。上3つは <a href="http://www.pool.ntp.org/">NTP Pool Project</a> のものなので自動的に選ばれたものだ。先頭に<code>*</code>（アスタリスク）がついているサーバーが現在同期中のサーバーで、ntp.nict.jpを使用しているようだ。ntp.nict.jpはストラタムが1なので（一次サーバーなので）選ばれやすい。</p>

<pre class="screen">[root@charlie ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+ntp.kiba.net    195.71.81.206    2 u   12   64  377   11.793  -34.807   2.153
 www.4koma.com   133.243.238.163  2 u   12   64  377   41.168  -15.576   4.411
-foneus.gimasyst 10.0.5.10        2 u   12   64  377    4.741  -40.622   5.522
*ntp-b2.nict.go. .NICT.           1 u   12   64  377    4.223  -35.788   2.374
+ntp3.jst.mfeed. 210.173.160.86   2 u    8   64  377    2.192  -34.882   2.264
+orion.asahi-net 133.243.238.244  2 u   11   64  377    1.900  -36.306   2.281
 LOCAL(0)        .LOCL.          10 l    2   64  377    0.000    0.000   0.002</pre>

<h2>SSHの設定</h2>

<p>SSHサーバーはデフォルトではパスワード認証だが、クライアント側のSSH鍵を登録しておくと、登録されたSSH鍵を持っているクライアントからはパスワードを入力なしでログインできるので楽できる。</p>

<p>クライアント側の公開鍵を確認しよう。SSH鍵を持っていない場合は、LinuxやMacであれば<code>ssh-keygen</code>で作成できる。以下はMacでの操作だ。<p>

<pre class="screen">[tats@evian ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): <kbd>[Enter]</kbd>
Enter same passphrase again: <kbd>[Enter]</kbd>
Your identification has been saved in .ssh/id_rsa.
Your public key has been saved in .ssh/id_rsa.pub.
The key fingerprint is:
91:2e:58:0f:ba:26:bf:2f:e8:0c:63:03:8c:2b:93:6d tats@evian.rewse.jp
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|         .       |
|      o o        |
|o    + + .       |
|o.  o . S        |
|.+   . .         |
|BoE.o            |
|o*o+.            |
| .o o+.          |
+-----------------+
[tats@evian ~]$ cat .ssh/id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3szz6E5F8ykxkZBtZTszlYWnz4BIBEFNh59zQMuUa1w9VGg8yJIUOswcfsKxi8YrLATOW/6O1REUPZTAopLvR0TB92m4tlVCE7tFxWfJFCSgf42a6MAdx3eOtn+v5kZG3jx8kPp+Mba9wc/+gBa5CNLLNw841QRLZZ5tbSwsWIgeQfyHIaawHy171csPv28KuhTNRE5wHmK5KYJ+EW+Cx+ljDVLDBYE9v/w2Ty+5sv1mN3n6GHRYfasnuLWwRzWCKiQj8rcod91ILYZXILfZ5GN7en8sNPRoHawOuJFcnMGiVyhk685RXHI+eP5AjJ5FlsbW7h9qde+opN5c/bobD tats@evian.rewse.jp</pre>

<p>上記の公開鍵を Scientific Linux 側の ~/.ssh/authorized_keys にコピペする。なお、ディレクトリやファイルの権限が緩すぎると鍵認証でログインできないので注意しよう。</p>

<pre class="screen">[root@charlie ~]# mkdir .ssh
[root@charlie ~]# chmod 700 .ssh
[root@charlie ~]# vi authorized_keys
[root@charlie ~]# chmod 600 .ssh/authorized_keys</pre>

<p>SSHをインターネットに公開しているサーバーでは、パスワード認証をせずに鍵認証だけにしてしまったほうが安全だろう。</p>

<pre class="brush: plain; first-line: 63; highlight: [66,67]; title: /etc/ssh/sshd_config; notranslate"># To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
#PasswordAuthentication yes
PasswordAuthentication no</pre>

<p>ポート番号をデフォルトの22から変えてしまうとボクの経験では不正アタックは全くなくなるので、可能であれば変更してしまおう。</p>

<pre class="brush: plain; first-line: 13; highlight: [13,14]; title: /etc/ssh/sshd_config; notranslate">#Port 22
Port 12222</pre>

<p>変更したらSSHを再起動しよう。</p>

<pre class="screen">[root@charlie ~]# service sshd restart
sshd を停止中:                                             [  OK  ]
sshd を起動中:                                             [  OK  ]</pre>

<h2>Yumの設定</h2>

<p>デフォルトでは海外にある公式サイトの更新サーバーを見に行ってしまって遅いので、国内ミラーに設定変更する。変更方法は <a href="http://rewse.jp/blog/p/3411">複眼中心: 国内 Scientific Linux 6 サーバーのためのyum設定</a> を参照してほしい。

<h2>Cronの設定</h2>

<p>何台かのマシンがあるとき、すべてが同じ時刻にCronを動かすとその瞬間だけ高負荷になってしまうので、個々のマシンで実行時刻をずらす。このマシンでは以下のように変更した。</p>

<pre class="brush: plain; title: /etc/cron.d/0hourly; notranslate">SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
#01 * * * * root run-parts /etc/cron.hourly
11 * * * * root run-parts /etc/cron.hourly</pre>

<p>Scientific Linux 5 と違って、cron.daily / cron.weekly / cron.monthly はAnacron経由で実行される。Aancronは<code>START_HOURS_RANGE</code>の時間帯のみ実行され、period in days の日数ごとにAnacronデーモンが起動してから delay in minutes + <code>RANDOM_DELAY</code>の間にcommandが実行される。つまり以下の設定がされた常に起動しているサーバーの場合、/etc/cron.dailyは1日ごと（毎日）の3時05分から3時50分の間に実行され、/etc/cron.weeklyは7日ごと（毎週）の3時25分から4時10分の間に実行される。</p>

<pre class="brush: plain; first-line: 8; title: /etc/anacrontab; notranslate"># the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days   delay in minutes   job-identifier   command 
1       5       cron.daily              nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly</pre>

<p>デフォルトの値はワークステーションが前提なのか深夜以外の時間帯にCronを実行するようになっているので、これを深夜のみに変更する。Anacron自体は/etc/cron.hourly/0anacronから実行されるので、デーモンの再起動などは必要ない。</p>

<pre class="brush: plain; first-line: 10; highlight: [11,12]; title: /etc/anacrontab; notranslate"># the jobs will be started during the following hours only
#START_HOURS_RANGE=3-22
START_HOURS_RANGE=3-6</pre>

<h2>パフォーマンス関連パッケージのインストール</h2>

<p>OSの統計情報を獲るためのdstatとsysstatをインストールする。</p>

<pre class="screen">[root@zulu ~]# yum install dstat sysstat
......
================================================================================
 Package           Arch             Version                  Repository    Size
================================================================================
Installing:
 dstat             noarch           0.7.0-1.el6              sl           136 k
 sysstat           x86_64           9.0.4-11.el6             sl           214 k
......</pre>

<h2>不要なサービスの停止</h2>

<p>この環境では必要ないサービスを自動起動しないように変更し、サービスを停止する。</p>

<pre class="screen">[root@zulu ~]# chkconfig sysstat off
[root@zulu ~]# service sysstat stop</pre>

<h2>必要なサービスの開始</h2>

<p>この環境に必要なサービスを自動起動するように変更し、サービスを開始する。</p>

<pre class="screen">[root@zulu ~]# chkconfig ipmi start
[root@charlie proc]# service ipmi start
Starting ipmi drivers:                                     [  OK  ]</pre>

<h2>ディスクのチューニング</h2>

<p>ext4ではデフォルト予約ファイルシステム・ブロックとして全容量の5%が割り当てられている。<code>df</code>したときに「使用」+「残り」の値が「サイズ」と違うのはこの予約ファイルシステム・ブロックがあるためで、この予約ファイルシステム・ブロックにはrootのみが書き込むことができる。そのため、例えば一般ユーザーが/tmpをあふれさせてしまっても、rootは予約ファイルシステム・ブロックを使って/tmpにまだ書き込むことができ、管理作業を行うことができる。ただ、最近の大容量ディスクではデフォルトの5%は大きすぎると思うので、これを容量に従って少し小さくする。仮想マシンのディスク・イメージを配置するパーティションなんかは大容量だけど不意の書込みはほとんどないので、予約ファイルシステム・ブロックは少なくできる代表例だろう。</p>

<table>
  <tr>
    <th>パーティション容量</th>
    <th>予約ファイルシステム・ブロック</th>
  </tr>
  <tr>
    <td>1GB未満</td>
    <td>5%</td>
  </tr>
  <tr>
    <td>1GB以上</td>
    <td>4%</td>
  </tr>
  <tr>
    <td>10GB以上</td>
    <td>3%</td>
  </tr>
  <tr>
    <td>100GB以上</td>
    <td>2%</td>
  </tr>
  <tr>
    <td>1TB以上</td>
    <td>1%</td>
  </tr>
</table>

<p>また、ファイルシステムをチェックする最大マウント回数 (<code>-c</code>) とファイルシステムをチェックする最大時間間隔 (<code>-i</code>) も気をつけよう。デフォルトでは30回程度（ランダム）のマウントまたは180日目のマウントで自動的にfsckが実行される。OS起動時に予期せず巨大なパーティションに対してfsckが実行されてしまい、いつまで経ってもOSが起動しないというようなことが起きないように、ボクは <code>-c 0 -i 0</code> にすべてのパーティションをしているし、GUIインストーラーであるAnacondaで自動フォーマットした場合は自動的に <code>-c 0 -i 0</code> になっている。</p>

<pre class="screen">[root@charlie ~]# tune2fs -m 1 -c 0 -i 0 /dev/sdd1
tune2fs 1.39 (29-May-2006)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
Setting reserved blocks percentage to 1% (2441406 blocks)</pre>

<h2>smartdの設定</h2>

<p>ディスクのS.M.A.R.Tを監視し、異常が発見された場合は告知してくれるsmartdはデフォルトの設定ではSATAディスクに対応していないので、それを修正する。

<pre class="brush: plain; first-line: 17; highlight: [23,24]; title: /etc/smartd.conf; notranslate"># The word DEVICESCAN will cause any remaining lines in this
# configuration file to be ignored: it tells smartd to scan for all
# ATA and SCSI devices.  DEVICESCAN may be followed by any of the
# Directives listed below, which will be applied to all devices that
# are found.  Most users should comment out DEVICESCAN and explicitly
# list the devices that they wish to monitor.
#DEVICESCAN -H -m root
DEVICESCAN -H -m root -d sat</pre>

<h2>99-raid-checkの設定</h2>

<p>/etc/cron.weekly/99-raid-checkはRAIDの各ディスク間でデータ不一致がないかどうかを見つけてくれるのだけど、そのためにディスクを全走査するので2TBが3本のRAID5で5時間以上掛かってしまう一方、スワップ領域を含むディスクはデータ不一致を誤検知することがあって信用ならないので、スワップで使用しているLVMの論理ボリュームを含む2TBの領域はこのチェックを行なわないようにした。この問題の詳細は <a href="http://wp.serpere.info/archives/1099">へびにっき: WARNING: mismatch_cnt is not 0 on /dev/md0</a> が詳しい。</p>

<pre class="brush: plain; first-line: 49; title: /etc/sysconfig/raid-check; notranslate">......
# To check devs /dev/md0 and /dev/md3, use &amp;amp;quot;md0 md3&amp;amp;quot;
CHECK_DEVS=&amp;amp;quot;&amp;amp;quot;
REPAIR_DEVS=&amp;amp;quot;&amp;amp;quot;
#SKIP_DEVS=&amp;amp;quot;&amp;amp;quot;
SKIP_DEVS=&amp;amp;quot;md1&amp;amp;quot;</pre>

<h2>iptablesの設定</h2>

<p>iptablesを使ってファイアウォールを構築する。構築方法は <a href="http://rewse.jp/blog/p/3109">複眼中心: iptablesによるファイアウォール設定</a> を参照してほしい。</p>

<h2>Avira AntiVir Personal (UNIX) のインストール</h2>

<p>ウイルス対策に Avira AntiVir Personal (UNIX) をインストールする。インストール方法は <a href="http://rewse.jp/blog/p/3050">複眼中心: Avira AntiVir Personal (UNIX) 3.1.3.5-0 インストール</a> を参照してほしい。</p>

<h2>chkrootkitのインストール</h2>

<p>ルートキット対策にchkrootkitをインストールする。インストール方法は <a href="http://rewse.jp/blog/p/3724">複眼中心: Scientific Linux 6.1 に chkrootkit 0.49 をインストール</a> を参照してほしい。</p>

<h2>バックアップの設定</h2>

<p>rsyncを使用してNFS経由で別マシンに日次バックアップを行うスクリプトを設置する。このスクリプトは <a href="http://www.apple.com/jp/macosx/">Mac OS X</a> の Time Machine にインスパイアされたもので、ハードリンクを使用した重複排除や、週次の間引きなども行うようになっている。スクリプトの詳細は <a href="https://github.com/rewse/backup.cron">GitHub: rewse: backup.cron</a> を参照してほしい。</p>

<h2>Zabbixエージェントのインストール</h2>

<p>統合監視にZabbixを使用しているので、そのエージェントをインストールする。</p>

<h2>LDAPとOSユーザーを連携</h2>

<p>ボクの環境にはLDAPサーバーがあり、OSユーザーはローカル管理せずにこのLDAPサーバーを使うようにしているので、この連携を行う。連携方法については <a href="http://rewse.jp/blog/p/3758">複眼中心: Scientific Linux 6.1 にLDAP経由でログイン</a> を参照してほしい。</p>

<h2>各種の設定</h2>

<p>/etc/profile.d, /etc/inputrc, /etc/screenrc, /etc/vimrc にいつもの設定を追加する。vimrcについては <a href="http://rewse.jp/blog/p/3086">複眼中心: 2011年5月のvimrc</a> を参照してほしい。</p>]]></content:encoded>
			<wfw:commentRss>http://rewse.jp/blog/p/3405/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>小樽ミコマ ミコマ弁当</title>
		<link>http://rewse.jp/blog/p/4326</link>
		<comments>http://rewse.jp/blog/p/4326#comments</comments>
		<pubDate>Tue, 17 Jan 2012 12:29:08 +0000</pubDate>
		<dc:creator>Tats Shibata</dc:creator>
				<category><![CDATA[food]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[product]]></category>

		<guid isPermaLink="false">http://rewse.jp/blog/?p=4326</guid>
		<description><![CDATA[<p>小田急百貨店新宿店で「<a href="http://www.odakyu-dept.co.jp/shinjuku/hokkaido/">冬の北海道物産展</a>」をやっていたので、小樽ミコマのミコマ弁当を購入。このボリュームだけど酢飯はすり切りしか入っておらず、山はカニのほぐし身で支えられている。</p>

<p>冬の北海道物産展は2012年1月17日から2012年1月31日まで。</p> <a href="http://rewse.jp/blog/p/4326">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="imgholder eyecatch"><a href="http://www.flickr.com/photos/rewse/6713953273"><img src="http://rewse.jp/blog/rsrc/uploads/2012/01/otarumikomabento.jpg" alt="" title="小樽ミコマ ミコマ弁当" width="500" height="333" class="alignnone size-full wp-image-4327" /></a><span class="exif">Apple iPhone 4, 1/17, f/2.8, ISO500, 3.9mm (35mm), but might be post-producted</span></div>

<p>小田急百貨店新宿店で「冬の北海道物産展」をやっていたので、小樽ミコマのミコマ弁当を購入。このボリュームだけど酢飯はすり切りしか入っておらず、山はカニのほぐし身で支えられている。</p>

<p>冬の北海道物産展は2012年1月17日から2012年1月31日まで。</p>
<span id="more-4326"></span>

<table class="product">
<tr>
<th>店舗名</th>
<td>小樽ミコマ</td>
</tr>
<tr>
<th>商品</th>
<td>ミコマ弁当</td>
</tr>
<tr>
<th>購入場所</th>
<td><a href="http://www.odakyu-dept.co.jp/shinjuku/">小田急百貨店新宿店</a></td>
</tr>
<tr>
<th>購入日</th>
<td>2012-01-17</td>
</tr>
<tr>
<th>価格</th>
<td>1,680円</td>
</tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://rewse.jp/blog/p/4326/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KALITA セラミックミル C-90 レビュー</title>
		<link>http://rewse.jp/blog/p/4294</link>
		<comments>http://rewse.jp/blog/p/4294#comments</comments>
		<pubDate>Mon, 09 Jan 2012 10:45:07 +0000</pubDate>
		<dc:creator>Tats Shibata</dc:creator>
				<category><![CDATA[food]]></category>
		<category><![CDATA[product]]></category>

		<guid isPermaLink="false">http://rewse.jp/blog/?p=4294</guid>
		<description><![CDATA[<p>お店でひいたコーヒーはどうも足が速くて苦手なもので、買おう買おうと思っていたコーヒー・ミルをついに購入した。<a href="http://www.kalita.co.jp/index.php?main_page=product_info&#038;cPath=1_31_41&#038;products_id=119">KALITA セラミックミル C-90</a> である。</p>

<p>粉の大きさが均一にならない回転羽式（プロペラ式）は味の評判が悪いので臼歯式に絞って検討し、KALITA セラミックミル C-90 か <a href="http://www.melitta.co.jp/personal/coffeemill/auto.html">Melitta パーフェクトタッチ II CG-5B</a> の2つで悩んでいたんだけど、会社の共有品としてCG-5Bを使っていて自宅でC-90を使っている<a href="https://twitter.com/#!/yukatan">岡田有花</a>さん（ゆかたん）がC-90をボクの家に持ってきてくれて実演レビューしてくれときの味がとても良かったので、ボクもC-90を選ぶことにした。カット式の <a href="http://www.kalita.co.jp/index.php?main_page=product_info&#038;cPath=1_31_41&#038;products_id=47">KALITA ナイスカットミル</a> が良いのは分かるんだけど、置き場所がないので……。ゆかたんもナイスカットミルが欲しいと言ってたけど。</p> <a href="http://rewse.jp/blog/p/4294">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="eyecatch imgholder"><img src="http://rewse.jp/blog/rsrc/uploads/2012/01/c-90.png" alt="" title="KALITA セラミックミル C-90" width="197" height="332" class="alignnone size-full wp-image-4296" /></div>

<p>お店でひいたコーヒーはどうも足が速くて苦手なもので、買おう買おうと思っていたコーヒー・ミルをついに購入した。<a href="http://www.kalita.co.jp/index.php?main_page=product_info&#038;cPath=1_31_41&#038;products_id=119">KALITA セラミックミル C-90</a> である。</p>

<p>粉の大きさが均一にならない回転羽式（プロペラ式）は味の評判が悪いので臼歯式に絞って検討し、KALITA セラミックミル C-90 か <a href="http://www.melitta.co.jp/personal/coffeemill/auto.html">Melitta パーフェクトタッチ II CG-5B</a> の2つで悩んでいたんだけど、会社の共有品としてCG-5Bを使っていて自宅でC-90を使っている<a href="https://twitter.com/#!/yukatan">岡田有花</a>さん（ゆかたん）がC-90をボクの家に持ってきてくれて実演レビューしてくれときの味がとても良かったので、ボクもC-90を選ぶことにした。カット式の <a href="http://www.kalita.co.jp/index.php?main_page=product_info&#038;cPath=1_31_41&#038;products_id=47">KALITA ナイスカットミル</a> が良いのは分かるんだけど、置き場所がないので……。ゆかたんもナイスカットミルが欲しいと言ってたけど。</p>

<p>セラミックミル C-90 でひくと雑味が出ずに味と香りが深まり、へたな喫茶店で飲むよりおいしいコーヒーが自宅で入れられるようになる。構造は単純なので100杯程度では壊れそうもないので、1杯あたりで考えたらお得な買い物だろう。ただ、油分の少ない豆だとC-90からコーヒー・ドリッパーに移すときに静電気で本体と周りに粉が飛び散りまくるのがちょっと気になるかなー。ハケが一応付属しているけど、水洗いしない限りはきれいにならないし。最後の1粒が飛び跳ねてなかなかひかれないこともあるけど、本体が小さくてそれほど重くないので軽く振れば問題ない。</p>
<span id="more-4294"></span>
<div class="amazon-as"><iframe src="http://rcm-jp.amazon.co.jp/e/cm?lt1=_blank&#038;bc1=FFFFFF&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=333333&#038;lc1=004C99&#038;t=rewse-22&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=B0002IS0IE" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></div>

<p>合わせてコーヒー・ドリッパーもゆかたんが自宅で使っている <a href="http://www.hario.co.jp/shop/products_spec.php?product=CFOD-02B">HARIO カフェオールドリッパー02 CFOD-02</a> に変更。ペーパーを使わずに、さわってもさらさらしているくらい目の細かいステンレス・メッシュでできているドリッパーで、コーヒー・オイルが抽出されるので味に深みが出る。ペーパーを使わないことでのメンテナンス性は一長一短で、掃除機の紙パック方式とサイクロン方式の違いに近いかも。ペーパー型だと入れた後にそのままポイ捨てすればすむけど、CFOD-02だと水を入れてすぐに生ゴミ受けにひっくり返す作業を何回かする必要がある。ただし、ペーパーを買いに行く手間やコーヒーを飲もうとしたら自宅にペーパーの在庫がない！なんてアクシデントが起こらない。</p>

<p>電気ケトルには <a href="http://www.t-fal.co.jp/All+Products/Consumer+electronics/kettles/Products/New+Vitesse+Plus/New_Vitesse_Plus.htm">T-fal ニューヴィテスプラス</a> を持っていたんだけど、この勢いで <a href="http://www.oanda.co.jp/russell-hobbs/7110jp.html">Russell Hobbs Cafe Kettle 7110JP</a> を購入。ステンレス製なので本体がかなり熱くなるけど、これは普通のヤカンも同じだと思えば気にならない。それよりもドリップしやすい注ぎ口と安定した取っ手の形状、そして何よりもデザインの美しさがいいね。</p>

<p>Cafe Kettle 7110JP に水をセットしてから、食品庫から豆を出して セラミックミル C-90 でひいて、カフェオールドリッパー02 CFOD-02 に移し替えて、粉だらけのC-90をハケでざっと清掃したくらいの時間で、7110JPが沸騰してから数分経っているので90度以下になっててちょうど良い感じ。こんなにおいしいならさっさと買っておけば良かったよ。</p>

<table class="product">
<tr>
<th>メーカー</th>
<td><a href="http://www.kalita.co.jp/">カリタ</a></td>
</tr>
<tr>
<th>製品</th>
<td><a href="http://www.kalita.co.jp/index.php?main_page=product_info&#038;cPath=1_31_41&#038;products_id=119">セラミックミル C-90</a></td>
</tr>
<tr>
<th>購入場所</th>
<td><a href="http://www.amazon.co.jp/gp/product/B0002IS0IE/ref=as_li_ss_tl?ie=UTF8&#038;tag=rewse-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=B0002IS0IE">Amazon.co.jp</a></td>
</tr>
<tr>
<th>購入日</th>
<td>2011-11-20</td>
</tr>
<tr>
<th>価格</th>
<td>7,454円</td>
</tr>
</table>

<table class="product">
<tr>
<th>メーカー</th>
<td><a href="http://www.hario.com/">ハリオグラス</a></td>
</tr>
<tr>
<th>製品</th>
<td><a href="http://www.hario.co.jp/shop/products_spec.php?product=CFOD-02B">カフェオールドリッパー02 CFOD-02</a></td>
</tr>
<tr>
<th>購入場所</th>
<td><a href="http://www.amazon.co.jp/gp/product/B0040VIN18/ref=as_li_ss_tl?ie=UTF8&#038;tag=rewse-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=B0040VIN18">Amazon.co.jp</a></td>
</tr>
<tr>
<th>購入日</th>
<td>2011-11-20</td>
</tr>
<tr>
<th>価格</th>
<td>1,344円</td>
</tr>
</table>

<table class="product">
<tr>
<th>メーカー</th>
<td><a href="http://www.spectrumbrands.com/">Spectrum Brands</a></td>
</tr>
<tr>
<th>製品</th>
<td><a href="http://www.oanda.co.jp/russell-hobbs/7110jp.html">Russell Hobbs Cafe Kettle 7110JP</a></td>
</tr>
<tr>
<th>購入場所</th>
<td><a href="http://www.a-price.co.jp/">A-PRICE</a></td>
</tr>
<tr>
<th>購入日</th>
<td>2011-11-20</td>
</tr>
<tr>
<th>価格</th>
<td>7,410円</td>
</tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://rewse.jp/blog/p/4294/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>平成二十四年 謹賀新年</title>
		<link>http://rewse.jp/blog/p/4287</link>
		<comments>http://rewse.jp/blog/p/4287#comments</comments>
		<pubDate>Thu, 05 Jan 2012 05:02:45 +0000</pubDate>
		<dc:creator>Tats Shibata</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[visual]]></category>

		<guid isPermaLink="false">http://rewse.jp/blog/?p=4287</guid>
		<description><![CDATA[<p>本年も複眼中心をよろしくお願い申し上げます。</p>

<p>紙の年賀状より早く公開するのもあれかなと思っていたら、こんなタイミングでの公開となりました。今年こそは元旦に年賀状が届くように準備するぞ!</p> <a href="http://rewse.jp/blog/p/4287">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="imgholder eyecatch"><img src="http://rewse.jp/blog/rsrc/uploads/2012/01/newyear2012.png" alt="" title="平成二十四年 謹賀新年" width="500" height="334" class="alignnone size-full wp-image-4288" /></div>

<p>本年も複眼中心をよろしくお願い申し上げます。</p>

<p>紙の年賀状が届くのより早く公開するのもあれかなと思っていたら、こんなタイミングでの公開となりました。今年こそは元旦に年賀状が届くように準備するぞ！</p>]]></content:encoded>
			<wfw:commentRss>http://rewse.jp/blog/p/4287/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>明治神宮外苑 いちょう並木</title>
		<link>http://rewse.jp/blog/p/4263</link>
		<comments>http://rewse.jp/blog/p/4263#comments</comments>
		<pubDate>Sat, 10 Dec 2011 13:02:25 +0000</pubDate>
		<dc:creator>Tats Shibata</dc:creator>
				<category><![CDATA[photo]]></category>
		<category><![CDATA[venue]]></category>

		<guid isPermaLink="false">http://rewse.jp/blog/?p=4263</guid>
		<description><![CDATA[<p>会社から歩いてすぐのところに<a href="http://www.meijijingugaien.jp/">明治神宮外苑</a>のいちょう並木があるので、いちょう祭りの屋台でランチを取った。2011年のいちょう祭りは12月11日まで。</p> <a href="http://rewse.jp/blog/p/4263">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="imgholder eyecatch"><a href="http://www.flickr.com/photos/rewse/6475079395"><img src="http://rewse.jp/blog/rsrc/uploads/2011/12/lineofgingkos.jpg" alt="" title="明治神宮外苑 いちょう並木" width="500" height="500" class="alignnone size-full wp-image-4264" /></a><span class="exif">Apple iPhone 4, Instagram</span></div>

<p>会社から歩いてすぐのところに<a href="http://www.meijijingugaien.jp/">明治神宮外苑</a>のいちょう並木があるので、いちょう祭りの屋台でランチを取った。2011年のいちょう祭りは12月11日まで。</p>]]></content:encoded>
			<wfw:commentRss>http://rewse.jp/blog/p/4263/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 1.081 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-23 11:45:47 -->
<!-- Compression = gzip -->
