This repository was archived by the owner on Dec 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Add TLS support to the docker container command line #107
Open
csjperon
wants to merge
8
commits into
master
Choose a base branch
from
cperon/cmd_line_tls
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
12002aa
Add TLS support to the docker container
csjperon baa4fec
Fix test fixture
csjperon 7f167da
Update YAML fixture to reflect unit test fix
csjperon bfbd781
Fix conditional initialization of port
csjperon 8fa7138
Add information about -P and -p
csjperon 5c97265
Do not translate escape characters
csjperon 1e799ed
Remove leading forward slash
csjperon 0cc1670
Fix typo
csjperon 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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,13 +4,13 @@ | |
| def diag_print(test, rule_id): | ||
| print 'Running test %s from rule file %s' % (test.test_title, rule_id) | ||
|
|
||
| def build_journal(journal_file, ruledir, ruledir_recurse, tablename, destaddr, headers): | ||
| def build_journal(journal_file, ruledir, ruledir_recurse, tablename, destaddr, headers, protocol, port): | ||
| util.instantiate_database(journal_file) | ||
| rulesets = util.get_rulesets(ruledir, ruledir_recurse) | ||
| for rule in rulesets: | ||
| for test in rule.tests: | ||
| runner = testrunner.TestRunner() | ||
| runner.run_test_build_journal(test.ruleset_meta['name'], test, journal_file, tablename, destaddr, diag_print, headers) | ||
| runner.run_test_build_journal(test.ruleset_meta['name'], test, journal_file, tablename, destaddr, diag_print, protocol, port, headers) | ||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser(description='Build FTW Journal database') | ||
|
|
@@ -26,16 +26,24 @@ def main(): | |
| help='Destination host for the payloads') | ||
| parser.add_argument('--destaddr_as_host', action='store_true', | ||
| help='Use destination address as the Host header') | ||
| parser.add_argument('--protocol', default=None, | ||
| help='Specify protocol: http or https (default http)') | ||
| parser.add_argument('--port', default=None, | ||
| help='Specify port number (default 80)') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this true (default to 80) or whatever is specified in the yaml files?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is true |
||
| args = parser.parse_args() | ||
| destaddr = args.destaddr | ||
| journal_file = args.journal | ||
| ruledir = args.ruledir | ||
| ruledir_recurse = args.ruledir_recurse | ||
| tablename = args.tablename | ||
| headers = {} | ||
| protocol = args.protocol | ||
| port = 0 | ||
| if args.port: | ||
| port = int(args.port) | ||
| if args.destaddr_as_host: | ||
| headers['Host'] = destaddr = args.destaddr | ||
| build_journal(journal_file, ruledir, ruledir_recurse, tablename, destaddr, headers) | ||
| build_journal(journal_file, ruledir, ruledir_recurse, tablename, destaddr, headers, protocol, port) | ||
|
|
||
| if __name__ == '__main__': | ||
| main() | ||
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.
Is this true (default to http) or whatever is specified in the yaml files?
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.
Yup, we default the port to 80 in the YAML files.
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.
Right, but if the yaml file uses something else it won't be.
Personally I'd remove the default from the help.