-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
pf.conf(5) support #703
Merged
Merged
pf.conf(5) support #703
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
Language: pf | ||
Category: config | ||
Author: Peter Piwowarski <oldlaptop654@aol.com> | ||
Description: The pf.conf(5) format as of OpenBSD 5.6 | ||
*/ | ||
|
||
function(hljs) { | ||
var MACRO = { | ||
className: 'variable', | ||
begin: /\$[\w\d#@][\w\d_]*/ | ||
}; | ||
var TABLE = { | ||
className: 'variable', | ||
begin: /</, end: />/ | ||
}; | ||
var QUOTE_STRING = { | ||
className: 'string', | ||
begin: /"/, end: /"/ | ||
}; | ||
|
||
return { | ||
aliases: ['pf.conf'], | ||
lexemes: /[a-z0-9_<>-]+/, | ||
keywords: { | ||
built_in: /* block match pass are "actions" in pf.conf(5), the rest are | ||
* lexically similar top-level commands. | ||
*/ | ||
'block match pass load anchor|5 antispoof|10 set table', | ||
keyword: | ||
'in out log quick on rdomain inet inet6 proto from port os to route' + | ||
'allow-opts divert-packet divert-reply divert-to flags group icmp-type' + | ||
'icmp6-type label once probability recieved-on rtable prio queue' + | ||
'tos tag tagged user keep fragment for os drop' + | ||
'af-to|10 binat-to|10 nat-to|10 rdr-to|10 bitmask least-stats random round-robin' + | ||
'source-hash static-port' + | ||
'dup-to reply-to route-to' + | ||
'parent bandwidth default min max qlimit' + | ||
'block-policy debug fingerprints hostid limit loginterface optimization' + | ||
'reassemble ruleset-optimization basic none profile skip state-defaults' + | ||
'state-policy timeout' + | ||
'const counters persist' + | ||
'no modulate synproxy state|5 floating if-bound no-sync pflow|10 sloppy' + | ||
'source-track global rule max-src-nodes max-src-states max-src-conn' + | ||
'max-src-conn-rate overload flush' + | ||
'scrub|5 max-mss min-ttl no-df|10 random-id', | ||
literal: | ||
'all any no-route self urpf-failed egress|5 unknown', | ||
}, | ||
contains: [ | ||
hljs.HASH_COMMENT_MODE, | ||
hljs.NUMBER_MODE, | ||
hljs.QUOTE_STRING_MODE, | ||
MACRO, | ||
TABLE, | ||
] | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# from the PF FAQ: http://www.openbsd.org/faq/pf/example1.html | ||
|
||
# macros | ||
|
||
int_if="xl0" | ||
|
||
tcp_services="{ 22, 113 }" | ||
icmp_types="echoreq" | ||
|
||
comp3="192.168.0.3" | ||
|
||
# options | ||
|
||
set block-policy return | ||
set loginterface egress | ||
set skip on lo | ||
|
||
# FTP Proxy rules | ||
|
||
anchor "ftp-proxy/*" | ||
|
||
pass in quick on $int_if inet proto tcp to any port ftp \ | ||
divert-to 127.0.0.1 port 8021 | ||
|
||
# match rules | ||
|
||
match out on egress inet from !(egress:network) to any nat-to (egress:0) | ||
|
||
# filter rules | ||
|
||
block in log | ||
pass out quick | ||
|
||
antispoof quick for { lo $int_if } | ||
|
||
pass in on egress inet proto tcp from any to (egress) \ | ||
port $tcp_services | ||
|
||
pass in on egress inet proto tcp to (egress) port 80 rdr-to $comp3 | ||
|
||
pass in inet proto icmp all icmp-type $icmp_types | ||
|
||
pass in on $int_if |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very confused.
var MACRO
contains mode definition withvariable
class, but you specifymacro
in CSS classes reference.