参考にさせていただいたサイト
セキュリティの設定
- userの作成
- VirtualBoxのネットワークアダプタ設定
- SELinuxの設定
- iptablesの設定
userの作成
- useradd 作成したいユーザ名
- passwd 作成したいユーザ名
- 警告が出るが作成は可能
suコマンドでrootになれる
VirtualBoxのネットワークアダプタ設定
- ssh接続のための設定
- VirtualBoxの「詳細」にある「ネットワーク」
- アダプタ1→ホストオンリーネットワーク(ゲストOSとホストOS間のネットワーク)
- アダプタ2→NAT(ゲストOSから外部へのネットワーク)
SELinuxの設定
- SELinuxの無効化
- # vi /etc/sysconfig/selinux
- SELINUX=enforcing
- ↓
- SELINUX=disabled
- rebootコマンド→getenforceコマンドでdisabledであることを確認
iptablesの設定
- 最初に設定
- iptables -P INPUT ACCEPT (外部からのアクセスを許可)
- iptables -P FORWARD DROP (次にデータを渡す)
- iptables -P OUTPUT ACCEPT (外部にデータを渡す)
- ルールの初期化
- iptables -F (上のコマンドiptablesのルールの設定を反映させるためのコマンド)
- icmp(ping) と自端末からの入力を許可
- iptables -A INPUT -p icmp -j ACCEPT
- iptables -A INPUT -i lo -j ACCEPT
- Web、FTP、POP、smtp による接続を許可
- iptables -A INPUT -p tcp --dport 80 -j ACCEPT
- iptables -A INPUT -p tcp --dport 21 -j ACCEPT
- iptables -A INPUT -p tcp --dport 110 -j ACCEPT
- iptables -A INPUT -p tcp --dport 25 -j ACCEPT
- ssh による接続を許可
- iptables -A INPUT -p tcp --dport 22 -j ACCEPT
- TCP の接続開始と応答、FTP データなどを許可
- iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
- ルールをセーブする
- /etc/init.d/iptables save
- 設定の確認
- cat /etc/sysconfig/iptables
- 再起動する
- reboot
0 件のコメント:
コメントを投稿