[セキュリティ]


この日記のはてなブックマーク数 このエントリーを含むはてなブックマーク
mrtgのインストールにはzlibとlibpng、それからgdが必要となります。まずzlibからインストールします。


zlibのインストール

[root@server src]# wget http://jaist.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.3.tar.gz
[root@server src]# tar xvzf ./zlib-1.2.3.tar.gz
[root@server src]# cd zlib-1.2.3
[root@server zlib-1.2.3]# ./configure
[root@server zlib-1.2.3]# make
[root@server zlib-1.2.3]# make install
cp zlib.h zconf.h /usr/local/include
chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
cp libz.a /usr/local/lib
cd /usr/local/lib; chmod 755 libz.a
cd /usr/local/lib; if test -f libz.so.1.2.3; then \
  rm -f libz.so libz.so.1; \
  ln -s libz.so.1.2.3 libz.so; \
  ln -s libz.so.1.2.3 libz.so.1; \
  (ldconfig || true)  >/dev/null 2>&1; \
fi
cp zlib.3 /usr/local/share/man/man3
chmod 644 /usr/local/share/man/man3/zlib.3


libpngのインストール (http://www.libpng.org/pub/png/libpng.html)

[root@server src]# tar xvjf ./libpng-1.2.8.tar.bz2
[root@server src]# cd libpng-1.2.8
[root@server libpng-1.2.8]# make -f scripts/makefile.linux CC=gcc ZLIBLIB=../zlib-1.2.3 ZLIBINC=../zlib-1.2.3


gdのインストール
[root@server src]# wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
[root@server src]# cd gd-2.0.33
[root@server src]# env CPPFLAGS="-I../zlib-1.2.3 -I../libpng-1.2.8" LDFLAGS="-L../zlib-1.2.3 -L../libpng-1.2.8" ./configure --disable-shared \
--without-freetype --without-jpeg
[root@server src]# make
[root@server gd-2.0.33]# make install
Making install in config
make[1]: Entering directory `/usr/local/src/gd-2.0.33/config'
make[2]: Entering directory `/usr/local/src/gd-2.0.33/config'
test -z "/usr/local/bin" || mkdir -p -- "/usr/local/bin"
 /usr/bin/install -c 'gdlib-config' '/usr/local/bin/gdlib-config'
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/usr/local/src/gd-2.0.33/config'
make[1]: Leaving directory `/usr/local/src/gd-2.0.33/config'
Making install in test
make[1]: Entering directory `/usr/local/src/gd-2.0.33/test'
make[2]: Entering directory `/usr/local/src/gd-2.0.33/test'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/usr/local/src/gd-2.0.33/test'
make[1]: Leaving directory `/usr/local/src/gd-2.0.33/test'
make[1]: Entering directory `/usr/local/src/gd-2.0.33'
make[2]: Entering directory `/usr/local/src/gd-2.0.33'
test -z "/usr/local/lib" || mkdir -p -- "/usr/local/lib"
 /bin/sh ./libtool --mode=install /usr/bin/install -c  'libgd.la' '/usr/local/lib/libgd.la'
/usr/bin/install -c .libs/libgd.lai /usr/local/lib/libgd.la
/usr/bin/install -c .libs/libgd.a /usr/local/lib/libgd.a
ranlib /usr/local/lib/libgd.a
chmod 644 /usr/local/lib/libgd.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
test -z "/usr/local/bin" || mkdir -p -- "/usr/local/bin"
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'annotate' '/usr/local/bin/annotate'
/usr/bin/install -c annotate /usr/local/bin/annotate
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'gdparttopng' '/usr/local/bin/gdparttopng'
/usr/bin/install -c gdparttopng /usr/local/bin/gdparttopng
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'gdtopng' '/usr/local/bin/gdtopng'
/usr/bin/install -c gdtopng /usr/local/bin/gdtopng
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'gd2copypal' '/usr/local/bin/gd2copypal'
/usr/bin/install -c gd2copypal /usr/local/bin/gd2copypal
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'gd2topng' '/usr/local/bin/gd2topng'
/usr/bin/install -c gd2topng /usr/local/bin/gd2topng
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'pngtogd' '/usr/local/bin/pngtogd'
/usr/bin/install -c pngtogd /usr/local/bin/pngtogd
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'pngtogd2' '/usr/local/bin/pngtogd2'
/usr/bin/install -c pngtogd2 /usr/local/bin/pngtogd2
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'webpng' '/usr/local/bin/webpng'
/usr/bin/install -c webpng /usr/local/bin/webpng
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'gd2togif' '/usr/local/bin/gd2togif'
/usr/bin/install -c gd2togif /usr/local/bin/gd2togif
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'gdcmpgif' '/usr/local/bin/gdcmpgif'
/usr/bin/install -c gdcmpgif /usr/local/bin/gdcmpgif
  /bin/sh ./libtool --mode=install /usr/bin/install -c 'giftogd2' '/usr/local/bin/giftogd2'
/usr/bin/install -c giftogd2 /usr/local/bin/giftogd2
test -z "/usr/local/bin" || mkdir -p -- "/usr/local/bin"
 /usr/bin/install -c 'bdftogd' '/usr/local/bin/bdftogd'
 /usr/bin/install -c 'config/gdlib-config' '/usr/local/bin/gdlib-config'
test -z "/usr/local/include" || mkdir -p -- "/usr/local/include"
 /usr/bin/install -c -m 644 'gd.h' '/usr/local/include/gd.h'
 /usr/bin/install -c -m 644 'gdfx.h' '/usr/local/include/gdfx.h'
 /usr/bin/install -c -m 644 'gd_io.h' '/usr/local/include/gd_io.h'
 /usr/bin/install -c -m 644 'gdcache.h' '/usr/local/include/gdcache.h'
 /usr/bin/install -c -m 644 'gdfontg.h' '/usr/local/include/gdfontg.h'
 /usr/bin/install -c -m 644 'gdfontl.h' '/usr/local/include/gdfontl.h'
 /usr/bin/install -c -m 644 'gdfontmb.h' '/usr/local/include/gdfontmb.h'
 /usr/bin/install -c -m 644 'gdfonts.h' '/usr/local/include/gdfonts.h'
 /usr/bin/install -c -m 644 'gdfontt.h' '/usr/local/include/gdfontt.h'
 /usr/bin/install -c -m 644 'entities.h' '/usr/local/include/entities.h'
make[2]: Leaving directory `/usr/local/src/gd-2.0.33'
make[1]: Leaving directory `/usr/local/src/gd-2.0.33'


mrtgのインストール
[root@server src]# tar xvzf ./mrtg-2.12.2.tar.gz
[root@server src]# cd mrtg-2.12.2
./configure --prefix=/usr/local/mrtg-2 \
--with-gd=/usr/local/src/gd-2.0.33 \
--with-z=/usr/local/src/zlib-1.2.3 \
--with-png=/usr/local/src/libpng-1.2.8
[root@server mrtg-2.12.2]# make
[root@server mrtg-2.12.2]# make install
/bin/sh ./mkinstalldirs /usr/local/mrtg-2/bin
for x in ./bin/mrtg ./bin/cfgmaker ./bin/indexmaker; do \
  /usr/bin/install -c -m 755 $x /usr/local/mrtg-2/bin; done
for x in bin/rateup; do \
  /usr/bin/install -c -m 755 $x /usr/local/mrtg-2/bin; done
/bin/sh ./mkinstalldirs /usr/local/mrtg-2/lib/mrtg2/Pod
for x in ./lib/mrtg2/*.pm; do \
  /usr/bin/install -c -m 644 $x /usr/local/mrtg-2/lib/mrtg2; done
for x in ./lib/mrtg2/Pod/*.pm; do \
  /usr/bin/install -c -m 644 $x /usr/local/mrtg-2/lib/mrtg2/Pod; done
/bin/sh ./mkinstalldirs /usr/local/mrtg-2/share/mrtg2/icons
for x in ./images/*.gif ./images/*.png; do \
  /usr/bin/install -c -m 644 $x /usr/local/mrtg-2/share/mrtg2/icons; done
/bin/sh ./mkinstalldirs /usr/local/mrtg-2/share/doc/mrtg2
(cd .; for x in COPYING COPYRIGHT README CHANGES THANKS doc/*.pod doc/*.html doc/*.wml doc/*.txt doc/*.png; do \
  /usr/bin/install -c -m 644 $x /usr/local/mrtg-2/share/doc/mrtg2; done)
/bin/sh ./mkinstalldirs /usr/local/mrtg-2/man/man1
for x in ./doc/*.1; do \
  /usr/bin/install -c -m 644 $x /usr/local/mrtg-2/man/man1; done



※libpngのリンクが張られていないとwebalizerやapacheでエラーがでますので以下のようにソースディレクトリから/usr/libにコピーします。


[webalizer]

webalizer: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory

cd /usr/lib
ln -s ../local/lib/libgd.so.2 ./


webalizer: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

cd /usr/lib
cp /usr/local/src/libpng/libpng12.so.0.1.2.8 ./
ln -s ./libpng12.so.0.1.2.8 ./libpng12.so.0



[apache]

[root@server lib]# /etc/rc.d/init.d/httpd start
Cannot load /etc/httpd/modules/libphp4.so into server: libpng.so.2: cannot open shared object file: No such file or directory

cd /usr/lib
ln -s ./libpng12.so.0.1.2.8 ./libpng.so.2


[PHP]
cp /usr/local/src/libpng-1.2.8/png.h /usr/include/png.h cp /usr/local/src/libpng-1.2.8/pngconf.h /usr/include/pngconf.h


関連記事
sshdfilter
iptalbesでdhcpを通す
ssh-agent - 公開鍵認証の鍵管理
chrootssh
chrootkit - rootkitの検出
scponly
iptablesでftpを通す
macアドレスによるフィルタリング
公開鍵認証でパスワードなしにログイン
tripwireによるファイル改竄検知
zlib + libpng + gd + mrtgのインストール
SNMPの設定
rp_filter - スプーフィング対策
nmapによるOSの特定
john the ripper
system-config-securitylevel-tui - ファイアウォールの設定
iptables - SNAT
iptables - DNAT
MRTGディレクトリにアクセスできない
iptablesでpingを通す
sudo
/etc/ftpusers でftpのアクセス制限
Ctrl+Alt+deleteキーによる再起動の禁止
sshdがサポートするプロトコルのバージョン
qpopperのバージョンを隠すには
iptablesのルール一覧を表示するには
BINDのバージョン情報を隠すには
iptables 設定 - ルールの削除
tcp_syncookies - SYN Flood攻撃を防ぐには
SSHでログインできるユーザを制限
RedHat 9.0以前のパッケージのアップデート
iplogによるトラフィック監視
suコマンドの制限
rootユーザで直接SSHへログインするのを防ぐ
広告