Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
13
Help us understand the problem. What is going on with this article?
@soramugi

ufwをcentosにインストール

More than 5 years have passed since last update.

iptablesを直接いじりたくないのでufwを導入します。

sudo yum install wget make
mkdir -p ~/src
cd ~/src
wget https://launchpad.net/ufw/0.33/0.33/+download/ufw-0.33.tar.gz
tar xzf ufw-0.33.tar.gz
cd ufw-0.33
sudo python ./setup.py install
cd ../
sudo rm -rf ufw-0.33
sudo chmod -R g-w /etc/ufw /lib/ufw /etc/default/ufw /usr/sbin/ufw

sudo service iptables stop
sudo service ip6tables stop
sudo chkconfig --del iptables
sudo chkconfig --del ip6tables

$ sudo ufw status
Status: inactive

$ sudo ufw reset
$ sudo ufw default deny
$ sudo ufw allow 22
$ sudo ufw allow 80
$ sudo ufw allow 443
$ sudo ufw enable
$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere
80                         ALLOW       Anywhere
443                        ALLOW       Anywhere
22                         ALLOW       Anywhere (v6)
80                         ALLOW       Anywhere (v6)
443                        ALLOW       Anywhere (v6)

念のため別コンソール開いてssh繋がるか確認してください(ssh繋げたまま)

次は常時起動設定

sudo sh -c "echo '/usr/sbin/ufw enable' >> /etc/rc.local"
$ sudo cat /etc/rc.local | tail -3 # 念のため確認

touch /var/lock/subsys/local
/usr/sbin/ufw enable
$ sudo reboot

立ち上がったらちゃんと起動できてるか確認

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere
80                         ALLOW       Anywhere
443                        ALLOW       Anywhere
22                         ALLOW       Anywhere (v6)
80                         ALLOW       Anywhere (v6)
443                        ALLOW       Anywhere (v6)

お疲れ様でした

参考: http://mitsuakikawamorita.com/blog/?p=1375
参考: http://g6g6g6g6g6.tumblr.com/post/64294729570/centos-utf

13
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
soramugi
自己紹介を設定してみる!

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
13
Help us understand the problem. What is going on with this article?