シスメモ

Linux(CentOS)、Windows(サーバー/クライアント)、Yamaha RTX、その他の技術メモ

CentOS Linux

さくらのVPS(CentOS5)初期設定メモ

投稿日:

さくらのVPSで初期設定を行った際のメモです。

■1. rootパスワード変更
コマンド:passwd

■2.ユーザー作成
コマンド:useradd hogehoge
コマンド:passwd hogehoge

■3.ユーザーのwheelグループへの追加
コマンド:usermod -G wheel hogehoge

vi /etc/pam.d/su
#auth required pam_wheel.so use_uid

auth required pam_wheel.so use_uid

■4.SSH設定
コマンド:vi /etc/ssh/sshd_config

・PermitRootLoginをNoに変更
・Port:10022に変更

■5.ファイアウォール設定
・/usr/local/sbin/iptables-init.shを以下の内容で作成する
====================================================
#!/bin/sh

iptables -F
iptables -X

iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP

iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

iptables -A INPUT -s 10.0.0.0/8 -j DROP
iptables -A INPUT -s 172.16.0.0/12 -j DROP
iptables -A INPUT -s 192.168.0.0/16 -j DROP

#SSH, SMTP, LDAP
iptables -A INPUT -m state –state NEW -p tcp -s XXX.XXX.XXX.XXX –dport 10022 -j ACCEPT #SSH
iptables -A INPUT -m state –state NEW -p tcp –dport 25 -j ACCEPT #SMTP
iptables -A INPUT -m state –state NEW -p tcp -s XXX.XXX.XXX.XXX –dport 389 -j ACCEPT #LDAP
iptables -A INPUT -m state –state NEW -p tcp -s XXX.XXX.XXX.XXX –dport 636 -j ACCEPT #LDAPS

iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
===================================================
・chmod+xで実行権限付与
・/usr/local/sbin/iptables-init.shを実行
・iptables -L で設定内容確認
・iptables-save で/etc/sysctl/iptablesに設定内容が反映される

■6.不要サービスの停止
/sbin/chkconfig auditd offv
/sbin/chkconfig autofs off
/sbin/chkconfig avahi-daemon off
/sbin/chkconfig bluetooth off
/sbin/chkconfig cups off
/sbin/chkconfig firstboot off
/sbin/chkconfig gpm off
/sbin/chkconfig haldaemon off
/sbin/chkconfig hidd off
/sbin/chkconfig iscsi off
/sbin/chkconfig iscsid off
/sbin/chkconfig isdn off
/sbin/chkconfig ip6tables off
/sbin/chkconfig kudzu off
/sbin/chkconfig lvm2-monitor off
/sbin/chkconfig mcstrans off
/sbin/chkconfig mdmonitor off
/sbin/chkconfig messagebus off
/sbin/chkconfig netfs off
/sbin/chkconfig nfslock off
/sbin/chkconfig pcscd off
/sbin/chkconfig portmap off
/sbin/chkconfig rawdevices off
/sbin/chkconfig restorecond off
/sbin/chkconfig rpcgssd off
/sbin/chkconfig rpcidmapd off
/sbin/chkconfig sendmail off
/sbin/chkconfig smartd off
/sbin/chkconfig xfs off
/sbin/chkconfig yum-updatesd off



-CentOS, Linux
-, ,

執筆者:


comment

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

関連記事

GoogleのIPアドレスを調べる

photo credit: kjetikor via photopin cc 以下のコマンドで、Googleのサーバーが使用するIPアドレスを調べることができる。 dig TXT +short _ne …

postfixで特定のトップレベルドメインからのメールを拒否する

photo credit: Alex.W IMG_0466 via photopin (license)   〜.topドメインからのスパムが増えてきたため、topドメインからのメールは問答 …

rsync+sshでリモートのディレクトリを同期

photo credit: Niklas via photopin cc ■rsync+sshでリモートのディレクトリを同期 先日、WEBサーバー同士で相互バックアップを設定しました。 rsyncを使 …

【Postfix】gmail経由でメールを送信する

photo credit: liwyatan via photopin cc プロバイダのOPB25対策として、gmail経由でメールを送信できるように Postfixを設定します。 1. /etc/ …

no image

Postfixのメールキューを全て削除する

■Postfixのメールキューを全て削除する postsuper -d ALL を実行する。