https://github.com/korc/openc2-firewalld
Test controlling firewalld via OpenC2
https://github.com/korc/openc2-firewalld
Last synced: 7 months ago
JSON representation
Test controlling firewalld via OpenC2
- Host: GitHub
- URL: https://github.com/korc/openc2-firewalld
- Owner: korc
- License: mit
- Created: 2018-10-02T17:36:22.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-02-21T16:59:14.000Z (over 6 years ago)
- Last Synced: 2023-03-10T19:36:49.145Z (over 3 years ago)
- Language: Go
- Size: 65.4 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Controlling FirewallD as OpenC2 actuator
This is a test of standard under development, provided for illustration purposes only.
Tries to implement [FirewallD](https://firewalld.org)-based [SLPF](https://docs.oasis-open.org/openc2/oc2slpf/v1.0/oc2slpf-v1.0.html) actuator for [OpenC2](https://docs.oasis-open.org/openc2/oc2ls/v1.0/oc2ls-v1.0.html) over [HTTPS](https://docs.oasis-open.org/openc2/open-impl-https/v1.0/open-impl-https-v1.0.html).
*No warranty whatsoever.*
## Running environment

### Quick-start
```
git clone https://github.com/korc/openc2-firewalld && cd openc2-firewalld
sudo apt install gnutls-bin golang firewalld
mkdir -p run-$$ && cd run-$$
../test/gen-certs.sh
go run ../cmd/oc2-proxy-server -cmdschema ../test/command-schema.json -respschema ../test/response-schema.json &
sudo systemctl start firewalld && sudo go run ../cmd/firewalld-oc2-client &
../test/test-request.sh ../test/test-query.json
```
## Command-line options
### OpenC2 command proxy server (consumer/producer)
`go run github.com/korc/openc2-firewalld/cmd/oc2-proxy-server`
- `-listen string`
Listen address (default "localhost:1512")
- `-cert string`
Server certificate (default "server.crt"). Empty string (`""`) will turn off TLS.
- `-key string`
Private key for certificate (default "server.key")
- `-cacert string`
Client CA certificate (default "ca.crt")
- `-path string`
URL path to OpenC2 endpoint (default "/oc2")
- `-www string`
Path to static html pages (ex: a copy of `openc2-cmdgen`)
### OpenC2 command client (consumer)
`go run github.com/korc/openc2-firewalld/cmd/firewalld-oc2-client`
- `-cert string`
Client X509 certificate (default "client.crt")
- `-id string`
Asset ID to use
- `-interval float`
wait interval in seconds (default 10)
- `-key string`
Private key for x509 certificate (default "client.key")
- `-server string`
OpenC2 server URL (default "http://localhost:1512/oc2")
- `-zone string`
Zone to manipulate (default "public")
### `test/gen-certs.sh`
- No options
- generates `server`, `client` and `ca` PEM-encoded `.crt` and `.key` files.
- `client.crt` will be signed by `ca.crt`.
- `xxx.tmpl` contain templates for certificates.