Solarisを便利に設定する


シリアルコンソールタイプをVT100にする

Solaris 9までは/etc/inittabを編集すればいいのですが、10から管理方 法が変わりsvccfgで設定します。

# svccfg -s console-login setprop ttymon/terminal_type = "vt100"

SendmailをMTAとする

localhostでしかbindしていないので、全I/Fでbindできるようにします。

# svccfg -s sendmail setprop config/local_only = false
# svcadm refresh sendmail
# svcadm restart sendmail

サーバにおける固定IPv6割り当て

Stateless Address AutoconfigurationとStateful Address Autoconfigurationを無効にします。

# vi /etc/inet/ndpd.conf

ifdefault StatelessAddrConf false
ifdefault StatefulAddrConf false

静的デフォルト経路を設定します。

# route -p add -inet6 default 2001:db8:1111:2222::1

IP Multipath

e1000g0とe1000g1でIP Multipathを構成します。

/etc/hostname.e1000g0

server netmask + broadcast + group IPMP up \
addif server-e1000g0 deprecated -failover netmask + broadcast + up

/etc/hostname.e1000g1

server-e1000g1 netmask + broadcast + deprecated group IPMP -failover standby up

/etc/hostname6.e1000g0

group IPMP -failover up \
addif 2001:db8:1111:2222::10/64 up

/etc/hostname6.e1000g1

group IPMP -failover standby up
# ifconfig -a

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.1.1 netmask ffffff00 broadcast 192.168.1.255
        groupname IPMP
e1000g0:1: flags=9040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER> mtu 1500 index 2
        inet 192.168.1.2 netmask ffffff00 broadcast 192.168.1.255
e1000g1: flags=69040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER,STANDBY,INACTIVE> mtu 1500 index 3
        inet 192.168.1.3 netmask ffffff00 broadcast 192.168.1.255
        groupname IPMP
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
        inet6 ::1/128
e1000g0: flags=a000841<UP,RUNNING,MULTICAST,IPv6,NOFAILOVER> mtu 1500 index 2
        inet6 fe80::xxxx:xxxx:xxxx:xxxx/10
        groupname IPMP
e1000g0:1: flags=2000841<UP,RUNNING,MULTICAST,IPv6> mtu 1500 index 2
        inet6 2001:db8:1111:2222::1/64
e1000g1: flags=6a000841<UP,RUNNING,MULTICAST,IPv6,NOFAILOVER,STANDBY,INACTIVE> mtu 1500 index 3
        inet6 fe80::xxxx:xxxx:xxxx:xxxx/10
        groupname IPMP

新しいバイナリを使う

過去の互換性を重視するあまり、/usr/bin/awkのように仕様が時代遅れ になっているバイナリがいくつかあります。新しいバイナリもOSに含まれて いますので、そちらを使うようにします。

% set path=(/usr/xpg6/bin /usr/xpg4/bin $path)

パスワードのエンクリプションアルゴリズムをMD5にする

Solaris 9はパッチ113475を適用するとパスワードエンクリプションアルゴ リズムにMD5やBlowfishが使えるようです。ここはアルゴリズム強度や PC-UNIXとの親和性を考えてMD5が使えるようにしてみます。

# vi /etc/security/policy.conf

LDAPに対応する

# vi /etc/defaultdomain
+ next-hop.net

# cp $HOME/.netscape/cert7.db /var/ldap
# cp $HOME/.netscape/key3.db /var/ldap
# chmod 444 /var/ldap/cert7.db
# chmod 444 /var/ldap/key3.db
# ldapclient manual -v -a domainName=dc=next-hop.net
  -a credentialLevel=proxy -a defaultSearchBase=dc=next-hop,dc=net
  -a proxyDN=cn=Manager,dc=next-hop,dc=net
  -a proxyPassword=secret
  -a certificatePath=/var/ldap
  -a authenticationMethod=tls:simple
  ldap.next-hop.net
設定内容および動作を確認します。
# ldapclient list
# ldaplist
# /usr/lib/ldap/ldap_cachemgr -g
pam_ldapを使うようにします。
# vi /etc/pam.conf

 #
 # login service (explicit because of pam_dial_auth)
 #
-login  auth requisite          pam_authtok_get.so.1
+login  auth required           pam_authtok_get.so.1
 login  auth required           pam_dhkeys.so.1
-login  auth required           pam_unix_auth.so.1
 login  auth required           pam_dial_auth.so.1
+login  auth sufficient         pam_unix_auth.so.1
+login  auth required           pam_ldap.so.1 try_first_pass
 #
 # rlogin service (explicit because of pam_rhost_auth)
 #
 rlogin auth sufficient         pam_rhosts_auth.so.1
-rlogin auth requisite          pam_authtok_get.so.1
+rlogin auth required           pam_authtok_get.so.1
 rlogin auth required           pam_dhkeys.so.1
-rlogin auth required           pam_unix_auth.so.1
+rlogin auth sufficient         pam_unix_auth.so.1
+rlogin auth required           pam_ldap.so.1 try_first_pass
 #
 # rsh service (explicit because of pam_rhost_auth,
 # and pam_unix_auth for meaningful pam_setcred)
 #
 rsh    auth sufficient         pam_rhosts_auth.so.1
-rsh    auth required           pam_unix_auth.so.1
+rsh    auth required           pam_authtok_get.so.1
+rsh    auth required           pam_dhkeys.so.1
+rsh    auth sufficient         pam_unix_auth.so.1
+rsh    auth required           pam_ldap.so.1 try_first_pass
 #
 # PPP service (explicit because of pam_dial_auth)
 #
 ppp    auth requisite          pam_authtok_get.so.1
 ppp    auth required           pam_dhkeys.so.1
-ppp    auth required           pam_unix_auth.so.1
 ppp    auth required           pam_dial_auth.so.1
+ppp    auth sufficient         pam_unix_auth.so.1
+ppp    auth required           pam_ldap.so.1 try_first_pass
 #
 # Default definitions for Authentication management
 # Used when service name is not explicitly mentioned for
 authenctication
 #
-other  auth requisite          pam_authtok_get.so.1
+other  auth required           pam_authtok_get.so.1
 other  auth required           pam_dhkeys.so.1
-other  auth required           pam_unix_auth.so.1
+other  auth sufficient         pam_unix_auth.so.1
+other  auth required           pam_ldap.so.1 try_first_pass
 #
 # passwd command (explicit because of a different authentication
 module)
 #
-passwd auth required           pam_passwd_auth.so.1
+passwd auth sufficient         pam_passwd_auth.so.1
+passwd auth required           pam_ldap.so.1 try_first_pass
 #
 # cron service (explicit because of non-usage of pam_roles.so.1)
 #
@@ -76,7 +84,8 @@
 other  password required       pam_dhkeys.so.1
 other  password requisite      pam_authtok_get.so.1
 other  password requisite      pam_authtok_check.so.1
-other  password required       pam_authtok_store.so.1
+other  password sufficient     pam_authtok_store.so.1
+other  password required       pam_ldap.so.1
 #
 # Support for Kerberos V5 authentication (uncomment to use Kerberos)
 #

LVMを監視する

LVM(Logical Volume Manager/旧Solaris Disk Suite)でRAIDを組んだ場合、 ディスク障害を監視するためにポーリングします。

障害があった場合メールで知らせるように、以下のようなスクリプトを 作成します。

#!/bin/sh

LANG=C; export LANG

ADMIN=root

# check metastat STATUS
ERR=`/usr/sbin/metastat | grep State: | grep -v Okay`

# IF Mirror Disk not "Okay" Then Mail To Admin
if [ ! -z "$ERR" ]; then
        HOST=`/usr/bin/uname -n`
        TMPF=/tmp/tmp`date +%y%m%d%H%M%S`
        /usr/sbin/metastat > $TMPF
        cat $TMPF | mailx -s "$HOST RAID Disk not Okey !!" $ADMIN
        rm -f $TMPF
fi

5分間隔で定期的に動作するようにします。

# crontab -e
+ 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/check-metastat.sh

FreeBSDからコンソールを使えるようにする

FreeBSDのデフォルトのコンソールはcons25になっていますが、Solaris にはcons25のterminfoがありません。それで、FreeBSDのtermcapから該当部 分を抜き出し、Solarisでterminfo形式に変換して登録します。

# captoinfo cons25.termcap > cons25.terminfo

Solaris10でlibtoolsのlibstdc++.laを使えるようにする

Solaris10 03/05では/usr/sfw/lib/libstdc++.laのサイズが0バイトです。 これだとlibtoolsが失敗します。よって中身を作ります。

/usr/sfw/lib/libstdc++.la:
# libstdc++.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.4a-GCC3.0 (1.641.2.256
2001/05/28 20:09:07 with GCC-local changes)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libstdc++.so.6'

# Names of this library.
library_names='libstdc++.so.6.0.3 libstdc++.so.6 libstdc++.so'

# The name of the static archive.
old_library='libstdc++.a'

# Libraries that this one depends upon.
dependency_libs='-lc -lm -L/usr/sfw/lib -lgcc_s'

# Version information for libstdc++.
current=6
age=0
revision=3

# Is this an already installed library?
installed=yes

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/sfw/lib'

64bit版も中身を作ります。

/usr/sfw/lib/64/libstdc++.la:
# libstdc++.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.4a-GCC3.0 (1.641.2.256
2001/05/28 20:09:07 with GCC-local changes)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libstdc++.so.6'

# Names of this library.
library_names='libstdc++.so.6.0.3 libstdc++.so.6 libstdc++.so'

# The name of the static archive.
old_library='libstdc++.a'

# Libraries that this one depends upon.
dependency_libs='-L/lib/64 -lc -lm -L/usr/sfw/lib/64 -lgcc_s'

# Version information for libstdc++.
current=6
age=0
revision=3

# Is this an already installed library?
installed=yes

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/sfw/lib/64'