Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #50 from fastly/fgsch/fixes
Browse files Browse the repository at this point in the history
Switch to kingpin and other changes.
  • Loading branch information
fgsch committed Oct 15, 2018
2 parents 3507b6a + 7412cb5 commit aec9e36
Show file tree
Hide file tree
Showing 47 changed files with 9,957 additions and 232 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.dll
*.so
*.dylib
waflyctl

# Test binary, build with `go test -c`
*.test
Expand Down
2 changes: 1 addition & 1 deletion Documentation/BUILD.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build
- install [Go](https://golang.org/doc/install)
- `cd /waflyctl`
- `go get github.com/BurntSushi/toml github.com/sethvargo/go-fastly/fastly gopkg.in/resty.v1`
- `go get github.com/BurntSushi/toml github.com/sethvargo/go-fastly/fastly gopkg.in/alecthomas/kingpin.v2 gopkg.in/resty.v1`
- `go build waflyctl.go`
- `./waflyctl`
23 changes: 12 additions & 11 deletions Documentation/EXAMPLES.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
# Examples

## Provision a Service with OWASP rule set
`./waflyctl -apikey $FASTLY_TOKEN -serviceid BtYEP3WtWse5mGznpxxxx -tags OWASP`
`./waflyctl --apikey $FASTLY_TOKEN --serviceid BtYEP3WtWse5mGznpxxxx --tags OWASP`

## Add three rules to block mode on a Service with a WAF provisioned
`./waflyctl -apikey $FASTLY_TOKEN -serviceid BtYEP3WtWmx5mGznpxxxx -rules 1010010,931100,931110 -action block`
`./waflyctl --apikey $FASTLY_TOKEN --serviceid BtYEP3WtWmx5mGznpxxxx --rules 1010010,931100,931110 --action block`

## Delete a WAF previously provisioned
`./waflyctl -apikey $FASTLY_TOKEN -serviceid 7YCnicdpjTvxR2JdzNxxxx -delete`
`./waflyctl --apikey $FASTLY_TOKEN --serviceid 7YCnicdpjTvxR2JdzNxxxx --delete`

## Customer with PerimeterX bot protection
`./waflyctl -apikey $FASTLY_TOKEN -domain myexample.com -with-perimeterx`
`./waflyctl --apikey $FASTLY_TOKEN --domain myexample.com --with-perimeterx`

## Only edit OWASP object base on what it is set on the config file
`./waflyctl -apikey $FASTLY_TOKEN -domain myexample.com -owasp`
`./waflyctl --apikey $FASTLY_TOKEN --domain myexample.com --owasp`

## Disable a WAF, stop it for blocking traffic if something goes horribly wrong

## Listing all configuration sets available on the fastly platform
`./waflyctl -apikey $FASTLY_TOKEN -serviceid 7YCnicdpjTvxR2JdzNxxxx -list-configuration-sets`
`./waflyctl --apikey $FASTLY_TOKEN --serviceid 7YCnicdpjTvxR2JdzNxxxx --list-configuration-sets`

## Listing all rules available under a configuration set
`./waflyctl -apikey $FASTLY_TOKEN -serviceid 7YCnicdpjTvxR2JdzNxxxx -list-all-rules 552NEtnDyzucKd3vTjLgFC`
`./waflyctl --apikey $FASTLY_TOKEN --serviceid 7YCnicdpjTvxR2JdzNxxxx --list-all-rules 552NEtnDyzucKd3vTjLgFC`

## Listing all rules and their status for a service
`./waflyctl -apikey $FASTLY_TOKEN -serviceid 7YCnicdpjTvxR2JdzNxxxx -list-rules`
`./waflyctl --apikey $FASTLY_TOKEN --serviceid 7YCnicdpjTvxR2JdzNxxxx --list-rules`

## Set all rules of publisher owasp to logging
`./waflyctl -apikey $FASTLY_TOKEN -serviceid 7YCnicdpjTvxR2JdzNAKCj -publisher owasp -action log`
`./waflyctl --apikey $FASTLY_TOKEN --serviceid 7YCnicdpjTvxR2JdzNAKCj --publisher owasp --action log`

## Disable WAF in case of an emergency
`./waflyctl -apikey $FASTLY_TOKEN -serviceid 7YCnicdpjTvxR2JdzNAKCj -status disable`
`./waflyctl --apikey $FASTLY_TOKEN --serviceid 7YCnicdpjTvxR2JdzNAKCj --status disable`

## Customer with shielding
`./waflyctl -apikey $FASTLY_TOKEN -serviceid 2mvVrPMLDWSaZzCZIpbcUI -enable-logs-only -with-shielding`
`./waflyctl --apikey $FASTLY_TOKEN --serviceid 2mvVrPMLDWSaZzCZIpbcUI --enable-logs-only --with-shielding`
96 changes: 55 additions & 41 deletions Documentation/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,59 @@
waflyctl configuration file contains the default parameters to build and also managed a WAF.
If needed please adjust them in waflyctl.toml, and or pass them via command line.
```
Usage of waflyctl:
-action string
Select what action to take on the rules list and rule tags. Also overwrites action defined in config file, choices are: disabled, block, log.
-apiendpoint string
Fastly API endpoint to use. (default "https://api.fastly.com")
-apikey string
[Required] API Key to use
-config string
Location of configuration file for waflyctl. (default "/Users/jhernandez/.waflyctl.toml")
-configuration-set string
Changes WAF configuration set to the provided one]
-delete
When set removes a WAF configuration created with waflyctl.
-delete-logs
When set removes WAF logging configuration.
-domain string
[Required] Domain to Provision, you can use Service ID alternatively
-enable-logs-only
Add logging configuration only to the service, the tool will not make any other changes, can be paired with-perimeterx
-list-all-rules string
List all rules available on the Fastly platform for a given configuration set. Must pass a configuration set ID
-list-configuration-sets
List all configuration sets and their status
-list-rules
List current WAF rules and their status
-owasp
When set edits the OWASP object base on the settings in the configuration file.
-publisher string
Which rule publisher to use in a comma delimited fashion, overwrites publisher defined in config file, choices are: owasp, trustwave, fastly
-rules string
Which rules to apply action on in a comma delimited fashion, overwrites ruleid defined in config file, example: 1010010,931100,931110..
-serviceid string
[Required] Service ID to Provision
-status string
Disable or Enable the WAF. A disabled WAF will not block any traffic, also disabling a WAF does not change rule statuses on its configure policy.
-tags string
Which rules tags to add to the ruleset in a comma delimited fashion, overwrites tags defined in config file, example: wordpress,language-php,drupal
-with-perimeterx
Enable if the customer has perimeterX enabled on the service as well as WAF. Helps fix null value logging.
-with-shielding
Enable if the customer has shielding enabled on the service. Helps fix multiple events with duplicate request IDs.
usage: waflyctl --apikey=APIKEY [<flags>]
Fastly WAF Control Tool
Flags:
--help Show context-sensitive help (also try --help-long
and --help-man).
--version Show application version.
--action=ACTION Action to take on the rules list and rule tags.
Overwrites action defined in config file. One of:
disabled, block, log.
--apiendpoint="https://api.fastly.com"
Fastly API endpoint to use.
--apikey=APIKEY API Key to use. Required.
--backup Store a copy of the WAF configuration in
/Users/guest/.waflyctl-<service-id>.rules.
--config="/Users/guest/.waflyctl.toml"
Location of configuration file for waflyctl.
--configuration-set=CONFIGURATION-SET
Changes WAF configuration set to the provided one.
--delete Remove a WAF configuration created with waflyctl.
--delete-logs When set removes WAF logging configuration.
--domain=DOMAIN Domain to Provision. You can use Service ID
alternatively.
--enable-logs-only Add logging configuration only to the service. No
other changes will be made. Can be used together
with --with-perimeterx
--list-all-rules=CONFIGURATION-SET
List all rules available on the Fastly platform for
a given configuration set.
--list-configuration-sets List all configuration sets and their status.
--list-rules List current WAF rules and their status.
--owasp Edit the OWASP object base on the settings in the
configuration file.
--publisher=PUBLISHER Which rule publisher to use in a comma delimited
fashion. Overwrites publisher defined in config
file. Choices are: owasp, trustwave, fastly
--rules=RULES Which rules to apply action on in a comma delimited
fashion. Overwrites ruleid defined in config file.
Example: 1010010,931100,931110.
--serviceid=SERVICEID Service ID to Provision.
--status=STATUS Disable or Enable the WAF. A disabled WAF will not
block any traffic. In addition disabling a WAF does
not change rule statuses on its configure policy.
One of: disable, enable.
--tags=TAGS Which rules tags to add to the ruleset in a comma
delimited fashion. Overwrites tags defined in
config file. Example:
wordpress,language-php,drupal.
--with-perimeterx Enable if the customer has perimeterX enabled on
the service as well as WAF. Helps fix null value
logging.
--with-shielding Enable if the customer has shielding enabled on the
service. Helps fix multiple events with duplicate
request IDs.
```
62 changes: 56 additions & 6 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions vendor/github.com/alecthomas/template/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions vendor/github.com/alecthomas/template/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aec9e36

Please sign in to comment.