table of contents
FIREWALLCTL(1) | firewallctl | FIREWALLCTL(1) |
NAME¶
firewallctl - firewalld command line client
SYNOPSIS¶
firewallctl [OPTIONS...]
DESCRIPTION¶
firewallctl is an alternate command line client of the firewalld daemon. It provides interface to manage runtime and permanent configuration.
The runtime configuration in firewalld is separated from the permanent configuration. This means that things can get changed in the runtime or permanent configuration.
OPTIONS¶
For sequence options, this are the options that can be specified multiple times, the exit code is 0 if there is at least one item that succeded. The ALREADY_ENABLED (11), NOT_ENABLED (12) and also ZONE_ALREADY_SET (16) errors are treated as succeeded. If there are issues while parsing the items, then these are treated as warnings and will not change the result as long as there is a succeeded one. Without any succeeded item, the exit code will depend on the error codes. If there is exactly one error code, then this is used. If there are more than one then UNKNOWN_ERROR (254) will be used.
The following options are supported:
General Options¶
-h, --help
-v, --verbose
-q, --quiet
Version Option¶
version
State Option¶
state
Reload Options¶
reload [ -c | --complete ]
With the -c | --complete option, reload firewall completely, even netfilter kernel modules. This will most likely terminate active connections, because state information is lost. This option should only be used in case of severe firewall problems. For example if there are state information problems that no connection can be established with correct firewall rules.
Runtime To Permanent Option¶
runtime-to-permanent
The way this is supposed to work is that when configuring firewalld you do runtime changes only and once you're happy with the configuration and you tested that it works the way you want, you save the configuration to disk.
List Options¶
list zones [ -a | --active | -p | --permanent ]
With the -a | --active option, only zones are listed, that are active. That means that the zones have interface or source bindings.
With the -p | --permanent option, zones in the permanent environment are listed.
list services [ -p | --permanent ]
With the -p | --permanent option, services in the permanent environment are listed.
list ipsets [ -p | --permanent ]
With the -p | --permanent option, ipsets in the permanent environment are listed.
list helpers [ -p | --permanent ]
With the -p | --permanent option, helpers in the permanent environment are listed.
list icmptypes [ -p | --permanent ]
With the -p | --permanent option, icmptypes in the permanent environment are listed.
Info Options¶
info zone zone [ -p | --permanent ]
zone
interfaces: interface1 ..
sources: source1 ..
services: service1 ..
ports: port1 ..
protocols: protocol1 ..
forward-ports:
forward-port1
..
source-ports: source-port1 ..
icmp-blocks: icmp-type1 ..
rich rules:
rich-rule1
..
With the -p | --permanent option, zones in the permanent environment are listed.
info zones [ -a | --active | -p | --permanent ]
zone
interfaces: interface1 ..
sources: source1 ..
services: service1 ..
ports: port1 ..
protocols: protocol1 ..
forward-ports:
forward-port1
..
source-ports: source-port1 ..
icmp-blocks: icmp-type1 ..
rich rules:
rich-rule1
..
With the -a | --active option, only zones are listed, that are active. That means that the zones have interface or source bindings.
With the -p | --permanent option, zones in the permanent environment are listed.
info service service [ -p | --permanent ]
service
ports: port1 ..
protocols: protocol1 ..
source-ports: source-port1 ..
modules: module1 ..
destination: ipv1:address1 ..
With the -p | --permanent option, services in the permanent environment are listed.
info services [ -p | --permanent ]
service
ports: port1 ..
protocols: protocol1 ..
source-ports: source-port1 ..
modules: module1 ..
destination: ipv1:address1 ..
With the -p | --permanent option, services in the permanent environment are listed.
info ipset ipset [ -p | --permanent ]
ipset
type: type
options: option1[=value1] ..
entries: entry1 ..
With the -p | --permanent option, ipsets in the permanent environment are listed.
info ipsets [ -p | --permanent ]
ipset
type: type
options: option1[=value1] ..
entries: entry1 ..
With the -p | --permanent option, ipsets in the permanent environment are listed.
info helper helper [ -p | --permanent ]
helper
family: family
module: module
ports: port1 ..
With the -p | --permanent option, helpers in the permanent environment are listed.
info helpers [ -p | --permanent ]
helper
family: family
module: module
ports: port1 ..
With the -p | --permanent option, helpers in the permanent environment are listed.
info icmptype icmptype [ -p | --permanent ]
icmptype
destination: ipv1 ..
With the -p | --permanent option, icmptypes in the permanent environment are listed.
info icmptypes [ -p | --permanent ]
icmptype
destination: ipv1 ..
With the -p | --permanent option, icmptypes in the permanent environment are listed.
Zone Options¶
zone zone [ -p | --permanent ] add element.. [ --timeout=timeval ]
If zone is the empty string "", the default zone will be used.
For possible zone elements see further down.
With the -p or --permanent option, elements are added in the permanent environment.
The --timeout option is not combinable with the --permanent option.
zone zone [ -p | --permanent ] remove element..
If zone is the empty string "", the default zone will be used.
For possible zone elements see further down.
With the -p or --permanent option, elements are added in the permanent environment.
zone zone [ -p | --permanent ] query element..
If zone is the empty string "", the default zone will be used.
For possible zone elements see further down.
With the -p or --permanent option, elements are added in the permanent environment.
zone zone [ -p | --permanent ] get { short | description }
If zone is the empty string "", the default zone will be used.
With the -p or --permanent option, elements are added in the permanent environment.
zone zone [ -p | --permanent ] set { short | description } text
If zone is the empty string "", the default zone will be used.
With the -p or --permanent option, elements are added in the permanent environment.
zone zone [ -p | --permanent ] list { interfaces | sources | services | ports | protocols | source-ports | rich-rules | forward-ports | icmp-blocks }
If zone is the empty string "", the default zone will be used.
With the -p or --permanent option, elements are added in the permanent environment.
zone zone { -p | --permanent } load-defaults
Zone Elements¶
A zone element can be one of:
interface interface
If the interface is under control of NetworkManager, it is at first connected to change the zone for the connection that is using the interface for new or changed interface bindings. If the setting in NetworkManager fails, the zone binding is created or changed in firewalld and the limitations below apply.
As a end user you don't need to create or change zone bindings of interfaces in most cases, because NetworkManager (or legacy network service) adds interfaces into zones automatically (according to ZONE= option from ifcfg-interface file) if NM_CONTROLLED=no is not set. You should do it only if there's no /etc/sysconfig/network-scripts/ifcfg-interface file. If there is such file and you add interface to zone with this --add-interface option, make sure the zone is the same in both cases, otherwise the behaviour would be undefined. Please also have a look at the firewalld(1) man page in the Concepts section. For permanent association of interface with a zone, see also 'How to set or change a zone for a connection?' in firewalld.zones(5).
For the addion or change of interfaces that are not under control of NetworkManager: firewalld tries to change the ZONE setting in the ifcfg file, if an ifcfg file exists that is using the interface.
Only for the removal of interfaces that are not under control of NetworkManager: firewalld is not trying to change the ZONE setting in the ifcfg file. This is needed to make sure that an ifdown of the interface will not result in a reset of the zone setting to the default zone. Only the zone binding is then removed in firewalld then.
source { address[/mask] | MAC | ipset:ipset }
service service
port portid[-portid]/protocol
protocol protocol
source-port portid[-portid]/protocol
rich-rule 'rule'
masquerade
Masquerading is useful if the machine is a router and machines connected over an interface in another zone should be able to use the first connection.
forward-port port=portid[-portid]:proto=protocol[:toport=portid[-portid]][:toaddr=address[/mask]]
The port can either be a single port number portid or a port range portid-portid. The protocol can either be tcp or udp. The destination address is a simple IP address.
For IPv6 forward ports, please use the rich language.
icmp-block icmptype
The icmptype is the one of the ICMP types firewalld supports. To get a listing of supported icmp types: firewallctl list icmptypes [ -p | --permanent ]
icmp-block-inversion
Service Options¶
service service [ -p | --permanent ] add element..
For possible service elements see further down.
With the -p or --permanent option, elements are added in the permanent environment.
service service [ -p | --permanent ] remove element..
For possible service elements see further down.
With the -p or --permanent option, elements are added in the permanent environment.
service service [ -p | --permanent ] query element..
For possible service elements see further down.
With the -p or --permanent option, elements are added in the permanent environment.
service service [ -p | --permanent ] get { short | description }
With the -p or --permanent option, elements are added in the permanent environment.
service service [ -p | --permanent ] set { short | description } text
With the -p or --permanent option, elements are added in the permanent environment.
service service [ -p | --permanent ] list { ports | protocols | source-ports | modules | destinations }
With the -p or --permanent option, elements are added in the permanent environment.
service service { -p | --permanent } load-defaults
Service Elements¶
A service element can be one of:
port portid[-portid]/protocol
protocol protocol
source-port portid[-portid]/protocol
module module
destination ipv:address[/mask]
Ipset Options¶
ipset ipset [ -p | --permanent ] add { entry entry | entries-from-file filename }..
For possible ipset entries see further down.
With the -p or --permanent option, elements are added in the permanent environment.
ipset ipset [ -p | --permanent ] remove { entry entry | entries-from-file filename | all }..
For possible ipset entries see further down.
With the -p or --permanent option, elements are added in the permanent environment.
ipset ipset [ -p | --permanent ] query { entry entry | entries-from-file filename }..
For possible ipset entries see further down.
With the -p or --permanent option, elements are added in the permanent environment.
ipset ipset [ -p | --permanent ] get { short | description }
With the -p or --permanent option, elements are added in the permanent environment.
ipset ipset [ -p | --permanent ] set { short | description } text
With the -p or --permanent option, elements are added in the permanent environment.
ipset ipset [ -p | --permanent ] list entries
With the -p or --permanent option, elements are added in the permanent environment.
ipset ipset { -p | --permanent } load-defaults
Ipset Entries¶
An ipset entry depends on the ipset type and family setting.
For ipset type hash:net:
ip[/cidr]
The address can be an IPv4 address if the family is set to inet or not set or an IPv6 address if the family is set to inet6.
For ipset type hash:ip:
ip[/cidr] | fromaddr-toaddr
The address can be an IPv4 address if the family is set to inet or not set or an IPv6 address if the family is set to inet6.
For ipset type hash:mac (not supported with older ipset and kernel versions):
mac
Helper Options¶
helper helper -p | --permanent { add | remove } port portid[-portid]/protocol
With the -p or --permanent option, elements are added in the permanent environment.
helper helper [ -p | --permanent ] query port portid[-portid]/protocol
With the -p or --permanent option, elements are added in the permanent environment.
helper helper [ -p | --permanent ] get { short | description }
With the -p or --permanent option, elements are added in the permanent environment.
helper helper [ -p | --permanent ] get family
helper helper [ -p | --permanent ] get module
helper helper -p | --permanent set { short | description } text
With the -p or --permanent option, elements are added in the permanent environment.
helper helper -p | --permanent set family
helper helper -p | --permanent set module
helper helper [ -p | --permanent ] list ports
With the -p or --permanent option, elements are added in the permanent environment.
helper helper { -p | --permanent } load-defaults
Icmptype Options¶
icmptype icmptype [ -p | --permanent ] { add | remove } destination { ipv4 | ipv6 }
With the -p or --permanent option, elements are added in the permanent environment.
icmptype icmptype [ -p | --permanent ] query destination { ipv4 | ipv6 }
With the -p or --permanent option, elements are added in the permanent environment.
icmptype icmptype [ -p | --permanent ] get { short | description }
With the -p or --permanent option, elements are added in the permanent environment.
icmptype icmptype [ -p | --permanent ] set { short | description } text
With the -p or --permanent option, elements are added in the permanent environment.
icmptype icmptype [ -p | --permanent ] list destinations
With the -p or --permanent option, elements are added in the permanent environment.
icmptype icmptype { -p | --permanent } load-defaults
New Options¶
new { -p | --permanent } zone { { -n | --name } name | { -f | --filename} filename [ { -n | --name } name } ] }
The zone will only be usable in the runtime environment after a reload.
new { -p | --permanent } service { { -n | --name } name | { -f | --filename} filename [ { -n | --name } name } ] }
The service will only be usable in the runtime environment after a reload.
new { -p | --permanent } ipset { { -n | --name } name { -t | --type } ipsettype [ { -o | --option } option[=value] ] | { -f | --filename} filename [ { -n | --name } name } ] }
For valid ipset options please have a look at firewalld.ipset(5).
The ipset will only be usable in the runtime environment after a reload.
new { -p | --permanent } icmptype { { -n | --name } name | { -f | --filename} filename [ { -n | --name } name } ] }
The icmptype will only be usable in the runtime environment after a reload.
Delete Options¶
delete { -p | --permanent } zone zone
The zone will be part of the runtime environment until a reload.
delete { -p | --permanent } service service
The service will be part of the runtime environment until a reload.
delete { -p | --permanent } ipset ipset
The ipset will be part of the runtime environment until a reload.
delete { -p | --permanent } icmptype icmptype
The icmptype will be part of the runtime environment until a reload.
Direct Options¶
direct [ -p | --permanent ] { add | remove } chain { ipv4 | ipv6 | eb } table chain
There already exist basic chains to use with direct options, for example INPUT_direct chain (see iptables-save | grep direct output for all of them). These chains are jumped into before chains for zones, i.e. every rule put into INPUT_direct will be checked before rules in zones.
direct [ -p | --permanent ] query chain { ipv4 | ipv6 | eb } table chain
direct [ -p | --permanent ] get chains { ipv4 | ipv6 | eb } table
direct [ -p | --permanent ] get all-chains
direct [ -p | --permanent ] { add | remove } rule { ipv4 | ipv6 | eb } table chain priority args
The priority is used to order rules. Priority 0 means add rule on top of the chain, with a higher priority the rule will be added further down. Rules with the same priority are on the same level and the order of these rules is not fixed and may change. If you want to make sure that a rule will be added after another one, use a low priority for the first and a higher for the following.
direct [ -p | --permanent ] query rule { ipv4 | ipv6 | eb } table chain priority args
direct [ -p | --permanent ] get all-rules
direct [ -p | --permanent ] get rules { ipv4 | ipv6 | eb } table chain
direct [ -p | --permanent ] { add | remove } passthrough { ipv4 | ipv6 | eb } args
direct [ -p | --permanent ] query passthrough { ipv4 | ipv6 | eb } args
direct [ -p | --permanent ] get all-passthroughs
direct [ -p | --permanent ] get passthroughs { ipv4 | ipv6 | eb }
direct passthrough { ipv4 | ipv6 | eb } args
Lockdown Whitelist Options¶
Local applications or services are able to change the firewall configuration if they are running as root (example: libvirt) or are authenticated using PolicyKit. With this feature administrators can lock the firewall configuration so that only applications on lockdown whitelist are able to request firewall changes.
The lockdown access check limits D-Bus methods that are changing firewall rules. Query, list and get methods are not limited.
The lockdown feature is a very light version of user and application policies for firewalld and is turned off by default.
lockdown-whitelist [ -p | --permanent ] { add | remove } element..
For possible lockdown whitelist elements see further down.
With the -p or --permanent option, elements are added in the permanent environment.
lockdown-whitelist [ -p | --permanent ] query element..
For possible lockdown whitelist elements see further down.
With the -p or --permanent option, elements are added in the permanent environment.
lockdown-whitelist [ -p | --permanent ] list { commands | contexts | uids | users }
With the -p or --permanent option, elements are added in the permanent environment.
Lockdown Whitelist Elements¶
The lockdown whitelist can contain commands, contexts, users and user ids.
If a command entry on the whitelist ends with an asterisk '*', then all command lines starting with the command will match. If the '*' is not there the absolute command inclusive arguments must match.
Commands for user root and others is not always the same. Example: As root /bin/firewall-cmd is used, as a normal user /usr/bin/firewall-cmd is be used on Fedora.
The context is the security (SELinux) context of a running application or service. To get the context of a running application use ps -e --context.
Warning: If the context is unconfined, then this will open access for more than the desired application.
The lockdown whitelist entries are checked in the following order:
A lockdown whitelist element can be one of:
command 'string'
If a command entry ends with an asterisk '*', then all command lines starting with the command will match. If the '*' is not there the absolute command inclusive arguments must match.
Commands for user root and others is not always the same, the used path depends on the use of the PATH environment variable.
context string
To get the context of a running application use ps -e --context and search for the application that should be white-listed.
Warning: If the context of an application is unconfined, then this will open access for more than the desired application.
user string
uid integer
Config Options¶
config set { default-zone zone | lockdown { on | off } | log-denied value | panic { on | off } }
The possible config options are:
default-zone zone
lockdown
log-denied
panic
After disabling panic mode established connections might work again, if panic mode was enabled for a short period of time.
config list
config get { default-zone | lockdown | log-denied | panic }
The possible config options are:
default-zone
lockdown
log-denied
panic
Settings Options¶
settings list
settings get { BRIDGE | CleanupOnExit | IPSet | IPSetTypes | IPv4 | IPv6 | IPv6_rpfilter | IndividualCalls | MinimalMark }
The supported settings are:
BRIDGE
CleanupOnExit
IPSet
IPSetTypes
IPv4
IPv6
IPv6_rpfilter
The IPv6 rpfiler performs a reverse path filter test on a packet for IPv6. If a reply to the packet would be sent via the same interface that the packet arrived on, the packet will match and be accepted, otherwise dropped. The rp_filter for IPv4 is controlled using sysctl.
IndividualCalls
If disabled, combined -restore calls are not used, but individual calls. This increases the time that is needed to apply changes and to start the daemon, but is good for debugging.
MinimalMark
Marks up to this minimum are free for use for example in the direct interface. If more free marks are needed, increase the minimum in the firewalld.conf file.
EXIT CODES¶
On success 0 is returned. On failure the output is red colored and exit code is either 2 in case of wrong command-line option usage or one of the following error codes in other cases:
String | Code |
ALREADY_ENABLED | 11 |
NOT_ENABLED | 12 |
COMMAND_FAILED | 13 |
NO_IPV6_NAT | 14 |
PANIC_MODE | 15 |
ZONE_ALREADY_SET | 16 |
UNKNOWN_INTERFACE | 17 |
ZONE_CONFLICT | 18 |
BUILTIN_CHAIN | 19 |
EBTABLES_NO_REJECT | 20 |
NOT_OVERLOADABLE | 21 |
NO_DEFAULTS | 22 |
BUILTIN_ZONE | 23 |
BUILTIN_SERVICE | 24 |
BUILTIN_ICMPTYPE | 25 |
NAME_CONFLICT | 26 |
NAME_MISMATCH | 27 |
PARSE_ERROR | 28 |
ACCESS_DENIED | 29 |
UNKNOWN_SOURCE | 30 |
RT_TO_PERM_FAILED | 31 |
IPSET_WITH_TIMEOUT | 32 |
BUILTIN_IPSET | 33 |
ALREADY_SET | 34 |
MISSING_IMPORT | 35 |
DBUS_ERROR | 36 |
BUILTIN_HELPER | 37 |
NOT_APPLIED | 38 |
INVALID_ACTION | 100 |
INVALID_SERVICE | 101 |
INVALID_PORT | 102 |
INVALID_PROTOCOL | 103 |
INVALID_INTERFACE | 104 |
INVALID_ADDR | 105 |
INVALID_FORWARD | 106 |
INVALID_ICMPTYPE | 107 |
INVALID_TABLE | 108 |
INVALID_CHAIN | 109 |
INVALID_TARGET | 110 |
INVALID_IPV | 111 |
INVALID_ZONE | 112 |
INVALID_PROPERTY | 113 |
INVALID_VALUE | 114 |
INVALID_OBJECT | 115 |
INVALID_NAME | 116 |
INVALID_FILENAME | 117 |
INVALID_DIRECTORY | 118 |
INVALID_TYPE | 119 |
INVALID_SETTING | 120 |
INVALID_DESTINATION | 121 |
INVALID_RULE | 122 |
INVALID_LIMIT | 123 |
INVALID_FAMILY | 124 |
INVALID_LOG_LEVEL | 125 |
INVALID_AUDIT_TYPE | 126 |
INVALID_MARK | 127 |
INVALID_CONTEXT | 128 |
INVALID_COMMAND | 129 |
INVALID_USER | 130 |
INVALID_UID | 131 |
INVALID_MODULE | 132 |
INVALID_PASSTHROUGH | 133 |
INVALID_MAC | 134 |
INVALID_IPSET | 135 |
INVALID_ENTRY | 136 |
INVALID_OPTION | 137 |
INVALID_HELPER | 138 |
MISSING_TABLE | 200 |
MISSING_CHAIN | 201 |
MISSING_PORT | 202 |
MISSING_PROTOCOL | 203 |
MISSING_ADDR | 204 |
MISSING_NAME | 205 |
MISSING_SETTING | 206 |
MISSING_FAMILY | 207 |
NOT_RUNNING | 252 |
NOT_AUTHORIZED | 253 |
UNKNOWN_ERROR | 254 |
SEE ALSO¶
firewall-applet(1), firewalld(1), firewall-cmd(1), firewall-config(1), firewallctl(1), firewalld.conf(5), firewalld.direct(5), firewalld.dbus(5), firewalld.icmptype(5), firewalld.lockdown-whitelist(5), firewall-offline-cmd(1), firewalld.richlanguage(5), firewalld.service(5), firewalld.zone(5), firewalld.zones(5), firewalld.ipset(5), firewalld.helper(5)
NOTES¶
firewalld home page:
More documentation with examples:
AUTHORS¶
Thomas Woerner <twoerner@redhat.com>
Jiri Popelka <jpopelka@redhat.com>
firewalld 0.4.4.5 |