メインコンテンツへスキップ

FreeBSDで自宅サーバセットアップ!まずは動かしてみよう!

    過去にセットアップした時の主に監視系サービスのテストをした時の手順です。WEB、メール、DNSも設定項目入れた時のものです。

    ドメイン名、ホスト名、ユーザ名などは置き換えれば、そのまま利用できると思います。

    利用しているHW環境によっては、他のバージョンで構成する必要もあるかと思います。


    【構成】
    ★FreeBSDインストールメモ
    ※複数のHDDを搭載しているマシンにおいて、
    /stand/sysinstall Package インストールで
    Labelの構成を完了した後、Partetion に戻り
    書き込み、Quit(C= の表示のまま)で終了する。

    《masterHDD》
    / 2GB
    swap 2GB
    /usr 20GB
    /var 残り全部

    《slabeHDD》
    /home 全部

    ※自宅環境で設定して無事動作した手順ですが、環境はそれぞれ違うと思うので、自己責任にてお願いいたします。


    0.【Kernel再構築】

    # cd /usr/src/sys/i386/conf
    # cp GENERIC [新カーネル名] ここではTARO001とした
    # vi TARO001
    〈編集内容〉
    ident TARO001

    #options NFS #Network Filesystem
    #options NFS_ROOT #NFS usable as root device, NFS required
    #options MSDOSFS #MSDOS Filesystem

    # ATA and ATAPI devices
    #device atapist # ATAPI tape drives

    # SCSI Controllers
    #device ahb # EISA AHA1742 family
    #device ahc # AHA2940 and onboard AIC7xxx devices
    #device ahd # AHA39320/29320 and onboard AIC79xx devices

    # PCCARD (PCMCIA) support
    #device card
    #device pcic0 at isa? irq 0 port 0x3e0 iomem 0xd0000
    #device pcic1 at isa? irq 0 port 0x3e2 iomem 0xd4000 disable

    # Parallel port
    #device ppc0 at isa? irq 7
    #device ppbus # Parallel port bus (required)
    #device lpt # Printer
    #device plip # TCP/IP over parallel
    #device ppi # Parallel port interface device

    # PCI Ethernet NICs.
    #device txp # 3Com 3cR990 (``Typhoon'')
    #device vx # 3Com 3c590, 3c595 (``Vortex'')

    # PCI Ethernet NICs that use the common MII bus controller code.
    # NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
    #device dc # DEC/Intel 21143 and various workalikes
    #device pcn # AMD Am79C97x PCI 10/100 NICs
    #device rl # RealTek 8129/8139
    #device sf # Adaptec AIC-6915 (``Starfire'')
    #device sis # Silicon Integrated Systems SiS 900/SiS 7016
    #device ste # Sundance ST201 (D-Link DFE-550TX)
    #device tl # Texas Instruments ThunderLAN
    #device tx # SMC EtherPower II (83c170 ``EPIC'')
    #device vr # VIA Rhine, Rhine II
    #device wb # Winbond W89C840F
    #device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'')

    # ISA Ethernet NICs.
    # 'device ed' requires 'device miibus'
    #device ed0 at isa? disable port 0x280 irq 10 iomem 0xd8000
    #device ex
    #device ep
    #device fe0 at isa? disable port 0x300

    # Xircom Ethernet
    #device xe
    # PRISM I IEEE 802.11b wireless NIC.
    #device awi
    # WaveLAN/IEEE 802.11 wireless NICs.
    #device wi
    # Aironet 4500/4800 802.11 wireless NICs.
    #device an
    # The probe order of these is presently determined by i386/isa/isa_compat.c.
    #device ie0 at isa? disable port 0x300 irq 10 iomem 0xd0000
    #device le0 at isa? disable port 0x300 irq 5 iomem 0xd0000
    #device lnc0 at isa? disable port 0x280 irq 10 drq 0
    #device cs0 at isa? disable port 0x300
    #device sn0 at isa? disable port 0x300 irq 10

    # USB support
    #device ulpt # Printer
    #device uscanner # Scanners
    #device urio # Diamond Rio MP3 Player
    # USB Ethernet, requires mii
    #device aue # ADMtek USB ethernet
    #device cue # CATC USB ethernet
    #device kue # Kawasaki LSI USB ethernet

    # FireWire support
    #device firewire # FireWire bus code
    #device sbp # SCSI over FireWire (Requires scbus and da)
    #device few # Ethernet over FireWire (non-standard!)

    # USB support
    #device uhci # UHCI PCI->USB interface
    #device ohci # OHCI PCI->USB interface
    #device usb # USB Bus (required)
    #device ugen # Generic
    #device uhid # "Human Interface Devices"
    #device ukbd # Keyboard
    #device umass # Disks/Mass storage - Requires scbus and da
    #device ums # Mouse

    ↑以上

    # config TARO001
    ここで以下のようにでたらmakeしてinstall
    Don't forget to do a ``make depend''
    Kernel build directory is ../../compile/TARO001

    # cd ../../compile/TARO001
    # make depend
    # make
    # make install
    # reboot
    ---------------------------------------------------------------
    ◎FWフィルタリング機能追加コンパイル
    1.
    vi /etc/rc.conf

    firewall_enable="YES"
    firewall_script="/etc/rc.firewall"
    firewall_type="/etc/ipfw.conf"
    #firewall_quiet ="YES"

    2.
    vi /etc/ipfw.conf
    add 00100 allow ip from any to any

    3.
    vi /etc/rc.conf
    firewall_logging="YES"

    4.
    vi /etc/sysctl.conf
    net.inet.ip.fw.verbose_limit=1000 --->>>(sysctl -w net.inet.ip.fw.verbose_limit=1000)

    5.
    cd /usr/src/sys/i386/conf
    cp TARO001 TAROKERNEL
    vi TAROKERNEL

    options IPFIREWALL
    options IPFIREWALL_VERBOSE
    options IPFIREWALL_VERBOSE_LIMIT=1000

    # config TAROKERNEL
    # cd ../../compile/TAROKERNEL
    # make depend
    # make && make install
    # reboot

    ※追加設定
    TARO001 → GUNDAMとして再度コンパイルする(変更点は以下)

    ident GUNDAM

    # USB support
    #device uhci # UHCI PCI->USB interface
    #device ohci # OHCI PCI->USB interface
    #device usb # USB Bus (required)
    #device ugen # Generic
    #device uhid # "Human Interface Devices"
    #device ukbd # Keyboard
    #device umass # Disks/Mass storage - Requires scbus and da
    #device ums # Mouse


    1. Ports 更新(cvsup 設定)

    0-0./stand/sysinstall Package cvsupインストール
    Cvsup-without-GUI > CD3枚目より、手動インストール

    0-1. cvsupのInstall

    portsでinstall
    # cd /usr/ports/net/cvsup
    # make
    # make install


    0-2. portsの更新

    ※user はtaro で仮に作成してます。

    # cp /usr/share/examples/cvsup/ports-supfile /home/taro/
    # vi /home/taro/ports-supfile

    以下を編集
    *default host=cvsup.jp.FreeBSD.org
    *default base=/var/db

    cvsupの実行
    # cvsup /home/taro/ports-supfile


    2.Apache インストール


    2-1.Apache2 (ports版)インストール手順

    ホスト名はtaro-bsdとかしてますが、もちろん個別に設定してくださいませ

    ドメイン名も「sample.xxx」とかになってますので、こちらも修正お願いします。

    ----------------------------------Ports版--------------------------------------
    1. apache2のInstall
    現時点ではapache-2.0.50_3

    portsでinstall
    # cd /usr/ports/www/apache2/
    # make
    # make install

    /usr/local/apache2/conf/httpd.conf編集

    #Listen 80

    ServerAdmin taro@sample.xxx

    <Directory "/var/www/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All <<<Noneから変更
    Order allow,deny
    Allow from all
    </Directory>

    <Directory "/var/www/icons">
    Options Indexes MultiViews
    AllowOverride All <<<Noneから変更
    Order allow,deny
    Allow from all
    </Directory>


    /usr/local/etc/apache2/ssl.conf編集

    ServerName taro-bsd:443
    ServerAdmin taro@sample.xxx

    SSLCertificateFile /usr/local/etc/apache2/ssl/tarohoge.crt
    SSLCertificateKeyFile /usr/local/etc/apache2/ssl/tarohoge.pem


    鍵の生成

    # openssl genrsa -des3 -rand /var/log/messages -out tarohoge.pem 2048
    # openssl req -new -key tarohoge.pem -out tarohoge.csr
    # openssl x509 -req -in tarohoge.csr -signkey tarohoge.pem -out tarohoge.crt

    # mkdir -p /usr/local/etc/apache2/ssl
    # mv tarohoge.pem /usr/local/etc/apache2/ssl
    # mv tarohoge.crt /usr/local/etc/apache2/ssl

    ドキュメントルート、CGIディレクトリ作成、シンボリックリンク作成

    # mkdir /home/www/htdocs
    # mkdir /home/www/cgi-bin
    # chown -R wwwmaster:www /home/www/htdocs
    # chown -R wwwmaster:www /home/www/cgi-bin
    # cd /usr/local/www
    # ln -s /home/www/htdocs .
    # ln -s /home/www/cgi-bin .

    起動

    /etc/rc.confを編集

    # Apache2 starting with boot
    apache2ssl_enable="YES"

    どちらでも良い
    #### /usr/local/etc/rc.d/apache2.sh start
    #### apachectl start

    2. PHP対応

    portsでInstall
    # cd /usr/ports/lang/php4
    # make install

    Apache2とIPv6にチェックを入れる

    httpd.confの変更
    #以下のエントリを追加

    ## PHP Entry add
    AddType application/x-httpd-php .php .phtml
    AddType application/x-httpd-php-source .phps

    テスト

    以下のファイルを作成
    /home/www/htdocs/test.php
    <?php phpinfo();?>

    該当URLを参照してサーバの情報が閲覧できればOK

    --------------------------------↑Ports版↑------------------------------------

    ● php4をアンインストールし、mod_php4を使用することにした。
    (WebMail 自作スクリプトの使用)(Apache2との連動)

    ports からインストールする。
    ※mod_php4 と混在するとエラーが出るので消した
    cd /usr/ports/lang/php4
    make deinstall
    # cd /usr/ports/www/mod_php4/
    # make install clean途中の Options では APACHE2 にチェックを入れておく。その後、php4-extensions もインストールする。

    # cd /usr/ports/lang/php4-extensions
    # make install clean入れたいものにチェック。日本語環境なら MBSTRING にチェックすべき。何を入れたかは、インストール後、# grep true /var/db/ports/php4-extensions/options で確認出来る。

    # cd /usr/ports/security/openssl
    # make deinstall
    # make install clean


    # cd /usr/ports/mail/php4-imap
    # make install clean

    # cd /usr/ports/lang/php4-extensions
    # make install clean

    # php –v では、バージョンは出ない為、test.php をWEBより閲覧。


    2-2.Apache2 (source版)+ modssl インストール手順

    2-1,2-2は、参考の為2種類記載してます。基本、ports版で良い。

    ----------------------------------source版-------------------------------------
    ■Apache2.0のInstall
    Apache2.0の最新版Sourceを入手する
    http://sunsite.tus.ac.jp/pub/apache/httpd/httpd-2.0.52.tar.gz
    この時点ではhttpd-2.0.52

    Sourceを展開する
    > tar xvfz httpd-2.0.52.tar.gz

    展開されたディレクトリに入る
    > cd httpd-2.0.52

    コンパイルする
    > ./configure --prefix=/usr/local/apache2 --enable-threads --enable-ssl

    Makeする
    > make

    Installする
    # make install


    ■PHP5.0.2のInstall

    PHPのsourceを入手する
    http://jp2.php.net/get/php-5.0.2.tar.gz/from/this/mirror
    この時点ではphp-5.0.2

    Sourceを展開する
    > tar xvfz php-5.0.2.tar.gz

    展開されたディレクトリに入る
    > cd php-5.0.2

    コンパイルする
    > ./configure --with-apxs2=/usr/local/apache2/bin/apxs --disable-libxml

    *************************************************************************
    ./configure --with-apxs2=/usr/local/apache2/bin/apxs --enable-mbstring --enable-mbstr-enc-trans --with-pgsql=/usr/local/pgsql --disable-libxml
    *************************************************************************

    ※コンパイルオプションについては別途./configure --help参照

    Makeする
    > make

    Installする
    # make install


    ■ディレクトリ調整
    /var/wwwを作成し、ここにメインのファイルを指定する

    # mkdir /var/www
    # mkdir /var/www/cgi-bin
    # mkdir /var/www/htdocs
    # mkdir /var/www/logs

    # cp -r /usr/local/apache2/icons /var/www/

    # cd /var
    # chown -R www:www www

    /usr/local/apache2以下の調整
    # cd /usr/local/apache2
    # mv cgi-bin cgi-bin.old
    # ln -s /var/www/logs .
    # ln -s /var/www/icons .
    # ln -s /var/www/cgi-bin .

    ■Apache2設定ファイルの編集
    ●/usr/local/apache2/conf/httpd.confの編集

    =====ココカラ======
    (Port80閉塞)
    #Listen 80 #port 80では使用しないため、コメントアウト

    (user:group設定)
    User www
    Group www

    (serveradmin設定)
    ServerAdmin webmaster@sample.xxx

    (DocumentRootの場所)
    DocumentRoot "/var/www/htdocs"

    (/設定)
    <Directory />
    AllowOverride None
    Order Deny,Allow
    Deny from all
    </Directory>

    <Directory "/var/www/htdocs">
    Options FollowSymLinks
    AllowOverride All #.htaccessを参照するように変更
    Order allow,deny
    Allow from all
    </Directory>

    (DirectoryIndexに.htmを追加)
    DirectoryIndex index.htm index.html index.html.var

    (IconsDirの変更)
    Alias /icons/ "/var/www/icons/"

    <Directory "/var/www/icons">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>

    (Manual欄コメントアウト)
    #<Directory "/usr/local/apache2/manual">の箇所

    (CGI-BINの変更)
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

    <Directory "/var/www/cgi-bin">
    AllowOverride All
    Options None
    Order allow,deny
    Allow from all
    </Directory>

    (LanguagePriority設定)
    LanguagePriority ja … #jaを先頭に追加

    (AddDefaultCharset設定)
    AddDefaultCharset shift_jis

    (PHPの有効化)
    AddType application/x-httpd-php .php .phtml
    AddType application/x-httpd-php-source .phps
    =======ココマデ========

    ●/usr/local/apache2/conf/ssl.conf編集
    =======ココカラ========
    (Portの指定)
    Listen 10443 # 戻す必要あり

    (VirtualHost指定)
    <VirtualHost _default_:10443>

    # General setup for the virtual host
    DocumentRoot "/var/www/htdocs"
    ServerName taro-bsd.sample.xxx:10443 # 戻す必要あり
    ServerAdmin webmaster@sample.xxx
    ErrorLog logs/error_log
    TransferLog logs/access_log

    (認証ファイルの指定)
    SSLCertificateFile /usr/local/apache2/conf/ssl/taro-bsd.sample.xxx.crt

    (鍵ファイル指定)
    SSLCertificateKeyFile /usr/local/apache2/conf/ssl/taro-bsd.sample.xxx.pem

    (cgi-bin指定)
    <Directory "/var/www/cgi-bin">
    SSLOptions +StdEnvVars
    </Directory>
    =======ココマデ=======


    ●SSL鍵の生成
    (鍵の生成)
    # openssl genrsa -des3 -rand /var/log/messages -out taro-bsd.sample.xxx.pem 2048
    # openssl req -new -key taro-bsd.sample.xxx.pem -out taro-bsd.sample.xxx.csr
    # openssl x509 -req -in taro-bsd.sample.xxx.csr -signkey taro-bsd.sample.xxx.pem -out taro-bsd.sample.xxx.crt

    # mkdir -p /usr/local/apache2/ssl
    # mv taro-bsd.sample.xxx.pem /usr/local/apache2/ssl
    # mv taro-bsd.sample.xxx.crt /usr/local/apache2/ssl

    (起動の度にパスワードを聞かれるため以下を実施)
    # mv taro-bsd.sample.xxx.pem taro-bsd.sample.xxx.pem.org
    # openssl rsa -in taro-bsd.sample.xxx.pem.org -out taro-bsd.sample.xxx.pem


    ■起動ファイル作成
    /usr/local/etc/rc.d/apache2.shの編集

    ======ココカラ=======
    #!/bin/sh
    PREFIX=/usr/local/apache2

    case "$1" in
    start)
    [ "ssl" = "ssl" -a -f "$PREFIX/conf/ssl/taro-bsd.sample.xxx.crt" ] && SSL=ssl
    [ -x ${PREFIX}/bin/apachectl ] && ${PREFIX}/bin/apachectl startssl > /dev/null && echo -n ' apache2'
    ;;
    stop)
    [ -r /var/www/logs/httpd.pid ] && ${PREFIX}/bin/apachectl stop > /dev/null && echo -n ' apache2'
    ;;
    *)
    echo "Usage: `basename $0` {start|stop}" >&2
    ;;
    esac

    exit 0
    =======ココマデ=======


    ■apache起動
    起動スクリプト使用
    /usr/local/etc/rc.d/apache2.sh start

    もしくは、
    /usr/local/apache2/bin/apachectl startssl

    netstatで該当portが開いている事を確認する

    ■PHPテスト

    以下のファイルを作成
    /var/www/htdocs/test.php
    <?php phpinfo();?>
    --------------------------------↑source版↑-----------------------------------



    3.Bind9 インストール手順

    テスト用に一度作成した環境なので、rdncのキーもそのまま記載。

    $ cat bind-9.2.4.tar.gz | gzip -c -d | tar -xvf -
    $ cd bind-9.2.4
    $ ./configure --prefix=/usr/local --enable-ipv6
    $ make
    $ make test
    $ su
    # make install


    ※rndc の作成
    /usr/local/sbin/rndc-confgen > rndc.conf
    (プロンプトが返らない場合:rndcontrol –s 0 と打つ)

    > /usr/local/sbin/dnssec-keygen -r /dev/urandom -a hmac-md5 -b 512 -n user rndc
    カレントディレクトリに
    Krndc.+157+xxxxx.key
    Krndc.+157+xxxxx.private
    ができる。

    それぞれ、下記のようになっている。

    Private-key-format: v1.2
    Algorithm: 157 (HMAC_MD5)
    Key: zpD9/Er4hLFc7OTU9HSCjwccx//1lN8kvPMjWLkt4hTyhHXhpdKX3I26M2j9VsWsjxJS1lhKk3CTOxH5JRrKlw==
    を、rndc.conf に、

    rndc. IN KEY 0 2 157 zpD9/Er4hLFc7OTU9HSCjwccx//1lN8kvPMjWLkt4hTyhHXhpdKX3I26 M2
    j9VsWsjxJS1lhKk3CTOxH5JRrKlw==
    を、named.conf に貼り付けて完了。

    3-1./usr/local/etc/named.conf

    // $FreeBSD: src/etc/namedb/named.conf,v 1.6.2.7 2003/02/13 13:16:51 keramida Exp $
    //
    // Refer to the named.conf(5) and named(8) man pages for details. If
    // you are ever going to set up a primary server, make sure you
    // understand the hairy details of how DNS works. Even with
    // simple mistakes, you can break connectivity for affected parties,
    // or cause huge amounts of useless Internet traffic.
    # Use with the following in named.conf, adjusting the allow list as needed:
    key "rndc-key" {
    algorithm hmac-md5;
    secret "*************************";
    };

    controls {
    inet 127.0.0.1 port 953
    allow { 127.0.0.1; } keys { "rndc-key"; };
    };

    options {
    directory "/usr/local/etc/namedb";
    pid-file "/usr/local/var/run/named/pid";

    // In addition to the "forwarders" clause, you can force your name
    // server to never initiate queries of its own, but always ask its
    // forwarders only, by enabling the following line:
    //
    // forward only;

    // If you've got a DNS server around at your upstream provider, enter
    // its IP address here, and enable the line below. This will make you
    // benefit from its cache, thus reduce overall DNS traffic in the Internet.
    /*
    forwarders {
    127.0.0.1;
    };
    */
    /*
    * If there is a firewall between you and nameservers you want
    * to talk to, you might need to uncomment the query-source
    * directive below. Previous versions of BIND always asked
    * questions using port 53, but BIND 8.1 uses an unprivileged
    * port by default.
    */
    // query-source address * port 53;

    /*
    * If running in a sandbox, you may have to specify a different
    * location for the dumpfile.
    */
    // dump-file "s/named_dump.db";
    };

    zone "." {
    type hint;
    file "named.root";
    };

    # localhost
    zone "localhost." {
    type master;
    file "db.localhost";
    };

    zone "0.0.127.IN-ADDR.ARPA" {
    type master;
    file "db.127.0.0";
    };

    # sample.xxx
    zone "sample.xxx." {
    type master;
    file "db.sample.xxx";
    };

    zone "10.16.172.IN-ADDR.ARPA" {
    type master;
    file "db.172.16.10";
    };

    /*
    後ほど、v6対応予定
    // RFC 3152
    zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA" {
    type master;
    file "localhost-v6.rev";
    };

    // RFC 1886 -- deprecated
    zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.INT" {
    type master;
    file "localhost-v6.rev";
    };
    */

    # End of named.conf

    3-2.BIND 各定義ファイル /usr/local/etc/namedb 以下に保存とする

    ★ named.root(コピーしてくりゃいいだけ)
    ;
    ; $FreeBSD: src/etc/namedb/named.root,v 1.9.2.2 2004/01/30 14:40:06 joerg Exp $
    ;

    ; This file holds the information on root name servers needed to
    ; initialize cache of Internet domain name servers
    ; (e.g. reference this file in the "cache . <file>"
    ; configuration file of BIND domain name servers).
    ;
    ; This file is made available by InterNIC
    ; under anonymous FTP as
    ; file /domain/named.root
    ; on server FTP.INTERNIC.NET
    ; -OR- RS.INTERNIC.NET
    ;
    ; last update: Jan 29, 2004
    ; related version of root zone: 2004012900
    ;
    ;
    ; formerly NS.INTERNIC.NET
    ;
    . 3600000 IN NS A.ROOT-SERVERS.NET.
    A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
    ;
    ; formerly NS1.ISI.EDU
    ;
    . 3600000 NS B.ROOT-SERVERS.NET.
    B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201
    ;
    ; formerly C.PSI.NET
    ;
    . 3600000 NS C.ROOT-SERVERS.NET.
    C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
    ;
    ; formerly TERP.UMD.EDU
    ;
    . 3600000 NS D.ROOT-SERVERS.NET.
    D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
    ;
    ; formerly NS.NASA.GOV
    ;
    . 3600000 NS E.ROOT-SERVERS.NET.
    E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
    ;
    ; formerly NS.ISC.ORG
    ;
    . 3600000 NS F.ROOT-SERVERS.NET.
    F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
    ;
    ; formerly NS.NIC.DDN.MIL
    ;
    . 3600000 NS G.ROOT-SERVERS.NET.
    G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
    ;
    ; formerly AOS.ARL.ARMY.MIL
    ;
    . 3600000 NS H.ROOT-SERVERS.NET.
    H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
    ;
    ; formerly NIC.NORDU.NET
    ;
    . 3600000 NS I.ROOT-SERVERS.NET.
    I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
    ;
    ; operated by VeriSign, Inc.
    ;
    . 3600000 NS J.ROOT-SERVERS.NET.
    J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30
    ;
    ; operated by RIPE NCC
    ;
    . 3600000 NS K.ROOT-SERVERS.NET.
    K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
    ;
    ; operated by ICANN
    ;
    . 3600000 NS L.ROOT-SERVERS.NET.
    L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12
    ;
    ; operated by WIDE
    ;
    . 3600000 NS M.ROOT-SERVERS.NET.
    M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
    ; End of File


    ★ db.sample.xxx
    ;;
    $TTL 3D
    ;;

    sample.xxx. IN SOA ns.sample.xxx. postmaster.sample.xxx. (
    2005012401 ; Serial
    28800 ; Refresh
    14400 ; Retry
    3600000 ; Expire
    38400 ) ; Minimum

    sample.xxx. IN NS ns.sample.xxx.
    sample.xxx. IN MX 10 mail.sample.xxx.
    ns.sample.xxx. IN A 172.16.10.11
    gw.sample.xxx. IN A 172.16.10.1
    localhost.sample.xxx. IN A 127.0.0.1

    ;******************TARO's HomeNetowork = sample.xxx**DMZ*****************


    taro-bsd IN A 172.16.10.11
    www IN PTR taro-bsd.sample.xxx.
    ftp IN PTR taro-bsd.sample.xxx.
    mail IN PTR taro-bsd.sample.xxx.
    pop IN PTR taro-bsd.sample.xxx.
    smtp IN PTR taro-bsd.sample.xxx.

    尚、ゾーンファイル内で、下記の定義をすると、DHCP よりホスト名が一定に定義される。

    $GENERATE
    ゾーンデータ中に
    $GENERATE 100-200 dhcp$ A 172.16.10.$
    ↓

    dhcp193 A 172.16.10.100
    dhcp194 A 172.16.10.101
    ・
    ・
    ・
    dhcp254 A 172.16.10.200
    と、展開される。
    ★ db.172.16.10
    ;;
    $TTL 3D
    ;;

    10.16.172.in-addr.arpa. IN SOA ns.sample.xxx. postmaster.sample.xxx. (
    2004112101 ; Serial
    28800 ; Refresh
    14400 ; Retry
    3600000 ; Expire
    38400 ) ; Minimum

    10.16.172.in-addr.arpa. IN NS ns.sample.xxx.
    11.10.16.172.in-addr.arpa. IN PTR ns.sample.xxx.
    1.10.16.172.in-addr.arpa. IN PTR gw.sample.xxx.

    $GENERATE 100-200 $ PTR dhcp$.sample.xxx.

    ★ db.localhost
    ;;
    $TTL 3D
    ;;

    localhost. IN SOA ns.sample.xxx. postmaster.sample.xxx. (
    2004112102 ; Serial
    28800 ; Refresh
    14400 ; Retry
    3600000 ; Expire
    38400 ) ; Minimum

    localhost. IN NS ns.sample.xxx.

    localhost. IN A 127.0.0.1

    ★ db.127.0.0
    ;;
    $TTL 3D
    ;;

    0.0.127.in-addr.arpa. IN SOA ns.sample.xxx. postmaster.sample.xxx. (
    2004112101 ; Serial
    28800 ; Refresh
    14400 ; Retry
    3600000 ; Expire
    38400 ) ; Minimum

    0.0.127.in-addr.arpa. IN NS ns.sample.xxx.

    1.0.0.127.in-addr.arpa. IN PTR localhost.

    ★ PROTO.localhost-v6.rev(v6対応予定)
    ; From: @(#)localhost.rev 5.1 (Berkeley) 6/30/90
    ; $FreeBSD: src/etc/namedb/PROTO.localhost-v6.rev,v 1.1.2.1 2002/02/04 18:24:21 ume Exp $
    ;
    ; This file is automatically edited by the `make-localhost' script in
    ; the /etc/namedb directory.
    ;

    $TTL 3600

    @ IN SOA @host@. root.@host@. (
    @date@ ; Serial
    3600 ; Refresh
    900 ; Retry
    3600000 ; Expire
    3600 ) ; Minimum
    IN NS @host@.
    IN PTR localhost.@domain@.


    4.Postfix + Qpopper + Drac + sasl2 + ClamAV + Amavis

    ※ インストールの順番重要
    これら、全て密接に関わるので、スペルミスなど気をつけるべし!!!

    Current Status
    ・POP/APOP OK(qpop.dbも引継ぎ済み)
    ・DRAC 多分OK
    ・POSTFIX dracd.dbが読めないっていう。
    ・SASL 認証はOk、Passwd登録で失敗するとだめ

    必要なInstall software
    ・db41-4.1.25_4
    ・cyrus-sasl-1.5.28_2
    ・drac-1.12
    ・postfix-2.5.5,1
    ・bind9-9.2.2
    ・apache-2.0.47
    以下、インストールに順番がある。
    下記の順にインストールすることで、整合性が保たれる。
    何度か失敗したが、下記の順番で問題無かった。

    ①.DB41(db41-4.1.25_4)のインストール
    ・なぜか、db3 でないとエラーが出たので、db3を使用

    portsでinstall

    # cd /usr/ports/databases/db41
    # make install clean

    これをはじめに入れておかないと何故か、Dracで作成されるDBがdb3_dump185で
    ないと読めなくなる

    ②.cyrus-sasl-2.1.22_2のインストール

    portsでinstall
    # cd /usr/ports/security/cyrus-sasl2
    # make install clean

    ③.postfixのインストール

    portsでinstall
    # cd /usr/ports/mail/postfix
    # make install clean
    # make WITH_SASL2=yes WITH_BDB=yes install clean


    Option画面で以下を選択
    [PCRE], [SASL2], [BDB]

    You already have a user "postfix", so I will use it.
    You need user "postfix" added to group "mail".
    Would you like me to add it [y]? y を入力

    Would you like to activate Postfix in /etc/mail/mailer.conf [n]? y を入力


    ■設定ファイル編集
    /usr/local/etc/postfix/main.cf

    command_directory = /usr/local/sbin
    daemon_directory = /usr/local/libexec/postfix
    sample_directory = /usr/local/etc/postfix
    manpage_directory = /usr/local/man
    readme_directory = no
    html_directory = no
    queue_directory = /var/spool/postfix
    mail_spool_directory = /var/mail
    mailq_path = /usr/local/bin/mailq
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    newaliases_path = /usr/local/bin/newaliases
    sendmail_path = /usr/local/sbin/sendmail
    inet_interfaces = all
    unknown_local_recipient_reject_code = 550
    mail_owner = postfix
    setgid_group = maildrop

    debug_peer_level = 2
    debugger_command =
    PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
    xxgdb $daemon_directory/$process_name $process_id & sleep 5

    # LocalSettings
    myhostname = mail.sample.xxx
    mydomain = sample.xxx
    myorigin = $mydomain
    mydestination = $mydomain, $myhostname, localhost.$mydomain
    header_checks = regexp:/usr/local/etc/postfix/header_checks
    maximal_queue_lifetime = 1d

    # MailBox & Sending Message Size
    mailbox_size_limit = 500000000
    message_size_limit = 150000000

    # SMTP RelayControl
    mynetworks = 10.10.10.10/32, 172.16.10.0/24, 127.0.0.0/8
    #relay_domains = $mydestination

    # SMTP Auth setting
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_local_domain = $mydomain
    smtpd_sasl_security_options = noanonymous, noplaintext

    # Sending Mail Restrictions
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_client_access btree:/usr/local/etc/dracd, reject_unauth_destination

    #AMAVIS + CLAM AntiVirus
    content_filter = smtp-amavis:[127.0.0.1]:10024


    ■SASLの連携
    mail# chgrp postfix sasldb.db
    mail# chmod 640 sasldb.db

    ■起動
    postfix start

    ■確認
    postconf -n

    <<SASL Passwd作成方法>>
    ・ユーザ追加
    saslpasswd2 -c -u sample.xxx hoge2

    ・ユーザ削除
    sasl2passwd2 -d hoge2

    ・一覧表示
    sasldblistusers2

    ■/etc/rc.conf編集
    sv01:/etc% less rc.conf
    # Inet Config
    hostname="sv01.sample.xxx"
    ifconfig_ed1="inet 10.10.10.10 netmask 255.255.255.0"
    defaultrouter="10.10.10.1"

    # System Config
    kern_securelevel_enable="NO"
    nfs_reserved_port_only="YES"
    keymap="jp.106"
    keyrate="fast"

    # Laptop Config
    apm_enable="YES"
    apmd_enable="YES"
    moused_enable="YES"
    moused_flags="-z 4"
    pccard_enable="YES"
    pccard_ifconfig="NO"
    pccard_mem="DEFAULT"
    pccardd_flags="-i 3"

    # Daemon Config
    sshd_enable="YES"
    #ddclient_enable ="YES"
    apache2_enable="YES"
    linux_enable="YES"
    named_enable="YES"
    named_program="/usr/local/sbin/named"
    named_flags="-c /etc/namedb/named.conf -u bind"

    # Mail Daemon Config
    inetd_enable="YES"
    inetd_flags="-wW"
    saslauthd1_enable="NO"
    portmap_enable="YES"
    dracd_enable="YES"
    dracd_flags="-i -e 10 /usr/local/etc/dracd.db"
    clamav_clamd_enable="YES"
    clamav_freshclam_enable="YES"
    amavisd_enable="YES"
    sendmail_enable="YES"
    sendmail_flags="-bd"
    sendmail_pidfile="/var/spool/postfix/pid/master.pid"
    sendmail_outbound_enable="NO"
    sendmail_submit_enable="NO"
    sendmail_msp_queue_enable="NO"

    # Etc...
    ntpdate_enable="YES"
    ntpdate_flags="-b ntp1.jst.mfeed.ad.jp"

    --------------------- Original Message Ends --------------------

    Installオプションを聞かれるので、Defaultのまま [OK]


    ④.Cyrus-sasl2-saslauthdのインストール

    portsでinstall
    # cd /usr/ports/security/cyrus-sasl2-saslauthd
    # make install clean


    ⑤.dovecotインストール

    portsでinstall
    # cd /usr/ports/mail/dovecot/
    # make install clean


    perl -MMIME::Base64 -e 'print encode_base64("hoge\0hoge\0password");'
    dGFybwB0YXJvAHRtMDIyMw==

    ■/etc/inetd.conf編集
    pop3 stream tcp nowait root /usr/local/libexec/qpopper -s -t /var/log/qpopper.log
    pop3 stream tcp6 nowait root /usr/local/libexec/qpopper -s -t /var/log/qpopper.log

    ■qapopauth DBの引継ぎ
    /usr/local/etc/qpopper/pop.auth.dbをコピーでOK


    <<APOP Passwd作成方法>>
    ・初回のみ実行
    qpopauth -init

    ・ユーザ追加
    qpopauth -user hoge

    ・ユーザ削除
    qpopauth -delete hoge

    ・一覧表示
    qpopauth -list ALL


    ⑦.ClamAV + Amavis 設定

    ●ClamAV インストール
    # cd /usr/ports/security/clamav
    # make
    # make install

    ・/usr/local/etc/Clamav.conf 設定
    LocalSocket /var/run/clamav/clamd.sock

    ・/etc/rc.conf 追加設定
    clamav_clamd_enable="YES"
    clamav_freshclam_enable="YES"


    起動してみる(clamd)

    # /usr/local/etc/rc.d/clamav-clamd.sh start
    # ps ax | grep clamd
    11682 ?? Ss 0:06.60 /usr/local/sbin/clamd

    ↑こんな感じ。


    起動してみる(freshclam)

    # /usr/local/etc/rc.d/clamav-freshclam.sh start
    # ps ax | grep freshclam
    11711 ?? Is 0:00.08 /usr/local/bin/freshclam --daemon

    ↑こんな感じ。


    ● amavis-new インストール
    # cd /usr/ports/security/amavisd-new
    # make
    # make install

    # cd /usr/local/etc
    # cp amavisd.conf-dist amavisd.conf
    # vi amavisd.conf


    @av_scanners = (

    # ### http://www.vanja.com/tools/sophie/
    # ['Sophie',
    # \&ask_daemon, ["{}/\n", '/var/run/sophie'],
    # qr/(?x)^ 0+ ( : | [\000\r\n]* $)/, qr/(?x)^ 1 ( : | [\000\r\n]* $)/,
    # qr/(?x)^ [-+]? \d+ : (.*?) [\000\r\n]* $/ ],

    # ### http://www.csupomona.edu/~henson/www/projects/SAVI-Perl/
    # ['Sophos SAVI', \&sophos_savi ],

    ### http://www.clamav.net/
    ['ClamAV-clamd',
    \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.sock"],
    qr/\bOK$/, qr/\bFOUND$/,
    qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
    # NOTE: run clamd under the same user as amavisd; match the socket
    # name (LocalSocket) in clamav.conf to the socket name in this entry
    # When running chrooted one may prefer: ["CONTSCAN {}\n","$MYHOME/clamd"],

    # ### http://www.clamav.net/ and CPAN (memory-hungry! clamd is preferred)
    # ['Mail::ClamAV', \&ask_clamav, "*", [0], [1], qr/^INFECTED: (.+)/],

    # ### http://www.openantivirus.org/
    # ['OpenAntiVirus ScannerDaemon (OAV)',
    # \&ask_daemon, ["SCAN {}\n", '127.0.0.1:8127'],
    # qr/^OK/, qr/^FOUND: /, qr/^FOUND: (.+)/ ],

    # ### http://www.vanja.com/tools/trophie/
    # ['Trophie',
    # \&ask_daemon, ["{}/\n", '/var/run/trophie'],
    # qr/(?x)^ 0+ ( : | [\000\r\n]* $)/, qr/(?x)^ 1 ( : | [\000\r\n]* $)/,


    更に追加
    $mydomain = 'foo.bar.domain';
    $forward_method = 'smtp:127.0.0.1:10025';
    $notify_method = $forward_method;
    $insert_received_line = 0;
    $DO_SYSLOG = 0;
    $LOGFILE = "/var/log/amavis/amavis.log";
    $hdr_encoding = 'iso-2022-jp';
    $bdy_encoding = 'iso-2022-jp';
    $final_virus_destiny = D_DISCARD;
    $final_banned_destiny = D_BOUNCE;
    $final_spam_destiny = D_DISCARD;
    $final_bad_header_destiny = D_PASS;
    $warnvirussender = 0;
    $warnspamsender = 0;
    $warnbannedsender = 0;


    さらに追加
    #$spam_admin = 'spamalert@$mydomain';
    $virus_admin = 'virusalert@$mydomain';

    Amavis インストール、設定後
    Camav.conf 修正

    # Run as a selected user (clamd must be started by root).
    # Default: disabled
    #User clamav
    User vscan


    Postfix 修正
    /usr/local/etc/postfix/main.cf
    content_filter = smtp-amavis:[127.0.0.1]:10024

    /usr/local/etc/postfix/master.cf
    smtp-amavis unix - - n - 2 smtp
    -o smtp_data_done_timeout=1200
    -o disable_dns_lookups=yes

    127.0.0.1:10025 inet n - n - - smtpd
    -o content_filter=
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o smtpd_restriction_classes=
    -o smtpd_client_restrictions=
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o mynetworks=127.0.0.0/8
    -o strict_rfc821_envelopes=yes
    /etc/rc.conf 追加
    amavisd_enable="YES"

    起動
    # /usr/local/etc/rc.d/clamav-clamd.sh start
    # /usr/local/etc/rc.d/amavisd.sh start

    # /usr/local/etc/rc.d/clamav-freshclam.sh start

    # postfix reload

    メールヘッダ確認
    X-Virus-Scanned: by amavisd-new at mail.foo.bar.domain



    5.Proftpd インストール手順

    ports から導入
    # cd /usr/ports/ftp/ProFTPD
    # make
    # make install


    /usr/local/etc/proftpd.conf の修正 [ /usr/local/etc/proftpd.conf.default ]
    #
    # To have more informations about Proftpd configuration
    # look at : http://www.proftpd.org/
    #
    # This is a basic ProFTPD configuration file (rename it to
    # 'proftpd.conf' for actual use. It establishes a single server
    # and a single anonymous login. It assumes that you have a user/group
    # "nobody" and "ftp" for normal operation and anon.

    ServerName "ProFTPD Default Installation"
    ServerType standalone
    DefaultServer on

    # Port 21 is the standard FTP port.
    Port 21
    # Umask 022 is a good standard umask to prevent new dirs and files
    # from being group and world writable.
    Umask 022

    # To prevent DoS attacks, set the maximum number of child processes
    # to 30. If you need to allow more than 30 concurrent connections
    # at once, simply increase this value. Note that this ONLY works
    # in standalone mode, in inetd mode you should use an inetd server
    # that allows you to limit maximum number of processes per service
    # (such as xinetd)
    MaxInstances 30

    # Set the user and group that the server normally runs at.
    User nobody
    Group nogroup

    # Normally, we want files to be overwriteable.
    <Directory /*>
    AllowOverwrite on
    </Directory>

    #########################################################################
    # #
    # Uncomment lines with only one # to allow basic anonymous access #
    # #
    #########################################################################
    ### A basic anonymous configuration, no upload directories.
    # <Anonymous ~ftp>
    # User ftp
    # Group ftp
    ### We want clients to be able to login with "anonymous" as well as "ftp"
    # UserAlias anonymous ftp

    ### Limit the maximum number of anonymous logins
    # MaxClients 10

    ### It is wise when making an 'ftp' user that you either block its
    ### ability to login either via /etc/login.access or my giving it
    ### an invalid shell.
    ### Uncomment this if the 'ftp' user you made has an invalid shell

    # RequireValidShell off

    ### We want 'welcome.msg' displayed at login, and '.message' displayed
    ### in each newly chdired directory.
    # DisplayLogin welcome.msg
    # DisplayFirstChdir .message

    ### Limit WRITE everywhere in the anonymous chroot
    # <Limit WRITE>
    # DenyAll
    # </Limit>

    # </Anonymous>



    6.MRTG + zlib + libpng + gd インストール

    ・zlib のインストール
    zlib-1.2.2.tar.gz の展開

    > cd ${WORK_DIRECTORY} ・・・ここでは、/usr/local/tool とした。
    > gunzip -c zlib-1.2.2.tar.gz | tar xf -
    > mv zlib-1.2.2/ zlib
    > cd ${WORK_DIRECTORY}/zlib
    > ./configure
    > make


    ・libpng のインストール
    libpng-1.2.8.tar.gz の展開

    > cd ${WORK_DIRECTORY}
    > gunzip -c libpng-1.2.8.tar.gz | tar xf -
    > mv libpng-1.2.8/ libpng
    > cd ${WORK_DIRECTORY}/libpng
    > make -f scripts/makefile.std CC=gcc ZLIBLIB=../zlib ZLIBINC=../zlib
    > cd ${WORK_DIRECTORY}/libpng
    > su
    # make -f scripts/makefile.std install


    ・gd のインストール
    gd-2.0.33.tar.gz の展開

    > cd ${WORK_DIRECTORY}
    > gunzip -c gd-2.0.33.tar.gz | tar xf -
    > mv gd-2.0.33/ gd
    > cd ${WORK_DIRECTORY}/gd
    > env CPPFLAGS="-I../zlib -I../libpng" LDFLAGS="-L../zlib -L.../libpng"
    ./configure --disable-shared --without-freetype --without-jpeg
    > cd ${WORK_DIRECTORY}/gd
    > make

    > cd ${WORK_DIRECTORY}/gd
    > su
    # cp .libs/* .


    ・MRTG のインストール
    mrtg-2.10.15.tar.gz の展開

    > cd ${WORK_DIRECTORY}
    > gunzip -c mrtg-2.10.15.tar.gz | tar xvf -

    > cd ${WORK_DIRECTORY}/mrtg-2.10.15
    > ./configure --prefix=${WORK_DIRECTORY}/mrtg-2
    --with-gd=${WORK_DIRECTORY}/gd
    --with-z=${WORK_DIRECTORY}/zlib
    --with-png=${WORK_DIRECTORY}/libpng

    > cd ${WORK_DIRECTORY}/mrtg-2.10.15
    > make

    > cd ${WORK_DIRECTORY}/mrtg-2.10.15
    > su
    # make install


    MRTG設定
    Vi /usr/local/etc/mrtg/mrtg.cfg
    #log :/usr/local/etc/mrtg% less mrtg.cfg
    #Include :/usr/local/etc/mrtg/main.cfg
    Include:/usr/local/etc/mrtg/taro-bsdtraffic.cfg
    #Include :/usr/local/etc/mrtg/taro-2000traffic.cfg

    /usr/local/sbin/cfgmaker COMMUNITY@172.16.10.11 > taro-bsdtraffic.cfg
    以下、同様に対象とするホストのcfgを作成できる。
    ※但し、今回はあくまで家庭用及び、拠点1なので、メインサーバのみとする。
    ※ホストを追加したい場合は、新たにcfgmakerで作成し、mrtg.cfg の中に、監視したいホストを追加する。
    /usr/local/sbin/indexmaker /usr/local/etc/mrtg/mrtg.cfg > /var/www/sslhtdocs/mrtg
    として、https://www.sample.xxx/mrtg にアクセスすると、作成したMRTGの画面を見れる。
    ちなみに、今回は、標準のとされている、5分ごとの更新を行うようにした。
    /etc/crontab に以下のように追加。
    */5 * * * * root /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
    より、綺麗に整理してhtmlを見たい場合、indexmaker を使用する。
    使い方は、それぞれのcfg を一つのファイルから読み取るようにする。


    7.Smokeping インストール

    PINGのRTTをグラフ化するツールとしてSmokePingがある。
    そもそもICMPのRTTで、実際のネットワークの遅延状況を計ることには微妙な事も多いが、目安としては大いに使えるため導入を行った。
    また、能動的にAlertメールを投げることもできるためその機能についても述べる。
    ■SmokePingの導入
    portsでInstallする。

    # cd /usr/ports/net/smokeping/
    # make install clean

    ■Apache設定変更
    CGIのファイルが、/usr/local/smokeping/htdocs/smokeping.cgi としてインストールされているので、ブラウザからアクセスできるようにapache のhttpd.conf を編集する。
    ●/usr/local/etc/apache2/httpd.conf
    ====ココカラ====
    Alias /smokeimg/ "/usr/local/smokeping/htdocs/img/"

    <Directory "/usr/local/smokeping/htdocs/img/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>

    ScriptAlias /smokeping.cgi "/usr/local/smokeping/htdocs/smokeping.cgi"

    <Directory "/usr/local/smokeping/htdocs/smokeping.cgi">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
    </Directory>
    ====ココマデ====

    ■SmokePing設定変更
    /usr/local/etc/smokeping/configの設定変更を実施する。
    log:/usr/local/etc/smokeping% less config
    # Note that all IP addresses in this file are false, to prevent some
    # machine falling uder a deadly DOS storm because all users keep
    # the same addresses in their config.

    *** General ***
    owner = HOGEHOGE                 # Ownerの氏名を記入
    contact = hoge@sample.xxx           # Ownerのメールアドレスを記入
    mailhost = mail.sample.xxx           # Mailサーバの指定
    sendmail = /usr/sbin/sendmail # メールコマンドのパス
    imgcache = /usr/local/smokeping/htdocs/img # SmokePingのIMG図(デフォルト)
    imgurl = /smokeimg # SmokePingのIMG図(デフォルト)
    datadir = /usr/local/smokeping/var # データ格納場所(デフォルト)
    piddir = /usr/local/smokeping/var # PIDファイル格納場所(デフォルト)
    cgiurl = https://sample.xxx/smokeping.cgi # SmokePingのCGIディレクトリ
    smokemail = /usr/local/etc/smokeping/smokemail # Alertメール使用コマンド(デフォルト)
    # specify this to get syslog logging
    syslogfacility = local7


    *** Alerts ***
    to = monitor@sample.xxx                 # Alertメールの送り先
    from = smokealert@sample.xxx            # Alertメール送信時のFrom

    +bigloss # Alert検出時のトリガ定義
    type = loss
    # in percent
    pattern = ==0%,==0%,==0%,==0%,>0%,>0%,>0%
    comment = suddenly there is packet loss

    +someloss # Alert検出時のトリガ定義
    type = loss
    # in percent
    pattern = >0%,*12*,>0%,*12*,>0%
    comment = loss 3 times in a row

    +startloss # Alert検出時のトリガ定義
    type = loss
    # in percent
    pattern = ==S,>0%,>0%,>0%
    comment = loss at startup

    +rttdetect # Alert検出時のトリガ定義
    type = rtt
    # in milli seconds
    pattern = <10,<10,<10,<10,<10,<100,>100,>100,>100
    comment = routing mesed up again ?

    *** Database ***

    step = 300 # 周期
    pings = 20 # Ping回数

    # consfn mrhb steps total

    AVERAGE 0.5 1 1008
    AVERAGE 0.5 12 4320
    MIN 0.5 12 4320
    MAX 0.5 12 4320
    AVERAGE 0.5 144 720
    MAX 0.5 144 720
    MIN 0.5 144 720

    *** Presentation ***

    template = /usr/local/etc/smokeping/basepage.html

    + overview

    width = 600
    height = 50
    range = 10h

    + detail

    width = 600
    height = 200
    unison_tolerance = 2

    "Last 3 Hours" 3h
    "Last 30 Hours" 30h
    "Last 10 Days" 10d
    "Last 400 Days" 400d

    *** Probes ***

    + FPing

    binary = /usr/local/sbin/fping

    *** Targets *** # 監視対象

    probe = FPing

    menu = Top
    title = Network Latency Grapher
    remark = Welcome to the SmokePing website of HOGESAITE. \
    Here you will learn all about the latency of our network.

    + All # 監視対象を記述する
    # +の数でディレクトリ構造を意味している。
    menu = All # menuは左フレームのメニュー画面に表示させる文字
    title = Worldwide Connectivity # titleはメイン画面に表示させる文字列

    ++ HOGENET_Internal

    menu = HOGENET_Internal
    title =Intra Connectivity

    +++ HOGENET2

    menu = HOGENET2r
    title =Intra Connectivity
    alerts = bigloss,someloss,startloss # 監視する項目を設定

    ++++ sv01

    menu = sv01.sample.xxx
    title = DNS Server
    host = sv01.sample.xxx                   # host欄にて被監視対象を記載


    ++++ sv02

    menu = sv02.sample.xxx
    title = Mail Server
    host = sv02.sample.xxx

    ++++ sv03

    menu = sv03.sample.xxx
    title = WWW Server
    host = sv03.sample.xxx

    ここまでで、SmokePingの設定は完了となる。

    ■SmokePingの起動
    設定まで完了したら、SmokePingを動作させる。

    # cd /usr/local/etc/rc.d/smokeping.sh start (SmokePing起動)
    # cd /usr/local/etc/rc.d/smokeping.sh stop (SmokePing停止)
    # cd /usr/local/etc/rc.d/smokeping.sh restart (SmokePing再起動)
    プロセスが確認できたらSmokePingが稼動している。

    この状態で以下のURLにアクセスすることで、SmokePingが表示される。
    https://www.sample.xxx/smokeping.cgi


    8.BigBrother のインストール

    BigBrotherのInstall
    ここからは統合監視ツールであるBigBrotherの導入について説明する。
    BigBrotherについては、商用版と非商用版があるが、ここでは清水が個人的にInstallしているという解釈の元、非商用版を使用している。
    ■Sourceの入手、展開
    Sourceを以下より取得する。

    http://www.bb4.org/download.html

    ユーザ登録が必要となるが、適当に登録する。
    クリックすると、「No-Commercial License Agreement」のページが出れば、そこが非商用版のダウンロードページです。右のほうにある「YES」のリンクをクリックすればダウンロードできます。

    http://www.bb4.org/cgi-bin/ndnld.pl

    展開します。

    > tar xvfz bb-1.9e.tar.gz
    > tar xvf BBSVR-bb1.9e-btf.tar

    すると、bb1.9e-btf/というディレクトリができています。
    ■bbユーザの作成
    ホームディレクトリを/home/bbとし、BigBrother用のユーザを作成します。

    ・vipw
    ====ココカラ====
    bb:*:5000:5000::0:0:BigBrother Network Monitoring System:/home/bb:/bin/tcsh
    ====ココマデ====

    ・/etc/group編集
    ====ココカラ====
    bb:*:5000:
    ====ココマデ====

    ・ホームディレクトリ作成
    # mkdir /home/bb
    # chown -R bb:bb /home/bb
    ■BigBrotherのInstall
    上記bb1.9e-btf/を/home/bb以下に移動し、オーナーを変更します。

    # mv -i bb1.9e-btf /home/bb/
    # chown -R bb:bb /home/bb/bb1.9e-btf

    bb1.9e-btf内installディレクトリにて各種設定を実施します。

    # cd /home/bb/bb1.9e-btf/install
    # ./bbconfig freebsd

    以下各質問についてそれぞれ回答
    >Do you agree to the terms of this license (y/n): y [y]を選択
    >What will be the user ID for BB [bb]: [bb]を入力
    >Use FQDN (y/n): [y] [y]を入力
    >What host will be the BBDISPLAY [taro-bsd.sample.xxx]: [taro-bsd.sample.xxx]を入力
    >What host will be the BBPAGER [taro-bsd.sample.xxx]: [taro-bsd.sample.xxx]を入力
    >Is this host a BBDISPLAY host (y/n): [y] [y]を入力
    >Is this host a BBPAGER host (y/n): [y] [y]を入力
    >Enter the default e-mail address to send notifications to: [root@www.sample.xxx] [root@taro-bsd.sample.xxx]を入力
    >Enter the base URL for BB [/bb]: [/bb]を入力
    >Enter CGI directory [/home/www/httpd/cgi-bin]: [/var/www/cgi-bin]を入力
    >Enter the base URL of the CGI scripts [/cgi-bin]: [/cgi-bin]を入力
    >Enter web server user id [nobody]: [www]を入力
    >Enter group name [www]: [www]を入力

    ディレクトリを移り、コンパイル・インストールを実施します。
    # chown -R bb /home/bb/bbvar /home/bb/bb1.9e-btf
    # su - bb

    # cd /home/bb/bb1.9e-btf/src
    # make
    # make install
    ■環境変数の設定
    以下環境変数を設定します。

    /home/bb/.cshrcを編集
    setenv BBHOME /home/bb/bb1.9e-btf
    setenv BBACKS /home/bb/bbvar/acks
    setenv BBDATA /home/bb/bbvar/data
    setenv BBDISABLED /home/bb/bbvar/disabled
    setenv BBHIST /home/bb/bbvar/hist
    setenv BBHISTLOGS /home/bb/bbvar/histlogs
    setenv BBLOGS /home/bb/bbvar/logs

    環境変数の再読み込みを実施します。

    # source .cshrc


    ■Apache設定変更
    /home/bb/bb1.9e-btf/www/を/bb/でアクセスできるようにApacheの設定変更を実施する

    /usr/local/etc/apache2/httpd.conf
    ====ココカラ====
    ## Aliases Settings For BigBrother
    Alias /bb/ "/home/bb/bb1.9e-btf/www/"

    <Directory "/home/bb/bb1.9e-btf/www/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
    ====ココマデ====


    ■監視対象の登録
    /home/bb/bb1.9e-btf/etc/bb-hostsに監視対象を登録する。
    log:~/bb1.9e-btf/etc% less bb-hosts
    #
    # THE BIG BROTHER HOSTS FILE
    #
    # THIS FILE SHOULD BE THE SAME ON ALL SYSTEMS RUNNING BIG BROTHER
    # CHANGE THIS FILE TO REFLECT YOUR ENVIRONMENT!
    #

    # IPアドレス Hostname(表示上) # サービス、監視項目
    xxx.xxx.xxx.xxx hoge.sample.xxx # BBPAGER BBNET BBDISPLAY ##このHostではBigBrotherを動作させている
    xxx.xxx.xxx.xxx sv01.sample.xxx      # dns smtp ssh ## pingとdnsとsmtpとsshの監視を実施
    xxx.xxx.xxx.xxx sv02.sample.xxx      # smtp dns ssh ## pingとsmtpとdnsとsshの監視を実施
    xxx.xxx.xxx.xxx sv03.sample.xxx      # http://www.sample.xxx ftp ssh ## http://sample.xxxの死活、FTP、SSHの監視を実施
    ## なお何もない場合でもpingの監視は実施する
    ## また、監視項目に!を付けると、
    ## Downしている状態が正しい物として監視を行う
    今稼動させているものはこれ
    メモ:表示画面のグループ化とページ化(bb-hosts)

    監視対象が増加すると1画面に表示しきれなくなります。
    そうなると、稼動状況の把握がしづらくなってしまいます。
    これを解消するために、監視対象のグルーピングとページ分割をする機能があります。

    bb-hostsファイルにタグを設定することにより、利用できます。

    グループ化
    group(group-compress) <グループ名>

    このタグが指定してある行より下の監視対象を1つのグループとしてまとめて表示されます。
    <グループ名>の部分には、グループの表示名称を記述します。
    また、htmlタグの指定が可能です。(<B></B>など)

    ※group指定はbb-hostsファイルで設定されているすべての監視項目が表示されますが、
    group-compressを指定した場合は、グループ化したホスト上で監視項目に設定されていない
    ものは省略されます。監視しないサービスが表示されていても、あまり意味はないので、
    group-compressを使用したほうが良いと思います。

    ページ化
    page <ページ名> <ページタイトル>

    このタグが指定してある行より下の監視対象をサブページにまとめます。
    サブページのhtmlファイルのタイトル名を<ページ名>に指定します。
    サブページの表示名称を<ページタイトル>に記述します。
    また、<ページタイトル>の部分は、htmlタグの指定が可能です。

    ※グループ化のやページ化の指定が有効な範囲は、次に、グループ化やページ化の指定が
    あらわれるまでです。

    下記にbb-hostsファイルの例を示します。

    --------------------------------------------------------------------------
    #
    # THE BIG BROTHER HOSTS FILE
    #
    # THIS FILE SHOULD BE THE SAME ON ALL SYSTEMS RUNNING BIG BROTHER
    # CHANGE THIS FILE TO REFLECT YOUR ENVIRONMENT!
    #
    192.168.0.1 server1

    group-compress <B>Subnet1</B>
    172.16.0.1 server2
    172.16.0.2 server3

    group-compress <B>Subnet2</B>
    172.17.0.1 server4
    172.17.0.2 server5

    page sisya1 <H3><I>sisya1</I><H3>
    group-compress <B>Subnet1</B>
    10.0.0.1 sisya1-server1
    10.0.0.2 sisya1-server2

    group-compress <B>Subnet2</B>
    10.0.1.1 sisya1-server3
    10.0.1.2 sisya1-server4

    page sisya2 <H3><I>sisya2</I><H3>
    group-compress <B>Subnet1</B>
    10.1.0.1 sisya2-server1
    10.1.0.2 sisya2-server2

    group-compress <B>Subnet2</B>
    10.1.1.1 sisya2-server3
    10.1.1.2 sisya2-server4

    ---------------------------------------------------------------------------

    上記のようにbb-hostsファイルを設定すると、メインページと2つのサブページができ、
    それぞれ、グループが2つずつできます。
    出力先は、下記のようになります。

    メインページ
    http://localhost/bb/bb.html

    サブページ(sisya1)
    http://localhost/bb/sisya1.html

    サブページ(sisya2)
    http://localhost/bb/sisya2.html

    ページ化を指定した場合の監視

    ページ化を指定するとサブページができます。
    このサブページの稼動状況は、メインページにまとめられて、表示されます。
    サブページのアイコンの一つでも、異常な状態(yellow、red、purple)になった場合は、
    メインページのアイコンに反映されます。

    ■BigBrotherの起動
    付属のスクリプトでBigBrotherを起動する。
    # su - bb -c "/home/bb/bb1.9e-btf/runbb.sh start"

    以下のURLで対象が閲覧できればOK

    http://www.sample.xxx/bb/
    ■監視項目の削除方法
    上記の/home/bb/bb1.9e-btf/etc/bb-hostsの記述を消せば、監視項目は消滅するが過去のログなどが残ってしまうため、以下のコマンド実行により削除操作が必要

    # /home/bb/bb1.9e-btf/bin/bbrm "Hostname" (service)

    serviceについては省略も可。その場合は該当するHostnameで監視していたすべての項目について削除される。
    ■障害内容のメール通知機能
    BigBrotherでは障害検知時にメールなどで通知する機能を備えている。
    その機能の設定方法は以下の通り
    log:~/bb1.9e-btf/etc% less bbwarnsetup.cfg

    # bbwarnsetup.cfg
    #
    (途中省略)
    pagerecovered: TRUE # 障害が復旧した場合にもメールを送信する
    pagetype: EVENT # Alertメールを飛ばす区分 EVENTの場合はイベント毎
    pagemaster: hoge@sample.xxx # Alertメールの送り先
    pagedelay: 15 # 障害の再通知を何分間隔で行うのかを設定


    log:~/bb1.9e-btf/etc% less bbwarnrules.cfg
    #
    # bbwarnrules.cfg
    #
    (途中省略)
    *;;*;;*;*;hoge@sample.xxx    # すべてのHost/イベントに対する通知を常に行う
    : ※1
    unmatched-*;;*;;*;*;hoge@sample.xxx  # それまでの条件に一致しなかった場合の送付先

    ※1: ここにはHost単位で送付先を変えたり、送付する時間を変えたりなどの設定が可能
    メモ: bbwarnrules.cfgファイル書式説明

    下記のようなレコード形式によって、監視対象や監視時間などの設定を行います。

    hosts;exhosts;services;exservices;day;time;recipients

    hosts:ホストの指定
    exhosts:除外するホストの指定
    services:サービスの指定
    exservices:除外するサービスの指定
    day:曜日の指定 0~6(日曜日~土曜日)
    time:時間の指定 0000~2359
    recipients:通知先メールアドレス

    ホストやサービス、曜日、時間の指定には*(アスタリスク)を使用したワイルドカードの設定も可能です。
    また、通知先メールアドレスにはエスカレーション設定が出来ます。

    エスカレーション設定は、障害が発生してから時間が経過するにつれて通知先を変えていくものです。
    例えば、障害が発生してから1時間以上経過した場合は責任者に通知し、2時間以上経過した場合は、もっと上の責任者に通知するなどです。
    それほど重要ではないサービスについて再通知の間隔を長くするといった設定も出来ます。

    レコード形式は下記のようになります。
    recipiensts:^xx-yy

    ^xx:初期の通知のインターバル指定
    -yy:再通知の間隔指定。指定がない場合は、bbwarnsetup.cfgファイルで指定したpagedelayの値。

    障害が1時間以上続いた時は、rootユーザーに1時間間隔で通知をし、2時間以上続いた時は、root2ユーザーに2時間間隔で通知をするという設定をするには下記のようにします。

    recipients:root@localhosts^60-60 root2@localhosts^120-120

    bbwarnrules.cfgファイルのサンプル

    router*;;*;1-5;0800-1800;root@localhost
    web*;;*;1-5;0000-0159 0800-2359;root@localhost
    mail*;;*;;*;*;root@localhost root2@localhost^60-60
    *;;*;;*;*;root@localhost
    unmatched-*;;*;;*;*;root@localhost

    ホスト名称router*については平日8時から18時まで間、監視を行い、障害の場合は、root@localhostに通知を行う。
    ホスト名称web*については平日2時から7時59分を除く時間帯を監視し、障害の場合は、root@localhostに通知を行う。
    ホスト名称mail*については24時間365日監視を行い、障害の場合は、root@localhostに通知を行い、障害発生から1時間を経過した場合は、1時間置きにroot2@localhostに通知を行う。
    ホスト名称が上記以外のものについては、24時間365日監視を行い、障害の場合は、root@localhostに通知を行う。
    また、unmatched-*指定はbb-hostsファイルに定義されていないが、障害通知がされる場合の指定になります。

    これは、一度bb-hostsファイルに設定をし、監視を行っていたホストを監視対象からはずす際に、bb-hostsファイルから削除したときなどに起こる現象です。

    BBは障害のログをはきだしているので、このログを削除しなければunmatched-*に指定された
    通知先に障害が通知され、ログと整合性が取れなくなって画面が紫色になってしまいます。
    このような事態を避けるため、BBにはメンテナンス用のユーティリティが用意されています。

    /home/bb/bb19c/binディレクトリにあるbbrmユーティリティです。

    使用方法は下記のようになります。

    bbrm 監視対象ホスト名

    このユーティリティにより、/home/bb/bbvarディレクトリに保存されている障害ログなどを削除することが出来ます。
    ■MRTGとの連携
    以下のURLよりBigBrotherとMRTGを連携させるスクリプトを入手する。

    http://www.deadcat.net/download.php?fileid=878&filename=bbmrtg-1.6.tar.gz&location=36

    上記スクリプトを展開し、出来上がったbbmrtg-1.6.plを/home/bb/bb1.9e-btf/extディレクトリにコピーし、モードを変更します。

    # cp bbmrtg-1.6.pl /home/bb/bb1.9e-btf/ext/
    # chmod 700 /home/bb/bb1.9e-btf/ext/bbmrtg-1.6.pl
    # chown bb /home/bb/bb1.9e-btf/ext/bbmrtg-1.6.pl



    9.Rrdtool + HotSaNic インストール

     RRDTOOLのインストール

    cd /usr/ports/net/rrdtool
    make install clean

    バイナリが/usr/local/bin/rrdtool にインストールされます。
     ImageMagick(convert)のインストール

    RRDTOOLで作成された画像を変換するのにImageMagickに含まれる convertというモジュールが後ほど必要となります。必要なモジュールだけインストールした方がいいのですが、面倒なのですべてインストールしました。(結構サイズがでかいです・・)

    cd /usr/ports/graphics/ImageMagick/
    make install clean

    途中、GNU Ghostscript driverのコンフィグが出てくるので、要らないプリンターなどのドライバは選択を解除します。
     HotSaNICのインストール

    任意の場所にインストールします。
    ここでは、/usr/local/HotSaNic となるように、以下で展開。
    su
    cd /usr/local
    tar zxvf HotSaNIC-0.4.0.tgz
    cd HotSaNIC

    HotSaNICの設定
     セットアップ

    セットアップツールがあるので、動かします。

    ./setup.pl

    グラフを作成する項目を選んでいくのですが、どんなのが動くか分からないので、とりあえず全部 "y" にして、NICのところだけ考えて答えていけばいいと思います。

    setup.plが終了すると、今選んだ項目が反映されたsettingsファイルが出来るので、詳細をさらに編集します。

    Setting 参照 ← 私はこんな感じにしましたが、まだこの段階では、”RUN","SHOW","ORDER"の各項目は編集しないでおきます。


    settingsの編集が終わったら、インデックスの作成とサムネイル画像の作成をします。

    ./makeindex.pl
    ./rrdtimer -i
    ./convert.pl ← サムネイル画像の作成
     デーモンを動かす

    ./rrdgraph start

    暫くすると画像が出来ているはずですので、settings のWEBDIRで指定した URLにアクセスしてみます。

    私の環境ではtraffic,system,partの三つしか画像が出来ていませんでした。とりあえずこれだけあれば十分なので、他の項目は設定から削除することにします。
    settingsファイルを開いて、"RUN","SHOW","ORDER"から不要な項目を削除します。

    その他、FreeBSD特有のバグ対応などを行いました。

    1)曜日の文字化け修正
     ⇒rrdgraphを編集
    最初の方に次の2行を追加

    LC_TIME="abday"
    export LC_TIME

    ./makeindex.pl; ./rrdtimer -i

    としてインデックスを作り直した後、デーモンを再起動します。

    ./rrdgraph stop; ./rrdgraph start

    これで曜日の表示は治ると思いますが、rrdgraph起動時に下記のようなエラーが出る場合は、「LC_TIME="abday"」の上あたりに次のPERL_BADLANGの記述をします。(岩澤信康さん情報有り難うございます。)

    PERL_BADLANG=0
    export PERL_BADLANG
    Starting rrdtimer...
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
        LC_ALL = (unset),
        LC_TIME = "abday",
        LC_CTYPE = "ja_JP.EUC",
        LANG = "ja_JP.EUC"
      are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    reading & checking config (/usr/local/HotSaNIC/settings) ...
    evaluating cmdline arguments...
    entering daemon mode...

    2)swapのグラフが出ないのを修正
     ⇒data-system/read-data.plを編集
    343行目あたりから、
    open(IN,"/usr/sbin/pstat -sk|");
    while(<IN>) {
    if (/TOTAL/) { (undef, undef, $swpuse, $swpfre) = split; last; }
    }
    という行があるはずです。

    ここを自分の環境に合わせます。
    私の場合は、
    % pstat -sk
    Device 1K-blocks Used Avail Capacity Type
    /dev/ad0s1b 786304 8 786296 0% Interleaved
    という結果でしたので、下記のように変更しました。
    旧) if (/TOTAL/) { (undef, undef, $swpuse, $swpfre) = split; last; }
           ↓
    新) if (/\/dev\//) { (undef, undef, $swpuse, $swpfre) = split; last; }

    以上で、log/HotSaNIC.errに出ていた、
    Use of uninitialized value at ./read-data.pl line 348, <IN> chunk 2.
    Use of uninitialized value at ./read-data.pl line 349, <IN> chunk 2.
    というエラーも消えるはずです。
    3)trafficの縦軸をbytesからbitsに変更
     ⇒data-traffic/settingsを編集

    4)CPUの縦軸を%表示に変更
     ⇒data-system/settingsを編集

    5)cpu usageのidleとinterruptが逆
     ⇒data-system/read-data.plを編集(70行目あたり)
      $cpu4{$cpu}=$cpu4;
      $cpu5{$cpu}=$cpu5;
     ⇒data-system/diagramsを編集(205行目あたり)
      STACK:nicavg#00ff00:"nice" \
      STACK:idlavg#ffff00:"idle" \
     /usr/local/etc/rc.d に登録

    cd /usr/local/etc/rc.d
    su
    vi /usr/local/etc/rc.d/HotSaNIC.sh
    #!/bin/sh

    case "$1" in
    start)
    [ -x /usr/local/HotSaNIC/rrdgraph ] && /usr/local/HotSaNIC/rrdgraph start
    ;;
    stop)
    /usr/local/HotSaNIC/rrdgraph stop
    ;;
    *)
    echo "Usage: `basename $0` {start|stop}" >&2
    ;;
    esac

    exit 0
    chmod 755 ./HotSaNIC.sh


    10.Perl バージョンアップ

    perlバージョンアップ
    # cd /usr/ports/lang/perl5.8
    # make install clean
    # rehash
    # use.perl port

    # perl -v

    (注)エラー対応
    1.以下のエラーが出たためSNMP_Session-1.0.3.pm をインストール
    # /usr/local/bin/mrtg /usr/local/etc/mrtg.cfg
    SNMP_util 1.03 required--this is only version 0.89 (/usr/local/lib/perl5/site_perl/5.6.1/SNMP_util.pm) at /usr/local/lib/perl5/site_perl/5.6.1/MRTG_lib.pm line 20
    BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.6.1/MRTG_lib.pm line 20.
    Compilation failed in require at /usr/local/bin/mrtg line 84.
    BEGIN failed--compilation aborted at /usr/local/bin/mrtg line 84.
    2.ソース取得
    % wget ftp://ftp.switch.ch/software/sources/network/snmp/perl/SNMP_Session-1.03.tar.gz
    3.インストール
    % gzip -dc SNMP_Session-1.03.tar.gz
    % cd SNMP_Session-1.03
    % /usr/local/bin/perl Makefile.PL
    % make
    # make install


    11.Webalizer インストール

    =================================================
    | (1) portsでwebalizerをインストール
    | ==================================================
    |
    | # cd /usr/ports/japanese/webalizer
    | # make clean
    | ===> Cleaning for libiconv-1.9.2_1
    | ===> Cleaning for gettext-0.13.1_1
    | ===> Cleaning for gmake-3.80_2
    | ===> Cleaning for libtool-1.3.5_2
    | ===> Cleaning for libtool-1.5.10
    | ===> Cleaning for gd-2.0.28,1
    | ===> Cleaning for jpeg-6b_3
    | ===> Cleaning for png-1.2.7
    | ===> Cleaning for freetype2-2.1.7_3
    | ===> Cleaning for expat-1.95.8
    | ===> Cleaning for ja-webalizer-2.1.10_5
    |
    | # make WITH_WEBALIZER_CONV=yes install clean
    |
    |
    | ==================================================
    | (2) configファイルの設定
    | ==================================================
    |
    | # cd /usr/local/etc
    | # cp ja-webalizer.conf-dist webalizer.conf
    | # ee webalizer.conf
    |
    | -----------------------------------------------------
    | LogFile /var/log/httpd-access.log
    | OutputDir /var/www/htdocs/webalizer
    | Incremental yes
    | HostName www.sample.xxx
    | PageType php
    | DNSCache dns_cache.db
    | DNSChildren 15
    | GraphLines 6
    |
    | HTMLHead <META NAME="author" CONTENT="The Webalizer">
    |HTMLHead <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=x-euc-jp">
    | -----------------------------------------------------
    |
    |
    | ==================================================
    | (3) htaccessでアクセス制限の設定
    | ==================================================
    |
    | # mkdir /var/www/htdocs/webalizer
    | # ee .htaccess
    |
    | -----------------------------------------------------
    | AuthType Basic
    | AuthName "Please enter username and password"
    | AuthUserFile /var/www/htdocs/webalizer/.htpasswd
    | AuthGroupFile /dev/null
    |
    | require valid-user
    | -----------------------------------------------------
    |
    | # /usr/local/apache2/bin/htpasswd -c .htpasswd wwwmaster
    |
    | パスワードは、wwwmasterで使っているものに設定
    |
    |
    | ==============================================================
    | (4) crontabの設定
    | ==============================================================
    |
    | # ee /etc/crontab
    | -----------------------------------------------------
    | # webalizer added by ezura
    | 0 0 * * * root /usr/local/bin/ja-webalizer -c /usr/local/etc/webalizer.conf
    | -----------------------------------------------------

    確認 ps ax | grep webalizer
    /usr/local/bin/ja-webalizer –c /usr/local/etc/webalizer.conf

    Apache2 で作成するaccess.log をかませば、通常htmlファイルが作成され動作する。
    作成されなければ、httpd との矛盾があると思われるので、両方のconfig を確認。
    また、今回は、80,443 共に同じlogを参照している。分ける場合は、httpd.conf と ssl.conf のlog を吐き出すように設定し、webalizer.conf も両パターン作成し、cronでまわせばよろし!


    12.Nagios インストール

    1. Webサーバ(apache が好ましい - ここではapacheとしてご説明いたします)
    2. gd ライブラリ 1.6.3 以上
    ________________________________________

    nagiosプロセスを走らせるユーザ(nagios)、及びグループ(nagios)を追加します。

    nagios-1.1.tar.gz をダウンロード
    tar zxf nagios-1.1.tar.gz
    cd nagios-1.1.tar.gz
    ./configure
    make all
    ここで Makefile の一行を変更する。
    (root グループが存在する場合、この作業は必要ありません)
    INIT_OPTS=-o root -g root
    ↓
    INIT_OPTS=-o root -g wheel

    make install
    make install-init
    make install-config
    これで /usr/local/nagios/ というディレクトリが作られ、実行ファイル、設定ファイル、HTMLファイル等が作られます。
    /usr/local/nagios/bin/ nagios 本体が格納されています。
    /usr/local/nagios/etc/ 設定ファイルが格納されています。
    /usr/local/nagios/sbin/ cgi ファイルが格納されています。
    /usr/local/nagios/share/ HTML ファイル等が格納されています。
    /usr/local/nagios/var/ ログ等が格納されています。

    nagios-plugins-1.3.1.tar.gz をダウンロード
    tar zxf nagios-plugins-1.3.1
    cd nagios-plugins-1.3.1
    ./configure
    make
    make install
    これで /usr/local/nagios/libexec/ 以下にプラグインがインストールされます。
    ※ Nagios はこのプラグインを利用してチェックを行うため、プラグインをインストールしなければなりません。

    設定ファイルは、予めサンプルファイルが用意されていますので、それをコピーして適宜編集します。
    cd /usr/local/nagios/etc/
    ls
      cgi.cfg-sample dependencies.cfg-sample misccommands.cfg-sample timeperiods.cfg-sample
      checkcommands.cfg-sample escalations.cfg-sample nagios.cfg-sample
      contactgroups.cfg-sample hostgroups.cfg-sample resource.cfg-sample
      contacts.cfg-sample hosts.cfg-sample services.cfg-sample

    各ファイルから「-sample」部分を除いてコピーします。
    sh系 の場合
    # for i in *
    > do
    > cp $i `echo $i | sed s/-sample//`
    > done

    csh系 の場合
    # foreach i (*)
    > cp $i `echo $i | sed s/-sample//`
    > end

    mkdir sample
    mv *-sample sample/
    ls
      cgi.cfg dependencies.cfg misccommands.cfg timeperiods.cfg
      checkcommands.cfg escalations.cfg nagios.cfg sample
      contactgroups.cfg hostgroups.cfg resource.cfg
      contacts.cfg hosts.cfg services.cfg

    設定の変更が必要のないファイル
     以下のファイルは初期設定のままお使いください。
    cgi.cfg
    checkcommands.cfg
    nagios.cfg
    resource.cfg
    timeperiods.cfg

    全てコメントアウトするファイル
     以下のファイルは全ての行をコメントアウトしてお使いください。
    escalations.cfg
    dependencies.cfg

    設定変更が必要なファイル
     以下のファイルの設定例がリンク先にございますのでそのままコピーしてください。
     cfgファイルはダウンロードして、そのままお使いいただけます。
    contacts.cfg(HTML)
    contacts.cfg(cfgファイル)


    contactgroups.cfg(HTML)
    contactgroups.cfg(cfgファイル)


    hosts.cfg(HTML)
    hosts.cfg(cfgファイル)


    hostgroups.cfg(HTML)
    hostgroups.cfg(cfgファイル)


    services.cfg(HTML)
    services.cfg(cfgファイル)


    設定ファイルを修正したら、設定にエラーがないか確認します。
    /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
     Total Warnings: 0
     Total Errors: 0
    上記のように Errors が 0 であれば nagios を起動することが出来ます。
    もし、0 でない場合、間違っている箇所がありますので、設定ファイルをご確認ください。

    適当な場所へ apache のパスワードファイルを作成します。
    cd /usr/local/nagios/etc/
    htpasswd -c .htpasswd adm
     New password:
     Re-type new password:
     Adding password for user adm
    httpd.conf を編集。以下の行を追加します。
    ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/
    Alias /nagios/ /usr/local/nagios/share/
    <Directory "/usr/local/nagios/">
    AuthName Nagios
    AuthType basic
    AuthUserFile /usr/local/nagios/etc/.htpasswd
    require valid-user
    </Directory>
    apache を再起動します。
    apachectl restart

    /usr/local/etc/rc.d/nagios start
    /usr/local/etc/rc.d/以下に nagios という起動スクリプトが出来ていますが
    nagios.sh と言う名前に変更しないと起動時に実行されません。


    http://www.your.domain/nagios/
    www.your.domain をあなたのWebサーバのURLに適宜変更してください。
    上記のURLへアクセスすると、apacheの認証画面が現れます。
    認証を通ると以下のような nagios の画面を見ることが出来ます。


    13.Analog6 インストール

    • ports でインストール
    • cd /usr/ports/www/analog
    • make
    • make install
    • /usr/local/etc/analog.cfg の設定
    • LOGFORMAT COMBINED
    • LOGFILE /var/www/log/http-access.log
    • LANGUAGE JAPANESE
    • LANGFILE /usr/local/share/analog/lang/jpe.lng
    • DESCFILE /usr/local/share/analog/lang/jpedesc.txt
    • DOMAINSFILE /usr/local/share/analog/lang/jpedom.tab
    • IMAGEDIR ./images/
    • OUTFILE /var/www/sslhtdocs/analog/index.html
    • HOSTNAME "[MyDomain.]"
    • #
    • FILEEXCLUDE .gif
    • FILEEXCLUDE .jpg
    • FILEEXCLUDE .png
    • FILEEXCLUDE .css
    # /usr/local/bin/analog を実行すれば、analog のログ画面が表示される。
    また、定期的に実行し、analog の出力を動的に記録する場合は、/etc/crontab に追加。



    14.namazu のインストール・設定

    ※ Apache にて、CGI の動作は可能となっている状態が前提。

    # cd /usr/ports/japanese/namazu2
    # make clean
    # make install clean

    # cd ../nkf
    # make clean
    # make install clean

    デフォルト時におけるnamazu の設定ファイルは以下の3つ。
    ・namazurc(/usr/local/etc/namazu/namazurc-sample)
    ・mknmzrc(/usr/local/etc/namazu/mknmzrc-sample)
    ・namazu.cgi(/usr/local/libexec/namazu.cgi)

    ①.namazurc-sample を namazurc として、新ファイルを作成。
    ②.namazurc を、/var/www/cgi-bin/.namazurc として保存。
    ③.mknmzrc-sample を mknmzrd として、新ファイルを作成。
    ④.namazu.cgi を /var/www/cgi-bin/ にコピー。

    また、namazu のオリジナルテンプレートは、
    /usr/local/share/namazu/template にあります。
    cp -fR /usr/local/share/namazu/template/* /var/www/htdocs/index とする。

    mknmz は、
    /usr/local/bin/mknmz に格納されている。

    インデックスの作成
    # /usr/local/bin/mknmz -aO /var/www/htdocs/index/ /var/www/htdocs/


    15.tripwire

    Site keyfile passphrase tarotaro
    local keyfile passphrase toratora

    インストール
    # cd /usr/ports/security/tripwire
    # make install clean

    以下のようなライセンスが表示されます。
    LICENSE AGREEMENT for Tripwire(R) 2.3 Open Source for LINUX

    Please read the following license agreement. You must accept the
    agreement to continue installing Tripwire.

    Press ENTER to view the License Agreement.

    ENTER を押します。
    GNU GENERAL PUBLIC LICENSE
    Version 2, June 1991

    Copyright (C) 1989, 1991 Free Software Foundation, Inc.
    59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    Everyone is permitted to copy and distribute verbatim copies
    of this license document, but changing it is not allowed.

    Preamble

    The licenses for most software are designed to take away your
    freedom to share and change it. By contrast, the GNU General Public
    License is intended to guarantee your freedom to share and change free
    software--to make sure the software is free for all its users. This
    General Public License applies to most of the Free Software
    Foundation's software and to any other program whose authors commit to
    using it. (Some other Free Software Foundation software is covered by
    the GNU Library General Public License instead.) You can apply it to
    your programs, too.

    When we speak of free software, we are referring to freedom, not
    ./COPYING 4%

    スペースキーで進めます。
    Please type "accept" to indicate your acceptance of this
    license agreement. [do not accept]

    ライセンスに同意できるのであれば、accept と入力します。
    ----------------------------------------------
    Verifying existence of binaries...

    ./bin/i386-unknown-freebsd_r/siggen found
    ./bin/i386-unknown-freebsd_r/tripwire found
    ./bin/i386-unknown-freebsd_r/twprint found
    ./bin/i386-unknown-freebsd_r/twadmin found

    This program will copy Tripwire files to the following directories:

    TWBIN: /usr/local/sbin
    TWMAN: /usr/local/man
    TWPOLICY: /usr/local/etc/tripwire
    TWREPORT: /var/db/tripwire/report
    TWDB: /var/db/tripwire
    TWSITEKEYDIR: /usr/local/etc/tripwire
    TWLOCALKEYDIR: /usr/local/etc/tripwire

    CLOBBER is false.

    Continue with installation? [y/n]

    インストールして良い場合は、y を入力します。
    (When selecting a passphrase, keep in mind that good passphrases typically
    have upper and lower case letters, digits and punctuation marks, and are
    at least 8 characters in length.)

    Enter the site keyfile passphrase:

    サイトキーにする文字列を入力します。例えば sitepasshayagui と入力します。
    Verify the site keyfile passphrase:

    再度入力します。
    (When selecting a passphrase, keep in mind that good passphrases typically
    have upper and lower case letters, digits and punctuation marks, and are
    at least 8 characters in length.)

    Enter the local keyfile passphrase:

    ローカルキーにする文字列を入力します。例えば localpasshayagui と入力します。
    Verify the local keyfile passphrase:

    再度入力します。
    ----------------------------------------------
    Generating Tripwire configuration file...

    ----------------------------------------------
    Creating signed configuration file...
    Please enter your site passphrase:

    Tripwireの設定ファイルを作成する為、先ほどのサイトキーを入力します。
    ----------------------------------------------
    Customizing default policy file...

    ----------------------------------------------
    Creating signed policy file...
    Please enter your site passphrase:

    デフォルトポリシーファイルをカスタマイズするため、サイトキーを入力します。
    ----------------------------------------------
    The installation succeeded.

    Please refer to /usr/local/share/doc/tripwire/Release_Notes
    for release information and to the printed user documentation
    for further instructions on using Tripwire 2.3 Open Source for LINUX.

    Creating tripwire database
    Please enter your local passphrase:

    データベースファイルを作成する為、ローカルキーを入力します。
    Parsing policy file: /usr/local/etc/tripwire/tw.pol
    Generating the database...
    *** Processing Unix File System ***
    ### Warning: File system error.
    ### Filename: /usr/src/sys/compile
    ### No such file or directory
    ### Continuing...
    ### Warning: File system error.
    ### Filename: /usr/tmp
    ### No such file or directory
    ### Continuing...

    No such file or directory というワーニングがたくさん表示される。
    The tripwire database, configuration file and
    policy file are signed using the local and site keys,
    therefore according to the support staff at
    tripwiresecurity.com, creating a floppy is not necessary.
    ===> Compressing manual pages for tripwire-2.3.1.2_3
    ===> Registering installation for tripwire-2.3.1.2_3
    ===> Cleaning for libiconv-1.9.2_1
    ===> Cleaning for gettext-0.14.1
    ===> Cleaning for gmake-3.80_2
    ===> Cleaning for libtool-1.3.5_2
    ===> Cleaning for libtool-1.5.10_1
    ===> Cleaning for expat-1.95.8
    ===> Cleaning for tripwire-2.3.1.2_3
    eden#

    これでとりあえず終わり。
    設定
    tripwire の設定ファイルは、以下のディレクトリに作成されます。
    eden# pwd
    /usr/local/etc/tripwire
    eden# ls -la
    total 70
    drwxr-x--- 2 root wheel 512 Mar 26 19:21 .
    drwxr-xr-x 7 root wheel 512 Mar 26 19:14 ..
    -rw-r----- 1 root wheel 931 Mar 26 19:18 eden.hayagui.com-local.key
    -rw-r----- 1 root wheel 931 Mar 26 19:17 site.key
    -rw-r----- 1 root wheel 4586 Mar 26 19:20 tw.cfg
    -rw-r----- 1 root wheel 8287 Mar 26 19:20 tw.pol
    -rw-r----- 1 root wheel 528 Mar 26 19:18 twcfg.txt
    -rw-r----- 1 root wheel 20833 Mar 26 19:20 twpol.txt
    -rw-r----- 1 root wheel 20651 Mar 26 19:20 twpol.txt.bak
    eden#

    twpol.txt は、改変されたファイルを設定するファイルなので、削除します。

    eden# rm twpol.*
    eden# ls
    eden.hayagui.com-local.key tw.pol
    site.key twcfg.txt
    tw.cfg
    eden#

    データベースを作成します。
    eden# /usr/local/sbin/tripwire --init
    Please enter your local passphrase:
    Parsing policy file: /usr/local/etc/tripwire/tw.pol
    Generating the database...
    *** Processing Unix File System ***
    ### Warning: File system error.
    ### Filename: /usr/src/sys/compile
    ### No such file or directory
    ### Continuing...

    省略

    「tw.pol には設定されているけど、ファイルかディレクトリが無いよ」とワーニングが表示されるので、 twpol.txt を生成してこれらを検知しないようにする必要があります。
    eden# /usr/local/sbin/twadmin --print-polfile > twpol.txt
    eden#

    先ほどの /usr/src/sys/compile の場合は、こんな感じに # でコメントにします。
    #
    # sources
    #

    (
    rulename = "Sources",
    severity = $(SIG_HI)
    )
    {
    /usr/src -> $(SEC_CRIT) (recurse = true) ;
    # /usr/src/sys/compile -> $(SEC_CONFIG) (recurse = false) ;
    }

    ワーニングが出た個所を全部修正します。
    ポリシーファイルに反映させます。twpol.txt も削除します。

    eden# /usr/local/sbin/twadmin --create-polfile /usr/local/etc/tripwire/twpol.txt
    Please enter your site passphrase:
    Wrote policy file: /usr/local/etc/tripwire/tw.pol

    eden# rm twpol.txt
    eden#

    データベースを作成します。
    eden# /usr/local/sbin/tripwire --init Please enter your local passphrase:
    Parsing policy file: /usr/local/etc/tripwire/tw.pol
    Generating the database...
    *** Processing Unix File System ***
    Wrote database file: /var/db/tripwire/eden.hayagui.com.twd
    The database was successfully generated.
    eden#

    ワーニングが出ないのでOKです。
    改ざんチェック
    なにもファイルを変更していない状態で改ざんチェックしてみます。
    eden# /usr/local/sbin/tripwire --check
    Parsing policy file: /usr/local/etc/tripwire/tw.pol
    *** Processing Unix File System ***
    Performing integrity check...
    Wrote report file: /var/db/tripwire/report/eden.hayagui.com-20050326-215644.twr


    Tripwire(R) 2.3.0 Integrity Check Report

    Report generated by: root
    Report created on: Sat Mar 26 21:56:44 2005
    Database last updated on: Never

    ===============================================================================
    Report Summary:
    ===============================================================================

    Host name: eden.hayagui.com
    Host IP address: 192.168.0.8
    Host ID: None
    Policy file used: /usr/local/etc/tripwire/tw.pol
    Configuration file used: /usr/local/etc/tripwire/tw.cfg
    Database file used: /var/db/tripwire/eden.hayagui.com.twd
    Command line used: /usr/local/sbin/tripwire --check

    ===============================================================================
    Rule Summary:
    ===============================================================================

    -------------------------------------------------------------------------------
    Section: Unix File System
    -------------------------------------------------------------------------------

    Rule Name Severity Level Added Removed Modified
    --------- -------------- ----- ------- --------
    Invariant Directories 66 0 0 0
    Tripwire Data Files 100 0 0 0
    Temporary directories 33 0 0 0
    * Local files 66 0 0 1
    Tripwire Binaries 100 0 0 0
    Libraries, include files, and other system files
    100 0 0 0
    System Administration Programs 100 0 0 0
    User Utilities 100 0 0 0
    Sources 100 0 0 0
    (/usr/src)
    NIS 100 0 0 0
    (/var/yp)
    /etc 100 0 0 0
    Security Control 100 0 0 0
    Root's home 100 0 0 0
    FreeBSD Kernel 100 0 0 0
    FreeBSD Modules 100 0 0 0
    (/modules)
    /dev 100 0 0 0
    Linux Compatibility 100 0 0 0
    (/compat)

    Total objects scanned: 33097
    Total violations found: 1

    ===============================================================================
    Object Summary:
    ===============================================================================

    -------------------------------------------------------------------------------
    # Section: Unix File System
    -------------------------------------------------------------------------------

    -------------------------------------------------------------------------------
    Rule Name: Local files (/usr/local/etc)
    Severity Level: 66
    -------------------------------------------------------------------------------

    Modified:
    "/usr/local/etc/tripwire"

    ===============================================================================
    Error Report:
    ===============================================================================

    No Errors

    -------------------------------------------------------------------------------
    *** End of report ***

    Tripwire 2.3 Portions copyright 2000 Tripwire, Inc. Tripwire is a registered
    trademark of Tripwire, Inc. This software comes with ABSOLUTELY NO WARRANTY;
    for details use --version. This is free software which may be redistributed
    or modified only under certain conditions; see COPYING for details.
    All rights reserved.
    Integrity check complete.
    eden#

    当然エラーはなし。
    では、ファイルを追加してみましょう。

    twpol.txt では、 /sbin と /usr/sbin に対して以下のように設定されています。

    #
    # System Administration Programs
    #

    (
    rulename = "System Administration Programs",
    severity = $(SIG_HI)
    )
    {
    /sbin -> $(SEC_CRIT) (recurse = true) ;
    /usr/sbin -> $(SEC_CRIT) (recurse = true) ;
    }

    /usr/sbin に hoge というファイルを追加してみます。
    eden# touch /usr/sbin/hoge
    eden#

    Tripwire を実行してみます。
    eden# /usr/local/sbin/tripwire --check
    Parsing policy file: /usr/local/etc/tripwire/tw.pol
    *** Processing Unix File System ***
    Performing integrity check...
    Wrote report file: /var/db/tripwire/report/eden.hayagui.com-20050326-221520.twr


    Tripwire(R) 2.3.0 Integrity Check Report

    Report generated by: root
    Report created on: Sat Mar 26 22:15:20 2005
    Database last updated on: Never

    ===============================================================================
    Report Summary:
    ===============================================================================

    Host name: eden.hayagui.com
    Host IP address: 192.168.0.8
    Host ID: None
    Policy file used: /usr/local/etc/tripwire/tw.pol
    Configuration file used: /usr/local/etc/tripwire/tw.cfg
    Database file used: /var/db/tripwire/eden.hayagui.com.twd
    Command line used: /usr/local/sbin/tripwire --check

    ===============================================================================
    Rule Summary:
    ===============================================================================

    -------------------------------------------------------------------------------
    Section: Unix File System
    -------------------------------------------------------------------------------

    Rule Name Severity Level Added Removed Modified
    --------- -------------- ----- ------- --------
    Invariant Directories 66 0 0 0
    Tripwire Data Files 100 0 0 0
    Temporary directories 33 0 0 0
    * Local files 66 1 0 1
    Tripwire Binaries 100 0 0 0
    Libraries, include files, and other system files
    100 0 0 0
    * System Administration Programs 100 1 0 1
    User Utilities 100 0 0 0
    Sources 100 0 0 0
    (/usr/src)
    NIS 100 0 0 0
    (/var/yp)
    /etc 100 0 0 0
    Security Control 100 0 0 0
    Root's home 100 0 0 0
    FreeBSD Kernel 100 0 0 0
    FreeBSD Modules 100 0 0 0
    (/modules)
    /dev 100 0 0 0
    Linux Compatibility 100 0 0 0
    (/compat)

    Total objects scanned: 33099
    Total violations found: 4

    ===============================================================================
    Object Summary:
    ===============================================================================

    -------------------------------------------------------------------------------
    # Section: Unix File System
    -------------------------------------------------------------------------------

    -------------------------------------------------------------------------------
    Rule Name: Local files (/usr/local/etc)
    Severity Level: 66
    -------------------------------------------------------------------------------

    Added:
    "/usr/local/etc/tripwire/twpol.txt"

    Modified:
    "/usr/local/etc/tripwire"

    -------------------------------------------------------------------------------
    Rule Name: System Administration Programs (/usr/sbin)
    Severity Level: 100
    -------------------------------------------------------------------------------

    Added:
    "/usr/sbin/hoge"

    Modified:
    "/usr/sbin"

    ===============================================================================
    Error Report:
    ===============================================================================

    No Errors

    -------------------------------------------------------------------------------
    *** End of report ***

    Tripwire 2.3 Portions copyright 2000 Tripwire, Inc. Tripwire is a registered
    trademark of Tripwire, Inc. This software comes with ABSOLUTELY NO WARRANTY;
    for details use --version. This is free software which may be redistributed
    or modified only under certain conditions; see COPYING for details.
    All rights reserved.
    Integrity check complete.
    eden#

    こんな感じに検知できます。このリポートは以下のディレクトリに保存されます。
    eden# pwd
    /var/db/tripwire/report
    eden# ls -la
    total 12
    drwxr-x--- 2 root wheel 512 Mar 26 22:24 .
    drwxr-xr-x 3 root wheel 512 Mar 26 21:52 ..
    -rw-r--r-- 1 root wheel 3422 Mar 26 22:06 eden.hayagui.com-20050326-215644.twr
    -rw-r--r-- 1 root wheel 3614 Mar 26 22:24 eden.hayagui.com-20050326-221520.twr
    eden#

    データベースを更新
    変更された内容が正しいものとして承認した時は、データベースを更新します。
    以下のように実行すると、twcfg.txt 内で設定されているエディタでレポートが表示されます。

    eden# /usr/local/sbin/tripwire --update --twrfile /var/db/tripwire/report/eden.hayagui.com-20050326-221520.twr
    Tripwire(R) 2.3.0 Integrity Check Report

    Report generated by: root
    Report created on: Sat Mar 26 22:41:05 2005
    Database last updated on: Never

    変更があったファイルは以下のように表示されます。
    Added:
    [x] "/usr/sbin/hoge"

    これを承認する時はファイルを終了します。反映させたくない時は、x を削除します。
    私は vi なので q! で終了させると、ローカルキーを求められますので、入力します。

    :q!
    Please enter your local passphrase:

    Wrote database file: /var/db/tripwire/eden.hayagui.com.twd
    eden#
    eden#

    再度、改ざんチェックを行うと改ざん無しと検知します。




     
     
    IT関連の仕事をしているサラリーマンです。趣味は、映画鑑賞、釣り(バス・フィッシング/フライフィッシング)です。いろいろとできることから少しづつでも試しながらやって行こうと思っています。

    あなたへのおすすめ