回答这个真正的问题,关于如何创建自己的应用程序文件,你只需要知道它使用的是Windows INI文件格式。
[appname]
title=1-liner here
description=a longer line here
ports=1,2,3,4,5,6,7,8,9,10,30/tcp|50/udp|53
端口行可以指定多个端口,使用/udp或/tcp来限制协议,否则默认为两者皆可。你必须用|分隔协议部分。
所以,我做了一些真实的示例:
[puppet]
title=puppet configuration manager
description=Puppet Open Source from http://www.puppetlabs.com/
ports=80,443,8140/tcp
[AMANDA]
title=AMANDA Backup
description=AMANDA the Advanced Maryland Automatic Network Disk Archiver
ports=10080
你可以在一个文件中列出多个应用程序的版本,就像apache的这个例子一样。
===start of apache2.2-common file===
[Apache]
title=Web Server
description=Apache v2 is the next generation of the omnipresent Apache web server.
ports=80/tcp
[Apache Secure]
title=Web Server (HTTPS)
description=Apache v2 is the next generation of the omnipresent Apache web server.
ports=443/tcp
[Apache Full]
title=Web Server (HTTP,HTTPS)
description=Apache v2 is the next generation of the omnipresent Apache web server.
ports=80,443/tcp
===end of file===
一旦你定义了应用程序文件,请将其放入
/etc/ufw/applications.d
目录下,然后告诉ufw重新加载应用程序定义。
ufw app update appname
ufw app info appname
使用它与类似的东西一起。
ufw allow from 192.168.1.10 to any app amanda
ufw allow amanda
假设192.168.1.10是您的Amanda服务器的IP地址。
xx/tcp|yy/udp
。换句话说,协议之间的分隔应该是一个竖线,而不是逗号,就像你的例子中那样。 - Hilikusnetstat
来查找应用程序名称...这样做对吗?至少对我来说是有效的。它区分大小写吗?我不太确定应用程序文件中的 "appname" 与标题以及进程名称之间的关系是什么。 - intcreatorxx/tcp,xy/tcp,xz/tcp
还是xx/tcp|xy/tcp|xz/tcp
? - errolflynnports=1|2|3|4|5/udp|6/udp|7|8/tcp|9/tcp|10|30/tcp|50/udp|53
。 - Micah Henning