6
5

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 5 years have passed since last update.

macOS SierraでFireWall設定

Last updated at Posted at 2018-12-03

某macOS機で稼働するAFPの提供範囲を特定セグメントのみに限定するため、macOS標準のpfを利用して、ホスト側でファイアウォール設定を行った。

pfの有効化


$ sudo pfctl -e
Password:
No ALTQ support in kernel
ALTQ related functions disabled
pf enabled

設定ファイルの変更

$ sudo vim /etc/pf.conf 

以下を追記

# AFPをデフォルト拒否
block in proto tcp from any to any port = 548

# 特定セグメントのみ許可
pass in proto tcp from 192.168.20.0/24 to any port = 548
pass in proto tcp from 192.168.0.0/22 to any port = 548

設定確認。シンタックスエラーがでなければOK

$ pfctl -nf /etc/pf.conf 
pfctl: Use of -f option, could result in flushing of rules
present in the main ruleset added by the system at startup.
See /etc/pf.conf for further details.

設定反映

$ sudo pfctl -f /etc/pf.conf 
pfctl: Use of -f option, could result in flushing of rules
present in the main ruleset added by the system at startup.
See /etc/pf.conf for further details.

No ALTQ support in kernel
ALTQ related functions disabled

あとはnmap等で外形を確認。
セキュリティ的には、まずはblock allしてから個々にポートを開けるのが、多分正しい。

6
5
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
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?