fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
0df6fa791
master
1function __fish_print_firewalld_zones --description"Print list of predefined firewalld zones" 2firewall-cmd --get-zones| string split" " 3end 4 5function __fish_print_firewalld_policies --description"Print list of predefined firewalld policies" 6firewall-cmd --get-policies| string split" " 7end 8 9function __fish_print_firewalld_services --description"Print list of predefined firewalld services" 10firewall-cmd --get-services| string split" " 11end 12 13function __fish_print_firewalld_icmptypes --description"Print list of ICMP types supported by firewalld" 14firewall-cmd --get-icmptypes| string split" " 15end 16 17function __fish_print_firewalld_helpers --description"Print list of predefined firewalld helpers" 18firewall-cmd --get-helpers| string split" " 19end 20 21function __fish_print_firewalld_protocols --description"Print list of protocols supported by firewalld" 22string replace -f -r'^([[:alnum:]]\S*).*' '$1' < /etc/protocols 23end 24 25complete -c firewall-cmd -f 26 27# General Options 28complete -c firewall-cmd -s h -l help -d"Prints a short help text and exits" 29complete -c firewall-cmd -s V -l version -d"Print the version string of firewalld" 30complete -c firewall-cmd -s q -l quiet -d"Do not print status messages" 31 32# Status Options 33complete -c firewall-cmd -l state -d"Check whether the firewalld daemon is active" 34complete -c firewall-cmd -l reload -d"Reload firewall rules and keep state information" 35complete -c firewall-cmd -l complete-reload -d"Reload firewall completely, even netfilter kernel modules" 36complete -c firewall-cmd -l runtime-to-permanent -d"Save active runtime configuration and overwrite permanent configuration" 37complete -c firewall-cmd -l check-config -d"Run checks on the permanent configuration" 38 39# Log Denied Options 40complete -c firewall-cmd -l get-log-denied -d"Print the log denied setting" 41complete -c firewall-cmd -l set-log-denied -xa"all unicast broadcast multicast off" -d"Add logging rules right before reject and drop rules" 42 43# Permanent Options 44complete -c firewall-cmd -l permanent -d"Set options permanently" 45 46# Zone Options 47complete -c firewall-cmd -l get-default-zone -d"Print default zone for connections and interfaces" 48complete -c firewall-cmd -l set-default-zone -xa"(__fish_print_firewalld_zones)" -d"Set default zone for connections and interfaces" 49complete -c firewall-cmd -l get-active-zones -d"Print currently active zones altogether with interfaces and sources" 50complete -c firewall-cmd -l get-zones -d"Print predefined zones" 51complete -c firewall-cmd -l get-services -d"Print predefined services" 52complete -c firewall-cmd -l get-icmptypes -d"Print predefined icmptypes" 53complete -c firewall-cmd -l get-zone-of-interface -xa"(__fish_print_interfaces)" -d"Print the name of the zone the interface is bound to" 54complete -c firewall-cmd -l get-zone-of-source -x -d"Print the name of the zone the source is bound to" 55complete -c firewall-cmd -l info-zone -xa"(__fish_print_firewalld_zones)" -d"Print information about the zone" 56complete -c firewall-cmd -l list-all-zones -d"List everything added for or enabled in all zones" 57complete -c firewall-cmd -l new-zone -x -d"Add a new permanent and empty zone" 58complete -c firewall-cmd -l new-zone-from-file -F -d"Add a new permanent zone from a prepared zone file" 59complete -c firewall-cmd -l delete-zone -xa"(__fish_print_firewalld_zones)" -d"Delete an existing permanent zone" 60complete -c firewall-cmd -l load-zone-defaults -xa"(__fish_print_firewalld_zones)" -d"Load zone default settings" 61complete -c firewall-cmd -l path-zone -xa"(__fish_print_firewalld_zones)" -d"Print path of the zone configuration file" 62 63# Policy Options 64complete -c firewall-cmd -l get-policies -d"Print predefined policies" 65complete -c firewall-cmd -l info-policy -xa"(__fish_print_firewalld_policies)" -d"Print information about the policy" 66complete -c firewall-cmd -l list-all-policies -d"List everything added for or enabled in all policies" 67complete -c firewall-cmd -l new-policy -x -d"Add a new permanent policy" 68complete -c firewall-cmd -l new-policy-from-file -F -d"Add a new permanent policy from a prepared policy file" 69complete -c firewall-cmd -l path-policy -xa"(__fish_print_firewalld_policies)" -d"Print path of the policy configuration file" 70complete -c firewall-cmd -l delete-policy -xa"(__fish_print_firewalld_policies)" -d"Delete an existing permanent policy" 71complete -c firewall-cmd -l load-policy-defaults -xa"(__fish_print_firewalld_policies)" -d"Load the shipped defaults for a policy" 72 73# Options to Adapt and Query Zones and Policies 74complete -c firewall-cmd -l zone -xa"(__fish_print_firewalld_zones)" -d"Apply option to this zone" 75complete -c firewall-cmd -l policy -xa"(__fish_print_firewalld_policies)" -d"Apply option to this policy" 76complete -c firewall-cmd -l get-target -d"Get the target" 77complete -c firewall-cmd -l set-target -xa"default CONTINUE ACCEPT DROP REJECT" -d"Set the target" 78complete -c firewall-cmd -l list-all -d"List everything added for or enabled" 79complete -c firewall-cmd -l list-services -d"List services added" 80complete -c firewall-cmd -l add-service -xa"(__fish_print_firewalld_services)" -d"Add a service" 81complete -c firewall-cmd -l remove-service -xa"(__fish_print_firewalld_services)" -d"Remove a service" 82complete -c firewall-cmd -l query-service -xa"(__fish_print_firewalld_services)" -d"Return whether service has been added" 83complete -c firewall-cmd -l list-ports -d"List ports added" 84complete -c firewall-cmd -l list-protocols -d"List protocols added" 85complete -c firewall-cmd -l list-source-ports -d"List source ports added" 86complete -c firewall-cmd -l list-icmp-blocks -d"List ICMPs type blocks added" 87complete -c firewall-cmd -l add-icmp-block -xa"(__fish_print_firewalld_icmptypes)" -d"Add an ICMP block for icmptype" 88complete -c firewall-cmd -l remove-icmp-block -xa"(__fish_print_firewalld_icmptypes)" -d"Remove the ICMP block for icmptype" 89complete -c firewall-cmd -l query-icmp-block -xa"(__fish_print_firewalld_icmptypes)" -d"Return whether an ICMP block for icmptype has been added" 90complete -c firewall-cmd -l list-forward-ports -d"List IPv4 forward ports added" 91complete -c firewall-cmd -l add-forward-port -x -d"Add the IPv4 forward port" 92complete -c firewall-cmd -l remove-forward-port -x -d"Remove the IPv4 forward port" 93complete -c firewall-cmd -l query-forward-port -x -d"Return whether the IPv4 forward port has been added" 94complete -c firewall-cmd -l add-masquerade -d"Enable IPv4 masquerade" 95complete -c firewall-cmd -l remove-masquerade -d"Disable IPv4 masquerade" 96complete -c firewall-cmd -l query-masquerade -d"Return whether IPv4 masquerading has been enabled" 97complete -c firewall-cmd -l list-rich-rules -d"List rich language rules added" 98complete -c firewall-cmd -l add-rich-rule -x -d"Add rich language rule" 99complete -c firewall-cmd -l remove-rich-rule -x -d"Remove rich language rule" 100complete -c firewall-cmd -l query-rich-rule -x -d"Return whether the rich language rule has been added" 101complete -c firewall-cmd -l timeout -x -d"The rule will be active for the specified amount of time" 102 103# Options to Adapt and Query Zones 104complete -c firewall-cmd -l add-icmp-block-inversion -d"Enable ICMP block inversion" 105complete -c firewall-cmd -l remove-icmp-block-inversion -d"Disable ICMP block inversion" 106complete -c firewall-cmd -l query-icmp-block-inversion -d"Return whether ICMP block inversion is enabled" 107complete -c firewall-cmd -l add-forward -d"Enable intra zone forwarding" 108complete -c firewall-cmd -l remove-forward -d"Disable intra zone forwarding" 109complete -c firewall-cmd -l query-forward -d"Return whether intra zone forwarding is enabled" 110 111# Options to Adapt and Query Policies 112complete -c firewall-cmd -l get-priority -d"Get the priority" 113complete -c firewall-cmd -l set-priority -x -d"Set the priority" 114complete -c firewall-cmd -l list-ingress-zones -d"List ingress zones added" 115complete -c firewall-cmd -l add-ingress-zone -xa"(__fish_print_firewalld_zones) HOST ANY" -d"Add an ingress zone" 116complete -c firewall-cmd -l remove-ingress-zone -xa"(__fish_print_firewalld_zones) HOST ANY" -d"Remove an ingress zone" 117complete -c firewall-cmd -l query-ingress-zone -xa"(__fish_print_firewalld_zones) HOST ANY" -d"Return whether zone has been added" 118complete -c firewall-cmd -l list-egress-zones -d"List egress zones added" 119complete -c firewall-cmd -l add-egress-zone -xa"(__fish_print_firewalld_zones) HOST ANY" -d"Add an egress zone" 120complete -c firewall-cmd -l remove-egress-zone -xa"(__fish_print_firewalld_zones) HOST ANY" -d"Remove an egress zone" 121complete -c firewall-cmd -l query-egress-zone -xa"(__fish_print_firewalld_zones) HOST ANY" -d"Return whether zone has been added" 122 123# Options to Handle Bindings of Interfaces 124complete -c firewall-cmd -l list-interfaces -d"List interfaces that are bound to zone" 125complete -c firewall-cmd -l add-interface -xa"(__fish_print_interfaces)" -d"Bind interface to zone" 126complete -c firewall-cmd -l change-interface -xa"(__fish_print_interfaces)" -d"Change to which zone interface is bound" 127complete -c firewall-cmd -l query-interface -xa"(__fish_print_interfaces)" -d"Query whether interface is bound to zone" 128complete -c firewall-cmd -l remove-interface -xa"(__fish_print_interfaces)" -d"Remove binding of interface from zone" 129 130# Options to Handle Bindings of Sources 131complete -c firewall-cmd -l list-sources -d"List sources that are bound to zone" 132complete -c firewall-cmd -l add-source -x -d"Bind the source to zone" 133complete -c firewall-cmd -l change-source -x -d"Change zone the source is bound to" 134complete -c firewall-cmd -l query-source -x -d"Query whether the source is bound to the zone" 135complete -c firewall-cmd -l remove-source -x -d"Remove binding of the source from zone" 136 137# IPSet Options 138complete -c firewall-cmd -l get-ipset-types -d"Print the supported ipset types" 139complete -c firewall-cmd -l new-ipset -x -d"Add a new permanent and empty ipset" 140complete -c firewall-cmd -l type -x -d"Specify ipset type" 141complete -c firewall-cmd -l option -x -d"Options for new ipset" 142complete -c firewall-cmd -l new-ipset-from-file -F -d"Add a new permanent ipset from a prepared ipset file" 143complete -c firewall-cmd -l delete-ipset -x -d"Delete an existing permanent ipset" 144complete -c firewall-cmd -l load-ipset-defaults -x -d"Load ipset default settings" 145complete -c firewall-cmd -l info-ipset -x -d"Print information about the ipset" 146complete -c firewall-cmd -l get-ipsets -d"Print predefined ipsets" 147complete -c firewall-cmd -l ipset -x -d"Apply settings to this ipset" 148complete -c firewall-cmd -l add-entry -x -d"Add a new entry to the ipset" 149complete -c firewall-cmd -l remove-entry -x -d"Remove an entry from the ipset" 150complete -c firewall-cmd -l query-entry -x -d"Return whether the entry has been added to an ipset" 151complete -c firewall-cmd -l get-entries -d"List all entries of the ipset" 152complete -c firewall-cmd -l add-entries-from-file -F -d"Add new entries to the ipset from the file" 153complete -c firewall-cmd -l remove-entries-from-file -F -d"Remove existing entries from the ipset from the file" 154complete -c firewall-cmd -l path-ipset -d"Print path of the ipset configuration file" 155 156# Service Options 157complete -c firewall-cmd -l info-service -xa"(__fish_print_firewalld_services)" -d"Print information about the service" 158complete -c firewall-cmd -l new-service -x -d"Add a new permanent and empty service" 159complete -c firewall-cmd -l new-service-from-file -F -d"Add a new permanent service from a prepared service file" 160complete -c firewall-cmd -l delete-service -xa"(__fish_print_firewalld_services)" -d"Delete an existing permanent service" 161complete -c firewall-cmd -l load-service-defaults -xa"(__fish_print_firewalld_services)" -d"Load service default settings" 162complete -c firewall-cmd -l path-service -xa"(__fish_print_firewalld_services)" -d"Print path of the service configuration file" 163complete -c firewall-cmd -l service -xa"(__fish_print_firewalld_services)" -d"Apply settings to this service" 164complete -c firewall-cmd -l get-protocols -d"List protocols added to the permanent service" 165complete -c firewall-cmd -l get-source-ports -d"List source ports added to the permanent service" 166complete -c firewall-cmd -l add-helper -xa"(__fish_print_firewalld_helpers)" -d"Add a new helper to the permanent service" 167complete -c firewall-cmd -l remove-helper -xa"(__fish_print_firewalld_helpers)" -d"Remove a helper from the permanent service" 168complete -c firewall-cmd -l query-helper -xa"(__fish_print_firewalld_helpers)" -d"Return whether the helper has been added to the permanent service" 169complete -c firewall-cmd -l get-service-helpers -d"List helpers added to the permanent service" 170complete -c firewall-cmd -l set-destination -x -d"Set destination for ipv to address[/mask] in the permanent service" 171complete -c firewall-cmd -l add-include -xa"(__fish_print_firewalld_services)" -d"Add a new include to the permanent service" 172complete -c firewall-cmd -l remove-include -xa"(__fish_print_firewalld_services)" -d"Remove a include from the permanent service" 173complete -c firewall-cmd -l query-include -xa"(__fish_print_firewalld_services)" -d"Return whether the include has been added to the permanent service" 174complete -c firewall-cmd -l get-includes -d"List includes added to the permanent service" 175 176# Helper Options 177complete -c firewall-cmd -l info-helper -xa"(__fish_print_firewalld_helpers)" -d"Print information about the helper" 178complete -c firewall-cmd -l new-helper -x -d"Add a new permanent helper" 179complete -c firewall-cmd -l module -x -d"Specify module for new helper" 180complete -c firewall-cmd -l new-helper-from-file -F -d"Add a new permanent helper from a prepared helper file" 181complete -c firewall-cmd -l delete-helper -xa"(__fish_print_firewalld_helpers)" -d"Delete an existing permanent helper" 182complete -c firewall-cmd -l load-helper-defaults -xa"(__fish_print_firewalld_helpers)" -d"Load helper default settings" 183complete -c firewall-cmd -l path-helper -xa"(__fish_print_firewalld_helpers)" -d"Print path of the helper configuration file" 184complete -c firewall-cmd -l get-helpers -d"Print predefined helpers as a space separated list" 185complete -c firewall-cmd -l helper -xa"(__fish_print_firewalld_helpers)" -d"Apply settings to this helper" 186complete -c firewall-cmd -l set-module -x -d"Set module description for helper" 187complete -c firewall-cmd -l get-module -d"Print module description for helper" 188complete -c firewall-cmd -l set-family -x -d"Set family description for helper" 189complete -c firewall-cmd -l get-family -d"Print family description of helper" 190 191# Internet Control Message Protocol (ICMP) type Options 192complete -c firewall-cmd -l info-icmptype -xa"(__fish_print_firewalld_icmptypes)" -d"Print information about the icmptype" 193complete -c firewall-cmd -l new-icmptype -x -d"Add a new permanent and empty icmptype" 194complete -c firewall-cmd -l new-icmptype-from-file -F -d"Add a new permanent icmptype from a prepared icmptype file" 195complete -c firewall-cmd -l delete-icmptype -xa"(__fish_print_firewalld_icmptypes)" -d"Delete an existing permanent icmptype" 196complete -c firewall-cmd -l load-icmptype-defaults -xa"(__fish_print_firewalld_icmptypes)" -d"Load icmptype default settings" 197complete -c firewall-cmd -l icmptype -xa"(__fish_print_firewalld_icmptypes)" -d"Apply settings to this icmptype" 198complete -c firewall-cmd -l add-destination -xa"ipv4 ipv6" -d"Enable destination for ipv in permanent icmptype" 199complete -c firewall-cmd -l path-icmptype -xa"(__fish_print_firewalld_icmptypes)" -d"Print path of the icmptype configuration file" 200 201# Direct Options 202complete -c firewall-cmd -l direct -d"Give a more direct access to the firewall" 203complete -c firewall-cmd -l get-all-chains -d"Get all chains added to all tables" 204complete -c firewall-cmd -l get-chains -xa"ipv4 ipv6 eb" -d"Get all chains added to table" 205complete -c firewall-cmd -l add-chain -xa"ipv4 ipv6 eb" -d"Add a new chain to table" 206complete -c firewall-cmd -l remove-chain -xa"ipv4 ipv6 eb" -d"Remove chain from table" 207complete -c firewall-cmd -l query-chain -xa"ipv4 ipv6 eb" -d"Return whether the chain with given name exists in table" 208complete -c firewall-cmd -l get-all-rules -d"Get all rules added to all chains in all tables" 209complete -c firewall-cmd -l get-rules -xa"ipv4 ipv6 eb" -d"Get all rules added to chain in table" 210complete -c firewall-cmd -l add-rule -xa"ipv4 ipv6 eb" -d"Add a rule to chain in table" 211complete -c firewall-cmd -l remove-rule -xa"ipv4 ipv6 eb" -d"Remove a rule from chain in table" 212complete -c firewall-cmd -l remove-rules -xa"ipv4 ipv6 eb" -d"Remove all rules in the chain in table" 213complete -c firewall-cmd -l query-rule -xa"ipv4 ipv6 eb" -d"Return whether the rule exists in chain in table" 214complete -c firewall-cmd -l passthrough -xa"ipv4 ipv6 eb" -d"Pass a command through to the firewall" 215complete -c firewall-cmd -l get-all-passthroughs -d"Get all passthrough rules" 216complete -c firewall-cmd -l get-passthroughs -xa"ipv4 ipv6 eb" -d"Get all passthrough rules for the ipv value" 217complete -c firewall-cmd -l add-passthrough -xa"ipv4 ipv6 eb" -d"Add a passthrough rule" 218complete -c firewall-cmd -l remove-passthrough -xa"ipv4 ipv6 eb" -d"Remove a passthrough rule" 219complete -c firewall-cmd -l query-passthrough -xa"ipv4 ipv6 eb" -d"Return whether the passthrough rule exists" 220 221# Lockdown Options 222complete -c firewall-cmd -l lockdown-on -d"Enable lockdown" 223complete -c firewall-cmd -l lockdown-off -d"Disable lockdown" 224complete -c firewall-cmd -l query-lockdown -d"Query whether lockdown is enabled" 225 226# Lockdown Whitelist Options 227complete -c firewall-cmd -l list-lockdown-whitelist-commands -d"List all command lines that are on the whitelist" 228complete -c firewall-cmd -l add-lockdown-whitelist-command -x -d"Add the command to the whitelist" 229complete -c firewall-cmd -l remove-lockdown-whitelist-command -x -d"Remove the command from the whitelist" 230complete -c firewall-cmd -l query-lockdown-whitelist-command -x -d"Query whether the command is on the whitelist" 231complete -c firewall-cmd -l list-lockdown-whitelist-contexts -d"List all contexts that are on the whitelist" 232complete -c firewall-cmd -l add-lockdown-whitelist-context -x -d"Add the context to the whitelist" 233complete -c firewall-cmd -l remove-lockdown-whitelist-context -x -d"Remove the context from the whitelist" 234complete -c firewall-cmd -l query-lockdown-whitelist-context -x -d"Query whether the context is on the whitelist" 235complete -c firewall-cmd -l list-lockdown-whitelist-uids -d"List all user ids that are on the whitelist" 236complete -c firewall-cmd -l add-lockdown-whitelist-uid -x -d"Add the user id to the whitelist" 237complete -c firewall-cmd -l remove-lockdown-whitelist-uid -x -d"Remove the user id from the whitelist" 238complete -c firewall-cmd -l query-lockdown-whitelist-uid -x -d"Query whether the user id is on the whitelist" 239complete -c firewall-cmd -l list-lockdown-whitelist-users -d"List all user names that are on the whitelist" 240complete -c firewall-cmd -l add-lockdown-whitelist-user -xa"(__fish_complete_users)" -d"Add the user to the whitelist" 241complete -c firewall-cmd -l remove-lockdown-whitelist-user -xa"(__fish_complete_users)" -d"Remove the user from the whitelist" 242complete -c firewall-cmd -l query-lockdown-whitelist-user -xa"(__fish_complete_users)" -d"Query whether the user is on the whitelist" 243 244# Panic Options 245complete -c firewall-cmd -l panic-on -d"Enable panic mode" 246complete -c firewall-cmd -l panic-off -d"Disable panic mode" 247complete -c firewall-cmd -l query-panic -d"Returns 0 if panic mode is enabled, 1 otherwise" 248 249# Object independent options 250complete -c firewall-cmd -l set-description -x -d"Set new description for zone|policy|ipset|service|helper|icmptype" 251complete -c firewall-cmd -l get-description -d"Print description of zone|policy|ipset|service|helper|icmptype" 252complete -c firewall-cmd -l set-short -x -d"Set short description for zone|policy|ipset|service|helper|icmptype" 253complete -c firewall-cmd -l get-short -d"Print short description of zone|policy|ipset|service|helper|icmptype" 254complete -c firewall-cmd -l name -x -d"Name for new zone|policy|ipset|service|helper|icmptype" 255complete -c firewall-cmd -l add-port -x -d"Add the port to zone|policy|service|helper" 256complete -c firewall-cmd -l remove-port -x -d"Remove the port from zone|policy|service|helper" 257complete -c firewall-cmd -l query-port -x -d"Return whether the port has been added for zone|policy|service|helper" 258complete -c firewall-cmd -l add-protocol -xa"(__fish_print_firewalld_protocols)" -d"Add the protocol to zone|policy|service" 259complete -c firewall-cmd -l remove-protocol -xa"(__fish_print_firewalld_protocols)" -d"Remove the protocol from zone|policy|service" 260complete -c firewall-cmd -l query-protocol -xa"(__fish_print_firewalld_protocols)" -d"Return whether the protocol has been added to zone|policy|service" 261complete -c firewall-cmd -l add-source-port -x -d"Add the source port to zone|policy|service" 262complete -c firewall-cmd -l remove-source-port -x -d"Remove the source port from zone|policy|service" 263complete -c firewall-cmd -l query-source-port -x -d"Return whether the source port has been added for zone|policy|service" 264complete -c firewall-cmd -l get-ports -d"List ports added to the permanent service|helper" 265complete -c firewall-cmd -l remove-destination -xa"ipv4 ipv6" -d"Disable destination for ipv in permanent service|icmptype" 266complete -c firewall-cmd -l query-destination -xa"ipv4 ipv6" -d"Return whether destination for ipv is enabled in permanent service|icmptype" 267complete -c firewall-cmd -l get-destinations -d"List destinations in permanent service|icmptype" 268complete -c firewall-cmd -l family -x -d"Inet family"