Mingw(Msys)日本語化
2/19 19:00修正(寝ぼけててCygwinと間違えた)
出力する文字コードはSJISに統一する。
UTF8でもgettextやmanは表示できるがWindowsのファイル名がSJISで出力されるため。
ターミナルはmintty。
必要なもの
- nkf(自分でビルドする)
- ~/.profile
# lsで日本語を表示するためのalias alias ls='ls --color=auto --show-control-chars' # gettext用 export OUTPUT_CHARSET=sjis
- ~/.inputrc
set meta-flag on set output-meta on set convert-meta off set kanji-code sjis
- ~/.minttyrc
Locale=ja_JP Charset=SJIS
- /share/misc/man.conf
# manは標準ではsjisで出力できないためutf8で出力する JNROFF /usr/bin/groff -DeucJP -Tutf8 -mandoc JNEQN /usr/bin/eqn -Tutf8 # PAGERでsjisへ変換 PAGER nkf -s | /usr/bin/less -isrR
- ~/.vimrc
set enc=sjis
openldap+saslauthd+active directoryでpass-through authentication
AD+SUAでLDAPとして使うとか、pam_krb5使うとか、ADとLDAPでpassword syncする、とかもあるけれど
openldapのattribute使って、認証だけADにしたかったのでやってみました。
環境はCentOS 5.7。
イメージとしてはこんな感じ。
slapd => saslauthd => active directory
まず、slapdをsaslauthd経由で認証させるために
以下を追記
- /etc/openldap/slapd.conf
sasl-host localhost sasl-secprops none
- /etc/sasl2/slapd.conf (2/14修正)
pwcheck_method: saslauthd saslauthd_path: /var/run/saslauthd/mux
お次はsaslauthd
- /etc/sysconfig/saslauthd
SOCKETDIR=/var/run/saslauthd MECH=ldap FLAGS="-O /etc/saslauthd.conf"
- /etc/saslauthd.conf
ldap_servers: ldap://dc.example.com #ADのドメインコントローラ ldap_default_domain: example.com ldap_search_base: dc=example,dc=com ldap_bind_dn: sync@example.com #ADはanonymous bindできないのでbindするユーザー名 ldap_bind_pw: secret ldap_deref: never ldap_restart: yes ldap_scope: sub ldap_use_sasl: no ldap_start_tls: no ldap_version: 3 ldap_auth_method: bind ldap_filter: sAMAccountName=%U ldap_timeout: 10 ldap_cache_ttl: 30 ldap_cache_mem: 32768
slapdで管理しているユーザーのuserPassword属性を書き換えます。
{SASL}foobar@example.com
サービス再起動
# service ldap restart # service saslauthd restart
saslauthdのテスト
# testsaslauthd -u foobar -p password 0: OK "Success."
あとはldapsearch等でbindできればOK。
pam_ldap等でも使えるけど、これだと認証しかできないのでpasswdコマンドでパスワードの変更ができない。
ADはldaps接続でないと書き込みができないけれど、ldapsにしたとして、unicodepwdをどう書き換えるかはよくわかりません。
Ovirtを試してみる
3年以上前に発表されたものの、この1、2年は目立った動きがなかったOvirtですが、今月に入って装いも新たに再出発したようなので試してみた。
以前のOvirtはRuby on RailsベースでFreeIPAやCobberと連携するものだったと記憶しているが、今はJBossのJavaアプリケーションになっているようです。
UIを見るかぎり、RHEV-M 3.0がベースになっているようなので、そっちを触ったことがある人はとっつきやすいのかもしれません。
(私はRHEV-Mを触ったことはありません。Web上のスクリーンショットからそう感じているだけ。)
Wikiにある程度インストール周りの情報がまとまっているので、基本的にはそれを参照します。
気付いたポイントだけ追記する。
その1。
vdsmd.serviceは初回起動時にlibvirtd.confとqemu.confにいくつかの行を自動で追記します。
TLS(SSL)無しだと以下のようになると思います。
- /etc/libvirt/libvirtd.conf
listen_addr="0" unix_sock_group="kvm" unix_sock_rw_perms="0770" auth_unix_rw="sasl" save_image_format="lzop" log_outputs="1:file:/var/log/libvirtd.log" log_filters="1:libvirt 3:event 3:json 1:util 1:qemu" auth_tcp="none" listen_tcp=1 listen_tls=0
dynamic_ownership=0 spice_tls=0
ただし、TLS周りの追記内容はlibvirtd.confとqemu.confで判定基準が違うため、/etc/vdsmd/vdsm.confにSSL Falseの設定をする前にvdsmd.serviceを起動させてしまうと、spice_tls=1がqemu.confに書かれてlibvirtd.confと矛盾する内容になってしまい、以下のようなメッセージを吐いてvdsmdが起動しなくなります。
conflicting vdsm and libvirt tls confguration. vdsm.conf with ssl=False requires libvirt with: listen_tcp=1, auth_tcp="none" and spice_tls=0
その2。
JBossは/var/runにpidを要求するくせに、tmpfsの設定はしてくれません。
/etc/tmpfiles.d/に設定ファイルを作ってあげましょう。
- /etc/tmpfiles.d/jboss.conf
D /var/run/jboss 0700 jboss jboss -
その3。
wikiにも書いてあるけど、以下は必須。
やらないとVirtual Machine作成しても起動しません。
psql -U postgres engine -c "update vdc_options set option_value='pc-0.14' where option_name='EmulatedMachine' and version='3.0';"
やるのを忘れて、後から実行したらovirt-engineを実行しているマシンを再起動するまで反映されませんでした。
(よくよく考えるとjbossの再起動だけでも良い気がする)
その4。
jbossはサービスで起動するので以下は不要。
${JBOSS_HOME}/bin/run.sh -b 0.0.0.0
その5。
wikiでは下記のコマンドで実行しているけど、Hostの登録はWeb UIからもできます。
curl -X POST -d "<host><name>${hostname}</name><address>${ipaddress}</address><root_password>${password}</root_password></host>" --header "Content-Type: application/xml" -u 'admin@internal:letmein!' http://${server}:${port}/api/hosts
インストールが終わったら、http://
-
- DataとISOの2つ必要
- isoファイルはengine-iso-uploaderコマンドか、Domain Type:ISOで登録したストレージの
/ /images/11111111-1111-1111-1111-111111111111 というディレクトリに放り込む
↓
Virtual Machineの作成
設定の依存関係も下から上になっているので、削除するときは気をつけましょう。
いきなりClusterのHostを全削除、とかやると多分詰みます。
1回やらかして、Storage Domainが迷子になったのかData Centerの削除もHostの追加もできなくなったので初期化しました。
以下、パッと見まだ実装されていないもの
- ovirt-engineのConfiguration
- account管理、パスワードの変更
- Storage Domain
- iSCSI
- FiberChannel
- Live Migration
- Pool
個人的にiSCSIとLive Migrationが無いのが痛いので、すぐに使うことはないと思いますが、
yumからspice-xpiを導入するとFirefoxからspiceのコンソールにアクセスできるのはすばらしいので、今後に期待します。
しかしインストール関連以外のドキュメントがほとんど無いのはどうにかして欲しいなあ。
engine-* コマンドの設定周りのドキュメントが欲しいよ。
libvirt(kvm)でUSB2.0
virsh dumpxml
して下のコンフィグを追加、
virsh define foobar.xml
するだけ。
<controller type='usb' index='1' model='ich9-ehci1'> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x7'/> </controller> <controller type='usb' index='1' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </controller> <controller type='usb' index='1' model='ich9-uhci2'> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x1'/> </controller> <controller type='usb' index='1' model='ich9-uhci3'> <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x2'/> </controller>
slotの番号は適当に重複しない数値を入れること。
これでUSBパススルーするとUSB2.0で動作する。
libvirtにこの機能が追加されたのが今年の8月〜10月ごろのようなので、最近のディストリビューションでないと使えないと思います。
私はFedora16で確認しています
libvirtでTLS接続
リモートからvirt-manager等でlibvirtdに接続しようとするとsshを使うのが一番手っ取り早いのですが、
うちの環境だと頻繁にトラフィックが詰まって(?)sshがゾンビ化してしまうので、TLS接続に切り替えてみた。
環境はサーバー、クライアント共にFedora16。
独自CAはWindowsの証明書サービスを使っているので、そこは割愛。
それぞれ必要なものは、
libvirt(サーバ)側
Path | 説明 |
---|---|
/etc/pki/CA/cacert.pem | 独自CAのCA証明書 |
/etc/pki/libvirt/private/serverkey.pem | 秘密鍵 |
/etc/pki/libvirt/servercert.pem | 独自CAで発行したサーバ証明書 |
virt-manager(クライアント)側
Path | 説明 |
---|---|
/etc/pki/CA/cacert.pem | 独自CAのCA証明書 |
/etc/pki/libvirt/private/clientkey.pem | 秘密鍵 |
/etc/pki/libvirt/clientcert.pem | 独自CAで発行したクライアント証明書 |
以下おおまかな証明書発行の流れ
# 秘密鍵生成 $> openssl genrsa -out hoghoge.key 2048 # 証明書要求 # CN(Common Name)はvirt-managerで接続するホスト名にする $> openssl req -new -key hogehoe.key -out hogehoge.csr # 証明書サービスで証明書発行 # opensslで独自CAを作っている場合はそれを使う。 <割愛> # pem形式に変換 $> openssl x509 -in hogehoge.cer -outform pem -out hogehoge.pem
Fedoraの場合は/etc/sysconfig/libvirtdの
# Listen for TCP/IP connections # NB. must setup TLS/SSL keys prior to using this # LIBVIRTD_ARGS="--listen"
のコメントを
# Listen for TCP/IP connections # NB. must setup TLS/SSL keys prior to using this LIBVIRTD_ARGS="--listen"
としてやるとTLS接続を受け付けるようになります。
あとはvirt-managerで「証明書付き SSL/TLS」で接続してあげれば接続できるはずです。
しかし接続が不安定なのはTLSでも変わらなかったので、環境の問題のようです。
NginxでExchange activesyncのリバースプロキシを作る
ほとんどここからの引用。
環境は
- Ubuntu 10.04
- Exchange Server 2010 SP1
Nginxのconfigは以下の通り。
server { listen 80; server_name external.url; # Redirect any HTTP request to HTTPS rewrite ^(.*) https://external.url$1 permanent; error_log /var/log/nginx/owa-error.log; access_log /var/log/nginx/owa-access.log; } server { listen 443; server_name external.url; # Redirect from "/" to "/owa" by default # rewrite ^/$ https://external.url/owa permanent; # Enable SSL ssl on; ssl_certificate /etc/ssl/private/exprox.crt; ssl_certificate_key /etc/ssl/private/exprox.key; ssl_session_timeout 5m; # Set global proxy settings proxy_read_timeout 360; proxy_pass_header Date; proxy_pass_header Server; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location /owa { proxy_pass https://internal.url/owa; } location /ecp { proxy_pass https://internal.url/ecp; } location /Microsoft-Server-ActiveSync { proxy_pass https://internal.url/Microsoft-Server-ActiveSync; } error_log /var/log/nginx/owa-ssl-error.log; access_log /var/log/nginx/owa-ssl-access.log; }
あとやること
後者は必要な気がしたのでやっておいた。やり方は以下。
- /usr/share/ca-certificates/にCA証明書を追加
- /etc/ca-certificates.confに追加した証明書を追記
- update-ca-certificates
iPhone4(iOS 4.3.5)で確認済み。
EventID: 1006
わりと長いこと悩まされていた問題。
WindowsXPなXenDesktopでセッションが切断された後、ICAでもRDPでもXenCenterのコンソールでもログインできなくなる。
このログが出ていたのでどうもコレくさい気がする。
EventID: 1006
Source: TermService
The terminal server received large number of incomplete connections. The system may be under attack.
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer
にMaxOutstandingConnectをDWORD作成して値を32にしてみる。
これで様子を見て出なくなったらこれのせいだね。