MIRACLE
メールサービス申込 ユーザー登録 パートナー情報
お問い合わせ FAQ サイトマップ
MIRACLE LINUXの特長 製品紹介 サービス案内 購入 サポート 技術フォーラム

プロフィール

日本発のリナックス企業、ミラクル・リナックスで奮闘する社員のブログです。

ミラクル関連リンク

採用情報

サイト検索

最近のトラックバック

2008年9月

  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        

« 不定期Wine談義(7) : Wine 1.0のRC | メイン | crashコマンド ライブシステムでデバッグ »

funky Func SI.1 - introduction/install -

先日、東京の友人に「めぱちこ」と言ったら大笑いされた tmorimoto です。一般的には「ものもらい」かな?とも思ったのですが、まさか全く通じないとは思いませんでした(- -#
wikipedia さんを調べると、正式には麦粒腫(ばくりゅうしゅ)と呼ぶそうですね。「ものもらい」もただの俗称じゃないか、、、と、少し悔しい気分です。

リファレンス:
Func - official site -
Func - source files -
オープンソースなシステム管理フレームワーク Func  

先日の YAPC::Asia 2008 Thu. 5/15 (1) で聴講した Func(Fedora Unified Network Controller) を実際に触ってみました。Func の概要については gihyo.jp の 第1回 シンプルで拡張性の高いシステム管理フレームワークFuncの概要 がとても分かり易いので、そちらをご参照ください。本稿では、主に AXS3 におけるインストール方法と動作確認について解説します。

先ず、インストール簡略化のため AXS3 用の RPM パッケージを作成してみました。但し、AXS3 は python-2.4 環境のため(Fedora7/8/9 は python-2.5)、もしかしたら、python のバージョン差異による不具合があるかもしれません。
※ 本パッケージはサポート対象外ですのでご了承ください

先ず、パッケージをインストールします。

# rpm -ivh func-0.18-1.1AXS3.noarch.rpm certmaster-0.19-1.1AXS3.noarch.rpm python-setuptools-0.6c7-2.1AXS3.noarch.rpm
準備中...                ########################################### [100%]
   1:certmaster             ########################################### [ 33%]
   2:func                   ########################################### [ 67%]
   3:python-setuptools      ########################################### [100%]

certmaster(クライアントを管理するサーバ)を起動させます。詳細は調べていないのですが、Fedora パッケージをリビルドしただけのせいか service コマンドによる起動スクリプトの実行時に OK/FAILED  のメッセージが出力されません。service status を用いて、実際に起動しているかどうかを確認してください。

[certmaster]# chkconfig certmaster on
[certmaster]# chkconfig --list certmaster
certmaster      0:off   1:off   2:on    3:on    4:on    5:on    6:off
[certmaster]# service certmaster start
Starting certmaster daemon:
[certmaster]# service certmaster status
certmaster is running

certmaster/minion(管理されるクライアント)共に、どのホストが certmaster なのかの設定を行います。gihyo.jp では "/etc/func/minion.conf" とありますが、公式サイトでは "/etc/certmaster/minion.conf" と記載されています。最近、変更されたのかもしれませんね。

[root@certmaster]# vi /etc/certmaster/minion.conf
[root@client1]# vi /etc/certmaster/minion.conf
[root@client2]# vi /etc/certmaster/minion.conf
# configuration for minions
[main]
certmaster = certmaster.example.org
log_level = DEBUG
cert_dir = /etc/pki/certmaster

minion から証明書に署名するためのリクエストを発行します。"certmaster-request" コマンド実行後、(終了を確認せずに)次のステップへ移ってください。

[root@client1]# certmaster-request
[root@client2]# certmaster-request

minion から "certmaster-request" コマンドの実行中に certmaster で署名登録します。

[root@certmaster]# certmaster-ca --list
client1.example.org
client2.example.org

[root@certmaster]# certmaster-ca --sign client1.example.org client2.example.org
/var/lib/certmaster/certmaster/csrs/client1.example.org.csr signed - cert located at /var/lib/certmaster/certmaster/certs/client1.example.org.cert
/var/lib/certmaster/certmaster/csrs/client2.example.org.csr signed - cert located at /var/lib/certmaster/certmaster/certs/client2.example.org.cert

登録した minion を削除したい場合は、以下のようにして削除できます。

[root@dhcp-0061 ~]# certmaster-ca --clean client2.example.orgcertmaster.example.org
Cleaning out /var/lib/certmaster/certmaster/certs/client2.example.org.cert for host matching client2.example.org

minion で funcd を起動させます。要領は、先ほど certmaster を起動させたのと同様です。

[root@client1]# chkconfig funcd on
[root@client1]# chkconfig --list funcd
funcd           0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@client1]# service funcd start
Starting func daemon:
[root@client1]# service funcd status
/usr/bin/funcd is running

[root@client2]# chkconfig funcd on
[root@client2]# chkconfig --list funcd
funcd           0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@client2]# service funcd start
Starting func daemon:
[root@client2]# service funcd status
/usr/bin/funcd is running

これで設定は完了です。
certmaster で "func" コマンドを実行して動作確認してみます。正しく設定できていれば、以下のように minion が見えます。

[root@certmaster]# func "*" list_minions
client1.example.org
client2.example.org

"func" コマンドのモジュールやメソッドを調べます。詳細は、第3回 funcコマンドの使用方法をご参照ください。

[root@certmaster]# func client1.example.org call system list_modules
on https://client1.example.org:51234 running system list_modules ()
['command', 'copyfile', 'filetracker', 'func_module', 'hardware', 'jobs', 'mount', 'nagios-check', 'netapp.options', 'netapp.snap', 'netapp.vol', 'netapp.vol.clone', 'networktest', 'process', 'reboot', 'rpms', 'service', 'smart', 'snmp', 'sysctl', 'test', 'virt', 'yumcmd']

[root@certmaster]# func client1.example.org call service list_methods
on https://client1.example.org:51234 running service list_methods ()
['status', 'reload', 'get_running', 'stop', 'start', 'inventory', 'get_enabled', 'restart', 'module_description', 'module_version', 'module_api_version', 'list_methods']

試しに certmaster から client1 の httpd のサービス起動/停止を行ってみました。確かに意図したように動作しています。クライアント指定は "*" を使うと、複数クライアントも同様に1コマンドで操作する事ができます。httpd が実行されていないときに、service status を取得するとリターンコード '3' が返ってくるようです。

[root@certmaster]# func client1.example.org call service start httpd
on https://client1.example.org:51234 running service start (httpd)
0
[root@certmaster]# func client1.example.org call service status httpd
on https://client1.example.org:51234 running service status (httpd)
0

[root@client1]# ps -ax|grep httpd
1988 ?        S      0:00 /usr/sbin/nss_pcache off /etc/httpd/alias
1992 ?        Ssl    0:00 /usr/sbin/httpd
1997 ?        S      0:00 /usr/sbin/httpd
1998 ?        S      0:00 /usr/sbin/httpd
1999 ?        S      0:00 /usr/sbin/httpd
2000 ?        S      0:00 /usr/sbin/httpd
2001 ?        S      0:00 /usr/sbin/httpd
2002 ?        S      0:00 /usr/sbin/httpd
2003 ?        S      0:00 /usr/sbin/httpd
2004 ?        S      0:00 /usr/sbin/httpd

[root@certmaster]# func client1.example.org call service restart httpd
on https://client1.example.org:51234 running service restart (httpd)
0

[root@client1]# ps -ax|grep httpd
2037 ?        S      0:00 /usr/sbin/nss_pcache off /etc/httpd/alias
2041 ?        Ssl    0:00 /usr/sbin/httpd
2046 ?        S      0:00 /usr/sbin/httpd
2047 ?        S      0:00 /usr/sbin/httpd
2048 ?        S      0:00 /usr/sbin/httpd
2049 ?        S      0:00 /usr/sbin/httpd
2050 ?        S      0:00 /usr/sbin/httpd
2051 ?        S      0:00 /usr/sbin/httpd
2052 ?        S      0:00 /usr/sbin/httpd
2053 ?        S      0:00 /usr/sbin/httpd

[root@certmaster]# func client1.example.org call service stop httpd
on https://client1.example.org:51234 running service stop (httpd)
0
[root@certmaster]# func client1.example.org call service status httpd
on https://client1.example.org:51234 running service status (httpd)
3

以上、導入方法と func コマンドの使い方をさらっと辿ってみました。
次回は、スクリプトによる制御方法に挑戦してみようと思います。

トラックバック

このページのトラックバックURL:
http://www.typepad.jp/t/trackback/4447/12660840

このページへのトラックバック一覧 funky Func SI.1 - introduction/install -:

コメント

コメントを投稿

会社情報 採用情報 個人情報保護方針 商標等取り扱い事項 English
Copyright(c)2000-2006 MIRACLE LINUX CORPORATION. All Rights Reserved.