AI generated content is NOT ALLOWED, unless it was rewritten by a human who checked every line!
I'd love to accept your pull request! Before I can take them, we have to jump a couple of legal hurdles.
Please see assets/cla/CLA.md.
Please follow these steps to add CLA consent:
- Add your info to
assets/cla/consent.yaml - Agree to CLA via comment in PR. See here how to do it.
Before sending your pull requests, make sure you followed this list.
- Open an issue to discuss your PR
- Ensure you read appropriate Contributor License Agreement (CLA)
- Run unit tests
The contribution to this project requires setting up a development environment. The following steps allow developers to test their setup using local source code.
First, designate directory for building, e.g. tmpdev.
mkdir -p ~/tmpdev
cd ~/tmpdevSecond, fork the following repositories in Github into to your own Github
handle, e.g. anonymous:
https://github.com/greenpau/caddy-security=>https://github.com/anonymous/caddy-securityhttps://github.com/greenpau/go-authcrunch=>https://github.com/anonymous/go-authcrunch
Provided you are in tmpdev directory, clone the forked repositories:
git clone git@github.com:anonymous/caddy-security.git
git clone git@github.com:anonymous/go-authcrunch.gitNext, browse to caddy-security and run the following make command to install
various dependencies:
cd caddy-security
make depNext, modify go.mod in github.com/greenpau/caddy-security. Include
replace directives to instruct go using local directories, as opposed
to follow Github versions.
Note: the referenced versions must match.
module github.com/greenpau/caddy-security
go 1.21
require (
github.com/greenpau/go-authcrunch v1.1.41
)
replace github.com/greenpau/go-authcrunch v1.1.41 => /Users/greenpau/dev/src/github.com/greenpau/go-authcrunch
Alternatively:
go mod edit -replace github.com/greenpau/go-authcrunch@v1.1.41=/Users/greenpau/dev/src/github.com/greenpau/go-authcrunchThen, modify Makefile such that that replacement passes to xcaddy builder:
@mkdir -p ../xcaddy-$(PLUGIN_NAME) && cd ../xcaddy-$(PLUGIN_NAME) && \
xcaddy build $(CADDY_VERSION) --output ../$(PLUGIN_NAME)/bin/caddy \
--with github.com/greenpau/caddy-security@$(LATEST_GIT_COMMIT)=$(BUILD_DIR) \
--with github.com/greenpau/go-authcrunch@v1.1.41=/home/greenpau/dev/src/github.com/greenpau/go-authcrunchOnce all the necessary packages are installed, you should be ready to compile using the local source code. Run:
makeThe above make command creates xcaddy-caddy-security directory in tmpdev.
Then, it starts building caddy and referencing locally sources plugins.
After the build, the resultant binary will be in bin/ directory.
You can then test it with your own configuration files.
bin/authcrunch run --config assets/config/Caddyfile | jqValidate the response. The server should respond with 1.0.0.
curl -v https://127.0.0.1:8443/versionAdditionally, you should be able to run tests:
make ctestFor more complex E2E testing, use home.Caddyfile. You can then browse to https://auth.myfiosgateway.com:8443/
to access the portal.
make devbuild
source ~/.config/caddy/Caddyfile_vars.sh
bin/authcrunch run --config assets/config/home.Caddyfile