Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support IPv6 #42

Open
wants to merge 158 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
339f30f
indentation
jasonwee Jul 24, 2020
a093f25
initial support for ipv6 firewall rules
jasonwee Jul 28, 2020
2a2bf7e
indentation so easier to read
jasonwee Aug 3, 2020
be0ac9c
added chain TALLOW, TGALLOW, TDENY and TGDENY to ip6tables
jasonwee Aug 4, 2020
d40f57c
tested work okay
jasonwee Aug 4, 2020
b9fee24
ignoring ipv4 address when setup rules for ipv6
jasonwee Aug 4, 2020
fb58ad9
rearrange ordering
jasonwee Aug 4, 2020
8635ddc
when vnet is enable, make it support ipv6 network
jasonwee Aug 5, 2020
31bdabd
spacing
jasonwee Aug 5, 2020
cf5cf64
when allow or deny network is a subnet, then we have to check if it i…
jasonwee Aug 5, 2020
21c6730
dont hardcode untrusted iface
jasonwee Aug 31, 2020
09906fb
spelling
jasonwee Sep 1, 2020
816732a
should be IP6T
jasonwee Sep 1, 2020
2779ca1
tested work for ipv6 hostname but not address, need sometime to chang…
jasonwee Sep 1, 2020
3e60c7e
sync with upstream
jasonwee Jan 29, 2021
08e5448
repatch ipv6
jasonwee Jan 29, 2021
c104863
merge from upstream
jasonwee May 24, 2021
f98e9bb
Merge branch 'rfxn:master' into master
jasonwee May 24, 2021
80830c9
cherry pick but only selected files from roberto patched
jasonwee Jun 25, 2021
6e79b63
Implementation as specified in https://github.com/rfxn/advanced-polic…
jasonwee Feb 9, 2022
48123b7
removed empty space
jasonwee Feb 9, 2022
85302df
just restart
jasonwee Feb 9, 2022
4cc879c
not required
jasonwee Feb 9, 2022
b3e733c
Merge pull request #5 from jasonwee/support-docker
jasonwee Feb 9, 2022
8498f58
load iptable_nat module so when cat /proc/net/ip_tables_names, nat wi…
jasonwee Feb 15, 2022
0f32694
Merge pull request #6 from jasonwee/support-iptable-nat-in-almalinux8
jasonwee Feb 15, 2022
b590cdb
support customized docker rules
jasonwee Mar 1, 2022
aeb9aa7
Merge pull request #7 from jasonwee/support-docker
jasonwee Mar 1, 2022
458f4e0
in almalinux8, ip6_tables is not loaded, so load now. but even if ti …
jasonwee Mar 2, 2022
fbab1fa
Merge pull request #8 from jasonwee/support-load-ip6-tables-almalinux8
jasonwee Mar 2, 2022
88afed8
upstream fix
jasonwee Mar 4, 2022
c5e7d47
added differences with upstream
jasonwee Mar 4, 2022
577a810
update doc for netfilter support
jasonwee Mar 7, 2022
adc4ea9
added configuration use_iptables for fallback
jasonwee Mar 7, 2022
ea19ba1
nft docs
jasonwee Mar 7, 2022
70d5255
sync to the main conf.apf
jasonwee Mar 11, 2022
e466dd2
added nft example
jasonwee Mar 11, 2022
e3b2f8b
added executor to select between iptables or nft
jasonwee Mar 11, 2022
f39afa6
initial identify all spots for all nft patch
jasonwee Mar 11, 2022
51f89a2
implement nft in log.rules
jasonwee Mar 13, 2022
6b4e9eb
initial patch
jasonwee Sep 17, 2022
45bf70f
commit work done
jasonwee Sep 27, 2022
2d67bf0
commit work done
jasonwee Sep 27, 2022
c2731f9
just symlink functions as it is called by apf.init
jasonwee Sep 27, 2022
2ce95a4
copied from almalinux
jasonwee Sep 27, 2022
0f6ad9e
Merge pull request #9 from jasonwee/support-debian
jasonwee Sep 27, 2022
87db424
support header in wget gd and ga
jasonwee Oct 31, 2022
26ccad6
Merge pull request #10 from jasonwee/support-http-basic-auth-glob-all…
jasonwee Oct 31, 2022
f68de38
use helper_ssh_port
jasonwee Jan 3, 2023
d1edd62
patch to support nft
jasonwee Jan 3, 2023
d49e60a
exclude curly brackets and empty lines aka newline
jasonwee Jan 17, 2023
d922d8b
dont need double specify nft
jasonwee Jan 17, 2023
1202415
indentation
jasonwee Jan 17, 2023
d8c7324
tested, dont hardcode and before jump to the input chain, need to cre…
jasonwee Jan 17, 2023
2b6401b
fix range
jasonwee Feb 14, 2023
dad8c8b
put to else block
jasonwee Feb 14, 2023
26bbf89
need if else so vnet for ipv6 wont break on nft on filter ip
jasonwee Feb 14, 2023
7cda89d
fix mistakes
jasonwee Feb 14, 2023
d220997
do the TODO
jasonwee Feb 14, 2023
6dfbc2f
implements ipv6 nftable
jasonwee Feb 14, 2023
5f243b8
implements ipv6 nftable
jasonwee Feb 14, 2023
83152ad
implement limit
jasonwee Feb 14, 2023
ab476ce
fix mistake on ICMP_EARGS. also, dont enable icmp, but respect the va…
jasonwee Feb 14, 2023
8b4bb45
added documentation
jasonwee Feb 14, 2023
a7be126
fix mistakes
jasonwee Feb 14, 2023
5081a52
complete todo
jasonwee Feb 14, 2023
0792b69
added limit
jasonwee Feb 14, 2023
881c52f
full implementation
jasonwee Feb 14, 2023
d000f0b
full implementation
jasonwee Feb 14, 2023
b5f7b59
full implementation
jasonwee Feb 14, 2023
9280417
fix bug
jasonwee Feb 14, 2023
d69d104
bugs fixes
jasonwee Feb 14, 2023
71ed591
fix mistake
jasonwee Mar 1, 2023
1a5fad5
indentation
jasonwee Mar 7, 2023
74d6d46
need quote
jasonwee Mar 7, 2023
1625223
fixed typo
jasonwee Mar 7, 2023
22490f7
forget filter TDENY
jasonwee Mar 7, 2023
8f77f25
no recent module in nftable
jasonwee Mar 7, 2023
eb4b3d2
fix mistakes
jasonwee Mar 7, 2023
39ffc9e
fix mistakes
jasonwee Mar 7, 2023
efa4e16
fix mistake and identation
jasonwee Mar 7, 2023
2f8f187
indentation
jasonwee Mar 7, 2023
2953294
fix mistake
jasonwee Mar 7, 2023
02ad602
idnetation and fixes
jasonwee Mar 7, 2023
42cbd77
added log_target for nftable
jasonwee Mar 7, 2023
e902843
identation and fix small mistake
jasonwee Mar 7, 2023
d875e55
no need jump, just set the stop action
jasonwee Mar 7, 2023
c956094
fix mistakes and indentation
jasonwee Mar 7, 2023
9c43951
fix mistakes and indentation
jasonwee Mar 7, 2023
ae92731
fix mistakes
jasonwee Mar 7, 2023
be0a557
fix mistakes
jasonwee Mar 7, 2023
b498122
fix mistakes and implemented todo
jasonwee Mar 7, 2023
8af158b
TODO, need to autotranslate
jasonwee Mar 7, 2023
447650d
fixed mistakes
jasonwee Mar 7, 2023
5f06a55
fixed mistakes
jasonwee Mar 7, 2023
f44838f
fixed mistakes
jasonwee Mar 7, 2023
26eb1f6
fixed mistakes
jasonwee Mar 7, 2023
10fd53a
implement real stuff
jasonwee Mar 7, 2023
9c77424
load module in the correct path
jasonwee Mar 8, 2023
310d6b7
no need load multiple times
jasonwee Mar 14, 2023
945d95d
actual implementation
jasonwee Mar 14, 2023
6cc3ec9
ident properly so easier to read
jasonwee Mar 14, 2023
2033583
tested
jasonwee Mar 14, 2023
bd6ab45
it is okay
jasonwee Mar 14, 2023
13beeb4
change echo
jasonwee Mar 14, 2023
212eadf
identation
jasonwee Mar 14, 2023
06a19fa
ignore curly brackets and blank lines
jasonwee Mar 22, 2023
aa5454d
not ip6 but ip. also port range is different.
jasonwee Mar 22, 2023
ec320f4
identation
jasonwee Mar 22, 2023
d964f31
not ip6 but ip. also port range is different.
jasonwee Mar 22, 2023
1635803
identation
jasonwee Mar 22, 2023
8e72080
not ip6 but ip. also port range is different.
jasonwee Mar 22, 2023
b671d2c
identation
jasonwee Mar 22, 2023
5965548
not ip6 but ip. also port range is different.
jasonwee Mar 29, 2023
8a1c357
identation
jasonwee Mar 29, 2023
6cc7e17
implement todo for ipv6
jasonwee Apr 4, 2023
44fe7fe
identation
jasonwee Apr 4, 2023
9003d25
implement todo for ipv6 and fix broken rules
jasonwee Apr 4, 2023
6e5f280
TODO, need to autotranslate
jasonwee Apr 4, 2023
c483581
implement todo for ipv6 and fix broken rules
jasonwee Apr 4, 2023
183c28e
implement todo for ipv6 and fix broken rules
jasonwee Apr 4, 2023
558dbab
identation
jasonwee Apr 4, 2023
7345a62
indentation and fix mistakes
jasonwee Apr 12, 2023
742fc43
identation
jasonwee Apr 12, 2023
ad8128c
fixed
jasonwee Apr 12, 2023
5209b81
identation and fixed
jasonwee Apr 19, 2023
22c1e52
identation
jasonwee Apr 19, 2023
c8cc97b
auto convert
jasonwee Apr 20, 2023
7a18359
fixed
jasonwee Apr 26, 2023
590a816
implemented auto convert to nftable equivalent
jasonwee Apr 26, 2023
39a094a
change to 1
jasonwee Apr 26, 2023
2f92bdb
updated
jasonwee Apr 26, 2023
f4c4377
updated
jasonwee Apr 26, 2023
e1fc8f0
icmp type type and icmpv6 type type for nftables
jasonwee May 1, 2023
640fe51
need to explicitly add table mangle and its chain (PREROUTING or POST…
jasonwee May 1, 2023
31e1f3a
except itable recent module
jasonwee May 1, 2023
1cf6252
Merge pull request #11 from jasonwee/support-nft
jasonwee May 1, 2023
d6b3a46
extra modules
jasonwee May 16, 2023
d685b70
Merge pull request #12 from jasonwee/support-nft
jasonwee May 16, 2023
6eacc85
identation
jasonwee May 16, 2023
33efcc1
Merge pull request #13 from jasonwee/support-nft
jasonwee May 16, 2023
42ef2e9
ipv4 rules must always set
jasonwee Sep 25, 2023
d8339fd
Merge pull request #14 from jasonwee/fix-1
jasonwee Sep 25, 2023
a56b898
check if hostname is resolvable to ipv6 address before actually run t…
jasonwee Oct 9, 2023
2100b39
Merge pull request #15 from jasonwee/support-check-hostname-resolvabl…
jasonwee Oct 9, 2023
516003c
tested
jasonwee Oct 23, 2023
0cfaa2d
Merge pull request #16 from jasonwee/support-check-hostname-resolvabl…
jasonwee Oct 23, 2023
54371b1
require create table first.. then chain inside table
jasonwee Jan 31, 2024
5c4cb26
Update firewall
jasonwee Jan 31, 2024
cc4b2be
Update firewall
jasonwee Feb 6, 2024
7be8191
Update functions.apf
jasonwee Feb 6, 2024
3d58e29
Update preroute.rules
jasonwee Feb 6, 2024
e802304
first round identation
jasonwee Feb 6, 2024
38709b5
second round identation
jasonwee Feb 6, 2024
9684a4b
Merge pull request #17 from jasonwee/review-icmp-block
jasonwee Feb 6, 2024
3ab8cd3
identation
jasonwee Feb 20, 2024
769d4b3
nft ip6 ig icmp types code does not really work, use types instead
jasonwee Feb 20, 2024
a3b1b33
if ipv6 and nft executor are enabled, then set correclty for ig icmp …
jasonwee Feb 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 50 additions & 45 deletions .ca.def
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cat > .conf.apf <<EOF
#!/bin/sh
#!/bin/bash
#
##
# Advanced Policy Firewall (APF) v1.7.5
# Advanced Policy Firewall (APF) v1.7.6
# (C) 2002-2019, R-fx Networks <proj@rfxn.com>
# (C) 2019, Ryan MacDonald <ryan@rfxn.com>
# This program may be freely redistributed under the terms of the GNU GPL v2
Expand Down Expand Up @@ -38,6 +38,10 @@ IFACE_TRUSTED="$IFACE_TRUSTED"
# Note: The VNET (virtual network) feature does not currently support IPv6.
USE_IPV6="$USE_IPV6"

# If nft is detected, apf will automatically to use that. If this is set to 1
# fallback to the old iptables to set the rulesets.
USE_IPTABLES="$USE_IPTABLES"

# This option will allow for all status events to be displayed in real time on
# the console as you use the firewall. Typically, APF used to operate silent
# with all logging piped to \$LOG_APF. The use of this option will not disable
Expand Down Expand Up @@ -92,7 +96,7 @@ SET_REFRESH="$SET_REFRESH"
# feature checks for changes to trust files between refreshes and only performs
# a refresh if contents have changed. If you are using dynamic DNS names in trust
# rules, which require regular DNS refreshes, you should keep this disabled.
# [value in minutes, 0 to disable]
# [value 1 to enable, 0 to disable]
SET_REFRESH_MD5="$SET_REFRESH_MD5"

# This is the total amount of rules allowed inside of the deny trust system.
Expand All @@ -102,46 +106,45 @@ SET_TRIM="250"

# Verifies that the IFACE_* and IFACE_TRUSTED interfaces are actually routed
# to something. If configured interfaces are found with no routes setup then
# APF will exit with an error to prevent further issues (such as being locked
# APF will exit with an error to prevent further issues (such as being locked
# out of the system).
VF_ROUTE="$VF_ROUTE"

# Verifies that all inbound traffic is sourced from a defined local gateway MAC
# address. All other traffic that does not match this MAC address will be
# rejected as untrusted traffic. It is quite easy to forge a MAC address and as
# rejected as untrusted traffic. It is quite easy to forge a MAC address and as
# such this feature executes NO default accept policy. Leave this option empty
# to disable or enter a 48-bit MAC address to enable.
VF_LGATE="$VF_LGATE"

##
# [Reactive Address Blocking]
##
# The use of RAB is such that it allows the firewall to track an address as it
# traverses the firewall rules and subsequently associate that address across
# any number of violations. This allows the firewall to react to critical
# policy violations by blocking addresses temporarily on the assumed precaution
# that we are protecting the host from what the address may do on the pretext
# of what the address has already done. The interface that allows RAB to work
# resides inside the kernel and makes use of the iptables 'ipt_recent' module,
# so there is no external programs causing any additional load.
# Reactive Address Blocking (RAB) monitors addresses as they traverse the firewall
# rules and tracks all policy violations attempted by an address. The firewall then
# reacts to the violations by blocking addresses temporarily on the assumption that
# we are protecting the host from what an attacker may do under the pretext of what
# an attacker has already done. The interface that powers RAB is the iptables kernel
# module 'xt/ipt_recent'; as such there is no external programs required for this
# feature or additional load imposed by it.
RAB="$RAB"

# This enables RAB for sanity violations, which is when an address breaks a
# This enables RAB for sanity violations, which is when an address breaks a
# strict conformity standard such as trying to spoof an address or modify
# packet flags. It is strongly recommended that this option NOT be disabled.
RAB_SANITY="$RAB_SANITY"

# This enables RAB for port scan violations, which is when an address attempts
# to connect to a port that has been classified as malicious. These types of
# ports are those which are not commonly used in today's Internet but are
# the subject of scrutiny by attackers, such as ports 1,7,9,11. Each security
# level defines the amount of ports that RAB will react against. The port
# security groups can be customized in 'internals/rab.ports'.
# the subject of scrutiny by attackers, such as 1,7,9,11 and so on. The security
# level defines the group of ports that RAB will react against. The port groups
# can be customized in 'internals/rab.ports'.
# 0 = disabled | 1 = low security | 2 = medium security | 3 = high security
RAB_PSCAN_LEVEL="$RAB_PSCAN_LEVEL"

# This controls the amount of violation hits an address must have before it
# is blocked. It is a good idea to keep this very low to prevent evasive
# is blocked. It is a good idea to keep this very low to prevent evasive
# measures. The default is 0 or 1, meaning instant block on first violation.
RAB_HITCOUNT="$RAB_HITCOUNT"

Expand All @@ -157,8 +160,8 @@ RAB_TRIP="$RAB_TRIP"
# The use of LOG_DROP variable set to 1 will override this to force logging.
RAB_LOG_HIT="$RAB_LOG_HIT"

# This controls if the firewall should log all subsiqent traffic from an address
# that is already blocked for a violation hit, this can generate allot of logs.
# This controls if the firewall should log all subsequent traffic from an address
# that is already blocked for a violation hit, this can generate a lot of logs.
# The use of LOG_DROP variable set to 1 will override this to force logging.
RAB_LOG_TRIP="$RAB_LOG_TRIP"

Expand Down Expand Up @@ -186,7 +189,7 @@ UDP_STOP="$UDP_STOP"
# REJECT (reject the packet)
ALL_STOP="$ALL_STOP"

# The sanity options control the way packets are scrutinized as they flow
# The sanity options control the way packets are scrutinized as they flow
# through the firewall. The main PKT_SANITY option is a top level toggle for
# all SANITY options and provides general packet flag sanity as a pre-scrub
# for the other sanity options. In short, this makes sure that all packets
Expand All @@ -208,14 +211,8 @@ PKT_SANITY_FUDP="$PKT_SANITY_FUDP"
# nothing should ever communicate on port 0 (technically does not exist).
PKT_SANITY_PZERO="$PKT_SANITY_PZERO"

# The implementation of Type of Service (TOS) in APF is such that it allows
# you to classify service priorities by port. These priorities are broken down
# into 5 groups and they are:
# 0 = No Change
# 2 = Minimize-Cost
# 4 = Minimize Delay - Maximize Reliability
# 8 = Maximum Throughput - Minimum Delay
# 16 = No Delay - Moderate Throughput - High Reliability
# Default Type of Service (TOS); These values should be set to a comma
# separated list of ports which you would like marked with the given TOS level.
#
# Set the default TOS value [0,2,4,8,16]
TOS_DEF="$TOS_DEF"
Expand Down Expand Up @@ -296,15 +293,9 @@ BLK_PRVNET="$BLK_PRVNET"
# to the 'internals/reserved.networks' file for listing of address space.
BLK_RESNET="$BLK_RESNET"

# Block all ident (tcp 113) requests in and out of the server IF the port is
# not already opened in *_TCP_CPORTS. This uses a REJECT target to make sure
# the ident requests terminate quickly. You can see an increase in irc and
# other connection performance with this feature.
BLK_IDENT="$BLK_IDENT"

# Three related flaws were found in the Linux kernel’s handling of TCP Selective
# Acknowledgement (SACK) packets handling with low MSS size. The extent of impact
# is understood to be limited to denial of service at this time.
# is understood to be limited to denial of service at this time.
#
# ref: https://access.redhat.com/security/vulnerabilities/tcpsack
# CVE-2019-11477, CVE-2019-11478, CVE-2019-11479
Expand All @@ -317,13 +308,24 @@ BLK_IDENT="$BLK_IDENT"
# than June 16th 2019.
BLK_TCP_SACK_PANIC="$BLK_TCP_SACK_PANIC"

# Block all ident (tcp 113) requests in and out of the server IF the port is
# not already opened in *_TCP_CPORTS. This uses a REJECT target to make sure
# the ident requests terminate quickly. You can see an increase in irc and
# other connection performance with this feature.
BLK_IDENT="$BLK_IDENT"

# This is the maximum number of "sessions" (connection tracking entries) that
# can be handled simultaneously by the firewall in kernel memory. Increasing
# this value too high will simply waste memory - setting it too low may result
# in some or all connections being refused, in particular during denial of
# service attacks.
# this value too high will simply waste memory and add latency but setting it
# too low may result in some or all connections being refused, in particular
# during denial of service attacks.
SYSCTL_CONNTRACK="$SYSCTL_CONNTRACK"

SYSCTL_CONNTRACK_ADAPTIVE="$SYSCTL_CONNTRACK_ADAPTIVE"
SYSCTL_CONNTRACK_INCREMENT="$SYSCTL_CONNTRACK_INCREMENT"
SYSCTL_CONNTRACK_HIGH="$SYSCTL_CONNTRACK_HIGH"
SYSCTL_CONNTRACK_BUCKETS="$SYSCTL_CONNTRACK_BUCKETS"

# These are system control (sysctl) option changes to disable TCP features
# that can be abused in addition to tweaking other TCP features for increased
# performance and reliability.
Expand Down Expand Up @@ -477,12 +479,12 @@ EG_DROP_CMD="$EG_DROP_CMD"
##
# [Remote Rule Imports]
##
# Project Honey Pot is the first and only distributed system for identifying
# Project Honey Pot is the first and only distributed system for identifying
# spammers and the spambots they use to scrape addresses from your website.
# This aggregate list combines Harvesters, Spammers and SMTP Dictionary attacks
# from the PHP IP Data at: http://www.projecthoneypot.org/list_of_ips.php
DLIST_PHP="$DLIST_PHP"
DLIST_PHP_URL="http://rfxn.com/downloads/php_list"
DLIST_PHP_URL="http://cdn.rfxn.com/downloads/php_list"

# The Spamhaus Don't Route Or Peer List (DROP) is an advisory "drop all
# traffic" list, consisting of stolen 'zombie' netblocks and netblocks
Expand All @@ -501,11 +503,11 @@ DLIST_DSHIELD_URL="http://feeds.dshield.org/top10-2.txt"
# The reserved networks list is addresses which ARIN has marked as reserved
# for future assignement and have no business as valid traffic on the internet.
# Such addresses are often used as spoofed (Fake) hosts during attacks, this
# will update the reserved networks list in order to prevent new ip assignments
# will update the reserved networks list in order to prevent new ip assignments
# on the internet from getting blocked; this option is only important when
# BLK_RESNET is set to enabled.
DLIST_RESERVED="1"
DLIST_RESERVED_URL="http://rfxn.com/downloads/reserved.networks"
DLIST_RESERVED_URL="http://cdn.rfxn.com/downloads/reserved.networks"

# ECN is an extension which helps reduce congestion. Unfortunately some
# clueless software/hardware vendors have setup their sites or implemented
Expand All @@ -515,7 +517,7 @@ DLIST_RESERVED_URL="http://rfxn.com/downloads/reserved.networks"
# is accepted as intended. This option is dependent on setting SYSCTL_ECN="1"
# otherwise it stays disabled.
DLIST_ECNSHAME="$DLIST_ECNSHAME"
DLIST_ECNSHAME_URL="http://rfxn.com/downloads/ecnshame.lst"
DLIST_ECNSHAME_URL="http://cdn.rfxn.com/downloads/ecnshame.lst"

##
# Global Trust
Expand All @@ -526,7 +528,6 @@ DLIST_ECNSHAME_URL="http://rfxn.com/downloads/ecnshame.lst"
# a daily basis. The files can be maintained in a static fashion by
# leaving USE_RGT=0, ideal for a host serving the files.
USE_RGT="$USE_RGT"

GA_URL="$GA_URL"
GD_URL="$GD_URL"

Expand Down Expand Up @@ -569,6 +570,10 @@ LOG_APF="$LOG_APF"
IPT_LOCK_SUPPORT="$IPT_LOCK_SUPPORT"
IPT_LOCK_TIMEOUT="$IPT_LOCK_TIMEOUT"

# support for docker. when apf start, docker will be restart. Because docker
# rules are adhoc and change as container start/stop.
SET_DOCKER="$SET_DOCKER"

##
# [Import misc. conf]
##
Expand Down
15 changes: 14 additions & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Differences with upstream rfxn
- support ipv6
- support docker
- support netfilter
* except iptables recent module

Disclamimer: While I'm not expert in this field, but these support
implementations allow me to administer current operating
system more effectively. If you use my fork and found
bug, please contact me for more information
at <jason@weetech.ch>


Advanced Policy Firewall (APF) v1.7.6
(C) 2002-2019, R-fx Networks <proj@rfxn.com>
(C) 2019, Ryan MacDonald <ryan@rfxn.com>
Expand Down Expand Up @@ -199,7 +212,7 @@ Fedora Core Any
Slackware 8.0+
Debian GNU/Linux 3.0+
Suse Linux 8.1+
Unbuntu Any
Ubuntu Any
TurboLinux Server 9+
TurboLinux Fuji (Desktop)
RedHat Linux 7.3,8,9
Expand Down
24 changes: 18 additions & 6 deletions apf.init
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,26 @@ restart)
$0 start
;;
condrestart)
if $ipt $IPT_FLAGS -n -L TALLOW > /dev/null 2>&1 && \
$ipt $IPT_FLAGS -n -L TDENY > /dev/null 2>&1 && \
$ipt $IPT_FLAGS -n -L TGALLOW > /dev/null 2>&1 && \
$ipt $IPT_FLAGS -n -L TGDENY > /dev/null 2>&1; then
$0 stop
$0 start
if [ $EXECUTOR == "nft" ]; then
if $NFT -n list chain ip filter TALLOW > /dev/null 2>&1 && \
$NFT -n list chain ip filter TDENY > /dev/null 2>&1 && \
$NFT -n list chain ip filter TGALLOW > /dev/null 2>&1 && \
$NFT -n list chain ip filter TGDENY > /dev/null 2>&1; then
$0 stop
$0 start
else
echo "APF not running, doing nothing."
fi
else
if $ipt $IPT_FLAGS -n -L TALLOW > /dev/null 2>&1 && \
$ipt $IPT_FLAGS -n -L TDENY > /dev/null 2>&1 && \
$ipt $IPT_FLAGS -n -L TGALLOW > /dev/null 2>&1 && \
$ipt $IPT_FLAGS -n -L TGDENY > /dev/null 2>&1; then
$0 stop
$0 start
else
echo "APF not running, doing nothing."
fi
fi
;;
*)
Expand Down
Loading