UNIX/Linuxの最近のブログ記事

[Linux] RHEL4 AS

| コメント(0) | トラックバック(0)

久しぶりに仕事でサーバにOSなんて入れました。

つ~か、テキストモードでインストールしようとすると最小(Minimum)構成が選べないのですな。おかげで、謎のCPU故障も含めて3時間くらいかかった。

 

もう絶望したね。テキストモードにも最小構成を追加しろよ。外に出すマシンなんてCUIしか使わないんだし(笑

 

デフォルトのさざなみフォントから「M+ と IPAフォントの合成フォント」に変更してみました。インストール後にFirefoxやら選べるようになりました。

 

【環境】

 ・CentOS5 (2008/01/14現在最新)

 ・Firefox 2.0.0.11

 

【ログ】

$ tar jxvf mixfont-mplus-ipa-TrueType-20060520p1.tar.bz2
$ cd mixfont-mplus-ipa-TrueType-20060520p1
$ cd opfc-ModuleHP-1.1.1_withIPAFonts_and_Mplus/
$ cd fonts/
$
$ ls
COPYING.font.ja        M+2P+IPAG-circle.ttf   Makefile.in  ipam.ttf
M+1P+IPAG-circle.ttf   M+2P+IPAG.ttf          ipag.ttf     ipamp.ttf
M+1P+IPAG.ttf          M+2VM+IPAG-circle.ttf  ipagp.ttf
M+1VM+IPAG-circle.ttf  Makefile.am            ipagui.ttf
$
$ su
パスワード:
#
# cp *.ttf /usr/share/fonts/japanese/TrueType/
#
#
# cd  /usr/share/fonts/japanese/TrueType/
# mkfontdir
# mkfontscale
#

 

spamメールの判断材料の一つとなるdkim-milter、dk-milter、sid-milterのインストールとsendmailとの連携方法。

 

1.dkim-milterのインストール&準備

$ tar zxvf  dkim-milter-1.1.0.tar.gz

 

~~省略~~ 

$ cd dkim-milter-1.1.0

$ cp site.config.m4.dist devtools/Site/site.config.m4

$ vi devtools/Site/site.config.m4

-----

APPENDDEF(`confINCDIRS', `-I/usr/local/ssl/include ')
APPENDDEF(`confLIBDIRS', `-L/usr/local/ssl/lib ')

-----

$

$ sh Build

~~省略~~ 

$ su - 

# sh Build install 

~~省略~~ 

# dkim-filter/

# ./gentxt.csh <selector> <domain>

【出力されたものをDNSサーバへ追記】

# cp <selector.p* /適当なディレクトリ

# /usr/bin/dkim-filter -l -p inet:8890@localhost -d <domain> -u <適当なユーザ> -k  <秘密鍵> -s <selector> -P <PID出力先>

#



2.dk-milterのインストール&準備

$ tar zxvf  dk-milter-0.6.0.tar.gz

 

~~省略~~ 

$ cd dk-milter-0.6.0

$ cp site.config.m4.dist devtools/Site/site.config.m4

----

APPENDDEF(`confINCDIRS', `-I/usr/local/ssl/include ')
APPENDDEF(`confLIBDIRS', `-L/usr/local/ssl/lib ')

----

$

$ sh Build

~~省略~~

$

$ su - 

# sh Build install 

 

~~省略~~

#

# dk-filter/

# ./gentxt.csh <selector> <domain>

【出力されたものをDNSサーバへ追記】

# cp <selector.p* /適当なディレクトリ

#/usr/bin/dk-filter -l -p inet:8892@localhost -d <domain> -u <適当なユーザ> -s <秘密鍵> -S <selector> -P <PID出力先>

 



3.sid-milterのインストール&準備

$ tar zxvf sid-milter-0.2.14.tar.gz

 

~~省略~~ 

$ cd sid-milter-0.2.14

$ sh Build

 

~~省略~~ 

$ sh Build install

 

~~省略~~ 

 

以下の様なものをDNSに追記 

-----

        IN      TXT     "v=spf1 a mx ptr ip4:xxx.xxx.xxx.xxx mx:<domain> -all"

-----

$ /usr/bin/sid-filter -l -p inet:8894@localhost -d <domain> -u <適当なユーザ> -P <PID出力先>

 




4.sendmail.cfを作成

※ sendmail.mcに記載した順番に実行される。

# vi sendmail.mc

sendmail.mcの一番最後に追記 

-----

INPUT_MAIL_FILTER(`dkim-filter', `S=inet:8890@localhost')dnl
INPUT_MAIL_FILTER(`dk-filter', `S=inet:8892@localhost')dnl
INPUT_MAIL_FILTER(`sid-filter', `S=inet:8894@localhost')dnl

-----

#

# <sendmail.cfを作成>

ProFTPDのインストールメモ


○条件

・インストールはデフォルト

・セキュリティーは高くする

・FTP over SSLを行なう(※) 

 
○インストール

$ wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.0a.tar.gz

$ tar zxvf proftpd-1.3.0a.tar.gz

$ cd proftpd-1.3.0a

$ ./configure

$  ./configure --with-modules=mod_tls --with-includes=/usr/local/ssl/include/ --with-libraries=/usr/local/ssl/lib/                                     ← ※

~省略~ 

$ make

~省略~ 

$ su -

Password:

# make install

~省略~ 

 

○ProFTP設定(特別やった設定のみ)

設定ファイル: /usr/local/etc/proftpd.conf

# idet認証無効

IdentLookups off

 

# 同じホストからの同時接続

MaxClientsPerHost 2

 

# 同じユーザからの同時接続

MaxHostsPerUser 1

 

# バージョン表記の隠蔽

ServerIdent Off

 

# ユーザログインディレクトリ上位は見せない 

DefaultRoot ~/

 

# FTP over SSL 設定                                    ← ※ 

<IfModule mod_tls.c>
   TLSEngine on
   TLSLog  /var/log/proftpd_tls.log
   TLSProtocol SSLv23
   TLSCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:!SSLv2:+EXP

   # Are clients required to use FTP over TLS when talking to this server?
   TLSRequired off

   # Server's certificate
   TLSRSACertificateFile /usr/local/apache2/conf/certs/server.pem
   TLSRSACertificateKeyFile /usr/local/apache2/conf/certs/server.key

   # Authenticate clients that want to use FTP over TLS?
   TLSVerifyClient off
</IfModule>

 

○xinetd設定

設定ファイル: /etc/xinetd.d/ftp

service ftp
{
        disable = no
        socket_type = stream
        flags = REUSE
        wait = no
        user = root
        server = /usr/local/sbin/in.proftpd
        log_on_success += DURATION USERID
        log_on_failure += USERID
        nice = 10
}

 

 

date(GNU)を使い日付の計算をする。

 

・使用されると想定される箇所

 ログやバックアップファイルの管理など

 

・動作確認

 Red Hat Linux Advanced Server release 2.1ASの「date(GNU)」コマンド

 

・欠点

 GNU系のdateコマンドでしか使えない

 

・利点

 複雑な計算式を使わなくてもうるう年を含め計算が出来る 

 責任をdateコマンドのせいにすることが出来る(笑)

 

1.前日の日付を求める

 -----

 # date --date '1 day ago' +%Y%m%d
 20060613

 -----

 「1 day ago」の部分が一日前と言う意味

 「%Y%m%d」は出力する日付のフォーマット

 

 結果を変数に入れることも出来る(スクリプト内での例) 

 -----

 DATE=`date --date '1 day ago' +%Y%m%d`

 ----- 

 

2.入力された日付の前日を求める

 -----

 # date -d '20060301 1 day ago' +%Y%m%d
 20060228

 # date -d '20040301 1 day ago' +%Y%m%d
 20040229

 -----

 「1 day ago」の部分が一日前と言う意味

 「%Y%m%d」は出力する日付のフォーマット

 「20060301」 または「20040301」は入力される日付

 

 スクリプトの引数で日付を指定し、その日付から前日の日付を出力するスクリプトも作成できる

 ----- 

 #!/bin/sh

 DATE=`date -d "$1 1 day ago" +%Y%m%d`

 echo ${DATE}

 -----

 

spam的な掲示板やblogへの書き込みをさせない為にRBLを使えるようにApacheを改造する。

※RBL:spam的な情報の発信したIPのデータベース

 

引用・解説元

 ・どさにっき

 ・RBL.jp

 

 

1.Apacheのソースを展開する。

2./ソースディレクトリ(http-2.0.xx)/modules/aaa/ にmod_access_rblを置く。

  (通常のApacheのmod_accessでは使用できない為、パッチを当てる)

3.パッチを当てる

 # patch < mod_access_rbl.diff
 patching file mod_access.c
 Hunk #1 succeeded at 19 (offset -42 lines).
 Hunk #3 succeeded at 118 (offset -42 lines).
 Hunk #5 succeeded at 282 (offset -42 lines).

 

4.普通にコンパイルし、インストールする。

5.httpd.confに以下のような記述を追記する。

 <Files ~ "\.(cgi|pl|php)">
     Order allow,deny
     allow from all
     deny via niku.2ch.net
     deny via list.dsbl.org
     deny via bl.spamcop.net
     deny via sbl-xbl.spamhaus.org
     deny via all.rbl.jp
     deny via opm.blitzed.org
     deny via bsb.empty.us
     deny via bsb.spamlookup.net
 </Files>

 拡張子cgi,pl,phpが付くファイルの場合のみ有効になる。

 

CentOSでは、最初からIPv6が有効になっていますが、現状まったくもって使っていない状態なため、無効化する。 

 

1.現状確認 

 # lsmod | grep ipv6
 ipv6                  234369  16

 

2.設定

 # vi /etc/modprobe.conf

 --- (追記内容) ---

 alias net-pf-10 off
 alias ipv6 off

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

 

3.再起動

4.確認

 # lsmod | grep ipv6

 

CentOS 4.2導入

| コメント(0) | トラックバック(0)

HDDが壊れてOSを再インストールしなければなくなったので、CentOS 4.2を導入してみました。

無論いきなりの導入なのでSELinuxは無効にしているが、いずれ使用しようと思う。

RedHat9からの変化なので、謎のサービスが多々あり久しぶりに調べましたよ(笑


まぁ、ソフトは調べれば何とかなりますが、その他の大問題アリ。

HDDは新品だから問題無いが、電解コンデンサの防爆弁(頭にある×の所)が膨らんでいる・・・。

危ない、デンジャラス、エーン怖いよ~(T_T)

許容範囲を超えた熱や電気、低品質などがデンジャーな原因となるわけですが、当初冷やしていなかったのが原因でしょうか。

 

過去自作PCの電源のコンデンサ暴発事件がありまして、見ちゃった以上気になってしょうがない。

とは言え、交換するのは面倒なのであと半年くらいは放置プレイです(笑

 

などと、会社から書くのでした(笑

BIND9のインストールメモ


○条件

・IPv6無効化

・openSSLの指定

※ バージョンアップなので、make installよりあとは省略されている部分あり



○インストール






$tar zxvf bind-9.3.x.tar.gz

$cd bind-9.3.x

$ ./configure --disable-ipv6 --with-openssl=/usr/local/ssl

~ 省略 ~

$ make clean

~ 省略 ~

$ make

~ 省略 ~

$ su -

Password:

# make install

~ 省略 ~ 


本来、改竄を発見する物なので他のメディア(MOなど)に
インストールやデータベースを置き運用するのが一番良い。
ASR版はログなどを一切残さないため、結果をリダイレクトでファイルに残したり、
メールで送信などする必要がある。


インストールをデフォルトで行ったため、
以下の所にインストール、または、運用する。


実行ファイル
 /usr/local/bin/tw/tripwire

設定ファイル(どのファイルorディレクトリをDB化するか記述)
 /usr/local/bin/tw/tw.config

データベースファイル
 /var/tripwire/tw.db_hostname (hostnameの部分にはホスト名が入る)


1.設定を行う(tw.config)
  デフォルトのデータベースがインストールされていますので、
  必要に合わせて編集などを行います。

# vi /usr/local/bin/tw/tw.config


   "#"     :コメントアウト、または、"#"以降の行を無効

   "R"オプション:読み込みしかしないファイルに使用
   "L"オプション:ログファイルに使用。

   その他オプションは別途ファイルに記載してあります。

------------例------------

#apacheのコンフィグディレクトリを監視
  /usr/local/apache2/conf R # Apach2 config

  #apacheのコンフィグファイルを監視
/usr/local/apache2/conf/httpd.conf R # apache2 httpd.conf
/usr/local/apache2/conf/ssl.conf R # apache2 httpd.conf

--------例ここまで--------


2.設定を元にデータベースを作成(初期化)する。

# /usr/local/bin/tw/tripwire -initialize

 ※/usr/local/bin/tw/tw.configに記述されているファイルが
  無い場合はエラーが発生します。

  ------------例-------------------

  Tripwire(tm) ASR (Academic Source Release) 1.3.1
  File Integrity Assessment Software
  (c) 1992, Purdue Research Foundation, (c) 1997, 1999 Tripwire
  Security Systems, Inc. All Rights Reserved. Use Restricted to
  Authorized Licensees.
  ### Phase 1: Reading configuration file
  ### Phase 2: Generating file list
  /usr/local/bin/tw/tripwire: /.rhosts: No such file or directory
  /usr/local/bin/tw/tripwire: /.cshrc: No such file or directory
  /usr/local/bin/tw/tripwire: /.login: No such file or directory
  ・
  ・
  ・
  ・
  /usr/local/bin/tw/tripwire: /usr/bin/uustat: No such file or directory
  /usr/local/bin/tw/tripwire: /usr/bin/uux: No such file or directory
  /usr/local/bin/tw/tripwire: /usr/bin/ksrvtgt: No such file or directory
  ### Phase 3: Creating file information database
  ###
  ### Warning: Database file placed in ./databases/tw.db_mouse.
  ###
  ### Make sure to move this file and the configuration
  ### to secure media!
  ###
  ### (Tripwire expects to find it in '/var/tripwire'.)

  ------------例ここまで-----------

3.データベースを設置する。
  2で行ったDB初期化の際、コマンドを実行したカレントディレクトリに
  データベースファイルが作成される(tw.db_hostname)

  ※カレントディレクトリのdatabasesディレクトリの中の可能性有り。


# mv tw.db_hostname /var/tripwire/

4.データベースとの照合
  コマンドを実行することにより、先ほど作成されたDBとの照合が行われる。


# /usr/local/bin/tw/tripwire

-----------変更が無い場合----------

Tripwire(tm) ASR (Academic Source Release) 1.3.1
File Integrity Assessment Software
(c) 1992, Purdue Research Foundation, (c) 1997, 1999 Tripwire
Security Systems, Inc. All Rights Reserved. Use Restricted to
Authorized Licensees.
### Phase 1: Reading configuration file
### Phase 2: Generating file list
### Phase 3: Creating file information database
### Phase 4: Searching for inconsistencies
###
### All files match Tripwire database. Looks okay!

-------変更が無い場合ここまで------

-----------変更が有る場合----------

### Phase 4: Searching for inconsistencies
###
### Total files scanned: 9025
### Files added: 0
### Files deleted: 0
### Files changed: 1
###
### Total file violations: 1
###
changed: -r--r--r-- root 549 Jul 1 17:42:00 2002 /etc/inet/hosts
### Phase 5: Generating observed/expected pairs for changed files
###
### Attr Observed (what it is) Expected (what it should be)
### =========== ============================= =============================
/etc/inet/hosts
st_size: 549 531
st_mtime: Mon Jul 1 17:42:00 2002 Tue Jun 4 18:16:05 2002
st_ctime: Mon Jul 1 17:42:00 2002 Tue Jun 4 18:16:05 2002
md5 (sig1): 1qDof9YzBljdGFgEHNs3gx 2sNiz5CBETy86gcaX1fsuV
snefru (sig2): 2032Oxw73hptiE1TJrSdr1 1vvsXhDKPFnWaaXivqVjlp

-------変更が有る場合ここまで------

5.データベースの更新
  監視しているファイルを変更した時や、
  4の照合で「変更されている」と出て問題ないと判断した時に
  行います。

  ※照合時に問題ない場合は必要はありません。


  # /usr/local/bin/tw/tripwire -interactive

  コマンドを実行したカレントディレクトリに作成されるので、
  3で行ったように移動します


# mv tw.db_hostname /var/tripwire/

6.項目4と同じように照合を行い問題ないかテストする。

-------------------------------------------
属性については、チェックする項目を指定できるようになっていて、 すごく沢山あるんだけど、だいたいは下記のように。 ちなみに、デフォルトは"R"。
+/- +で属性の追加、-で削除(これはスイッチか...)
0-9 ファイルの内容に対する、 いろいろなハッシュ、CRC等のチェック アルゴリズム
p パーミッションとモードビット
i iノード番号
n iノードの参照数。リンクの数
u オーナーのユーザid
g オーナーのグループid
s ファイルサイズ
a 最終アクセス時間
m 最終更新時間
c 作成、変更時間
R 読み込み用。(+pinugsm12-ac3456789)と同じ
L ログファイル用 (+pinug-sacm123456789)と同じ
N すべて非許可(+pinusgsamc123456789)と同じ
E すべて許可(-pinusgsamc123456789)と同じ
> 増加するファイル (+pinug>-samc1233456789)と同じ

# Format: [!|=] entry [ignore-flags]
#
# where: '!' signifies the entry is to be pruned (inclusive) from
# the list of files to be scanned.
# '=' signifies the entry is to be added, but if it is
# a directory, then all its contents are pruned
# (useful for /tmp).
#
# where: entry is the absolute pathname of a file or a directory
#
# where ignore-flags are in the format:
# [template][ [+|-][pinugsam12] ... ]
#
# - : ignore the following atributes
# + : do not ignore the following attributes
#
# p : permission and file mode bits a: access timestamp
# i : inode number m: modification timestamp
# n : number of links (ref count) c: inode creation timestamp
# u : user id of owner 1: signature 1
# g : group id of owner 2: signature 2
# s : size of file
#
#
# Ex: The following entry will scan all the files in /etc, and report
# any changes in mode bits, inode number, reference count, uid,
# gid, modification and creation timestamp, and the signatures.
# However, it will ignore any changes in the access timestamp.
#
# /etc +pinugsm12-a
#
# The following templates have been pre-defined to make these long ignore
# mask descriptions unecessary.
#
# Templates: (default) R : [R]ead-only (+pinugsm12-a)
# L : [L]og file (+pinug-sam12)
# N : ignore [N]othing (+pinusgsamc12)
# E : ignore [E]verything (-pinusgsamc12)

v4/v6チェック結果

2012年1月

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

Profile

名前:
 とらい
年齢:
 気分は18歳、いらん知識は45歳、体は35歳
職業:
 メイド服の女の娘を襲う事
夢:
 人の心を金で買う事
好きな物:
 金と力と権力
好きな言葉:
 夜が明けるから目覚めるのではない。目覚めた時に夜が明けるのだ。目覚めぬものに夜明けは来ない。
メール:
 

アクセスカウンター

Total:
本日: 昨日:

アーカイブ

最近のコメント

このアーカイブについて

このページには、過去に書かれたブログ記事のうちUNIX/Linuxカテゴリに属しているものが含まれています。

次のカテゴリはWindowsです。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。

OpenID対応しています OpenIDについて
Creative Commons License
このブログはクリエイティブ・コモンズでライセンスされています。
Powered by Movable Type 5.12