首页 技术 正文
技术 2022年11月21日
0 收藏 682 点赞 4,675 浏览 2343 个字

osx firewall configuration file is : /Library/Preferences/com.apple.alf.plist

the default plist and firewall programs are under:/usr/libexec/ApplicationFirewall

To configure the firewall to block all incoming traffic:

  /usr/libexec/ApplicationFirewall/socketfilterfw --setblockall on

To see if block all is enabled:

  /usr/libexec/ApplicationFirewall/socketfilterfw --getblockall

  The output would be as follows, if successful:

    Firewall is set to block all non-essential incoming connections

A couple of global options that can be set. Stealth Mode:

  /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode on

To check if stealth mode is enabled:

  /usr/libexec/ApplicationFirewall/socketfilterfw --getstealthmode

To turn on firewall logging:

  /usr/libexec/ApplicationFirewall/socketfilterfw --setloggingmode on

To control the verbosity of logs, using throttled, brief or detail:

  /usr/libexec/ApplicationFirewall/socketfilterfw --setloggingopt: detail

To start the firewall:

  /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on

To sanity check whether it’s started:

  /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate

To allow signed applications:

  /usr/libexec/ApplicationFirewall/socketfilterfw --setallowsigned on

To check if you allow signed apps:

  /usr/libexec/ApplicationFirewall/socketfilterfw --getallowsigned

To show the status of each filtered application:

  /usr/libexec/ApplicationFirewall/socketfilterfw --listapps

To check if an app is blocked:

  /usr/libexec/ApplicationFirewall/socketfilterfw –getappblocked /Applications/MyApp.app/Contents/MacOS/myapp

This shows the number of exceptions, explicitly allowed apps and signed exceptions as well as process names and allowed app statuses. There is also a list of TRUSTEDAPPS, which will initially be populated by Apple tools with sharing capabilities (e.g. httpd & smbd). If you are enabling the firewall using a script, first sign your applications that need to allow sharing but are not in the TRUSTEDAPPS section by using the -s option along with the application binary (not the .app bundle):

    /usr/libexec/ApplicationFirewall/socketfilterfw -s /Applications/MyApp.app/Contents/MacOS/myapp

  Once signed, verify the signature:

    /usr/libexec/ApplicationFirewall/socketfilterfw -v /Applications/MyApp.app/Contents/MacOS/myapp

  Once signed, trust the application using the –add option:

    /usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/MyApp.app/Contents/MacOS/myapp

To see a list of trusted applications:

  /usr/libexec/ApplicationFirewall/socketfilterfw -l

下一篇: onchange 事件
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,000
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,512
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,358
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,141
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,771
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,849