1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Wordpress5.8導入後のセキュリティ設定まとめ

Last updated at Posted at 2021-11-25

はじめに

Wordpress導入後にセキュリティを担保しなければ!
ということで実施内容まとめ
CentOS7.4 にWordpress5.8を導入する実施後の処理

Wordpress管理画面へのアクセス制御

会社でのHPであれば外部からのアクセスはさせたくない等あるかと思います。
グローバルIPを固定で持っていれば、IPで制限をし社内からしかアクセスできないようにします

# vi /etc/httpd/conf/httpd.conf

# 追加
<files wp-login.php>
  <RequireAny>
    Require ip xxx.xxx.xxx.xxx
    Require ip xxx.xxx.xxx.xxx
    ・・・
  </RequireAny>
</files>

<Directory /var/www/wordpress/wp-admin>
  <RequireAny>
    Require ip xxx.xxx.xxx.xxx
    Require ip xxx.xxx.xxx.xxx
    ・・・
  </RequireAny>
</Directory>

Firewall設定

Wordpress関係ないけど、そもそもsshなんて社外からは接続させたくない
不要なポートにはアクセスさせないということで

Firewallサービス起動

# systemctl start firewalld

確認

# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: dhcpv6-client ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

サーバ起動時に自動開始するように設定

# systemctl enable firewalld

httpd(80/443)サービスを許可

# firewall-cmd --add-service=http --zone=public --permanent
# firewall-cmd --add-service=https --zone=public --permanent

ssh許可を削除

# firewall-cmd --remove-service=ssh --zone=public --permanent

sshを特定アドレスからのみ許可

# firewall-cmd --zone=public --add-rich-rule='rule family=ipv4 source address="xxx.xxx.xxx.xxx/32" port port="22" protocol="tcp" accept' --permanent

設定リロード

# firewall-cmd --reload
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?