-
Notifications
You must be signed in to change notification settings - Fork 64
[NTC-4957] Fixed parsing Palo banners that start on the same line #794
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9eb2d6e
Fixed parsing Palo banners that start on the same line
joewesch 5cec598
Added panos banner parsing
joewesch 0d603b3
Changed login banner detection to be quote agnostic
joewesch e7aa69c
Updated palo config parsing
joewesch 3da6ac9
Added helpful kwargs to 'invoke pytest'
joewesch 3c4963d
Fixed mypy errors
joewesch e8f6f4d
Fixed pylint errors
joewesch 1253aa9
Added additional changelog fragment
joewesch 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 hidden or 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 @@ | ||
| Added `--pattern` and `--label` options to the `invoke pytest` task. | ||
This file contains hidden or 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 @@ | ||
| Fixed parsing of login banner in Palo Alto Networks config. |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
1 change: 1 addition & 0 deletions
1
tests/unit/mock/config/compliance/compliance/paloalto_panos/paloalto_feature.py
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| features = [ | ||
| {"name": "management", "ordered": False, "section": ["set mgt-config "]}, | ||
| {"name": "banner", "ordered": False, "section": ["set deviceconfig system login-banner "]}, | ||
| ] |
This file contains hidden or 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 hidden or 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
3 changes: 3 additions & 0 deletions
3
tests/unit/mock/config/conversion/paloalto_panos/paloalto_banner_double_quote_converted.txt
This file contains hidden or 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,3 @@ | ||
| set deviceconfig system hostname pa-ntc | ||
| set deviceconfig system login-banner '"BANNER"' | ||
| set deviceconfig system domain ntc |
13 changes: 13 additions & 0 deletions
13
tests/unit/mock/config/conversion/paloalto_panos/paloalto_banner_double_quote_sent.txt
This file contains hidden or 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,13 @@ | ||
| config { | ||
| devices { | ||
| localhost.localdomain { | ||
| deviceconfig { | ||
| system { | ||
| hostname pa-ntc; | ||
| login-banner '"BANNER"'; | ||
| domain ntc; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
tests/unit/mock/config/conversion/paloalto_panos/paloalto_banner_one_line_converted.txt
This file contains hidden or 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,3 @@ | ||
| set deviceconfig system hostname pa-ntc | ||
| set deviceconfig system login-banner !#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ | ||
| set deviceconfig system domain ntc |
13 changes: 13 additions & 0 deletions
13
tests/unit/mock/config/conversion/paloalto_panos/paloalto_banner_one_line_sent.txt
This file contains hidden or 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,13 @@ | ||
| config { | ||
| devices { | ||
| localhost.localdomain { | ||
| deviceconfig { | ||
| system { | ||
| hostname pa-ntc; | ||
| login-banner !#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~; | ||
| domain ntc; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
...s/unit/mock/config/conversion/paloalto_panos/paloalto_banner_one_line_space_converted.txt
This file contains hidden or 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,3 @@ | ||
| set deviceconfig system hostname pa-ntc | ||
| set deviceconfig system login-banner "BANNER BANNER" | ||
| set deviceconfig system domain ntc |
13 changes: 13 additions & 0 deletions
13
tests/unit/mock/config/conversion/paloalto_panos/paloalto_banner_one_line_space_sent.txt
This file contains hidden or 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,13 @@ | ||
| config { | ||
| devices { | ||
| localhost.localdomain { | ||
| deviceconfig { | ||
| system { | ||
| hostname pa-ntc; | ||
| login-banner "BANNER BANNER"; | ||
| domain ntc; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
45 changes: 45 additions & 0 deletions
45
tests/unit/mock/config/conversion/paloalto_panos/paloalto_banner_same_line_converted.txt
This file contains hidden or 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,45 @@ | ||
| set deviceconfig system ip-address 192.0.2.72 | ||
| set deviceconfig system netmask 255.255.255.0 | ||
| set deviceconfig system update-server updates.paloaltonetworks.com | ||
| set deviceconfig system update-schedule threats recurring weekly day-of-week wednesday | ||
| set deviceconfig system update-schedule threats recurring weekly at 01:02 | ||
| set deviceconfig system update-schedule threats recurring weekly action download-only | ||
| set deviceconfig system timezone UTC | ||
| set deviceconfig system service disable-telnet yes | ||
| set deviceconfig system service disable-http yes | ||
| set deviceconfig system service disable-snmp no | ||
| set deviceconfig system hostname pa-ntc | ||
| set deviceconfig system type static | ||
| set deviceconfig system default-gateway 192.0.2.1 | ||
| set deviceconfig system domain ntc | ||
| set deviceconfig system locale en | ||
| set deviceconfig system speed-duplex auto-negotiate | ||
| set deviceconfig system dns-setting servers primary 8.8.8.8 | ||
| set deviceconfig system dns-setting servers secondary 1.1.1.1 | ||
| set deviceconfig system device-telemetry device-health-performance yes | ||
| set deviceconfig system device-telemetry product-usage yes | ||
| set deviceconfig system device-telemetry threat-prevention yes | ||
| set deviceconfig system device-telemetry region Americas | ||
| set deviceconfig system panorama local-panorama panorama-server 192.0.2.58 | ||
| set deviceconfig system server-verification no | ||
| set deviceconfig system ntp-servers primary-ntp-server ntp-server-address time.google.com | ||
| set deviceconfig system ntp-servers primary-ntp-server authentication-type none | ||
| set deviceconfig system login-banner "#################################################### | ||
| WARNING TO UNAUTHORIZED USERS: | ||
| This system is for use by authorized users only. | ||
| Any individual using this system, by such use, | ||
| acknowledges and consents to the right of the | ||
| company to monitor, access, use, and disclose any | ||
| information generated, received, or stored on the | ||
| systems, and waives any right of privacy or | ||
| expectation of privacy on the part of that | ||
| individual in connection with his or her use of | ||
| this system. Unauthorized and/or improper use of | ||
| this system, as delineated by corporate policies, | ||
| is not tolerated and the company may take formal | ||
| action against such individuals. | ||
| #################################################### | ||
| " | ||
| set deviceconfig system snmp-setting access-setting version v2c snmp-community-string ntc1234 | ||
| set deviceconfig system snmp-setting snmp-system location ntc | ||
| set deviceconfig system snmp-setting snmp-system contact "john smith" |
Oops, something went wrong.
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.
Oh yea baby!!