Files
wsmancer/Makefile
SREsAreHumanToo 2c6aef86c2 FOSS project setup: community docs, templates, CI config, pre-commit
Add SECURITY.md, CODE_OF_CONDUCT.md, CHANGELOG.md, .editorconfig,
CODEOWNERS, FUNDING.yml, dependabot.yml, issue/PR templates, and
Makefile pre-commit/hooks targets.
2026-11-23 19:58:10 -05:00

70 lines
2.4 KiB
Makefile

BIN := wsmancer
# Live-check target, for `make tickets` / `make verify` only. No default: these
# talk to a real box, and a stale hostname baked in here would mean running them
# against whatever now answers to it. Pass them on the command line,
# make verify TARGET=dc01.corp.local DCIP=10.10.10.5
#, with the credentials in the environment (scripts/README.md has the list).
TARGET ?=
DCIP ?=
.PHONY: all build sealcheck test vet fmt check mutants pre-commit hooks tickets verify clean
all: check build
build:
go build -o $(BIN) ./cmd/wsmancer
# sealcheck drives the ntlmseal/krbseal providers directly against a WinRM box;
# scripts/verify-matrix.sh runs it, so it stays buildable.
sealcheck:
go build -o wsmancer-sealcheck ./cmd/sealcheck
test:
go test ./...
vet:
go vet ./...
fmt:
gofmt -w cmd internal
check: test vet
@test -z "$$(gofmt -l cmd internal)" || { echo "gofmt needed:"; gofmt -l cmd internal; exit 1; }
# Mutation differentials for the two sealing packages' unit tests. Both need no
# target, so they are CI-safe; kept out of `check` only because they rebuild the
# package once per mutant. Each fails unless every mutant is caught, the
# scripts are the counts, so this comment does not carry one to go stale.
#
# Both exist for the same structural reason and neither generalises to the rest
# of the repo: these are the only packages carrying crypto they implement
# themselves, where a wrong algorithm stays self-consistent across both ends of
# a session and so never surfaces as a visible failure. See each script's
# header, and the "Verifying against a live target" section of CONTRIBUTING.md.
mutants:
./scripts/ntlmseal-mutants.sh
./scripts/krbseal-mutants.sh
# Live checks; need a reachable target, credentials in the environment, and (for
# verify) the tickets `make tickets` mints. See scripts/README.md.
tickets:
@test -n "$(DCIP)" || { echo "set DCIP=<dc-ip> (and TARGET, KRBUSER, KRBPASS, NT, AES)"; exit 1; }
TARGET=$(TARGET) ./scripts/get-tickets.sh $(DCIP)
verify: sealcheck
@test -n "$(TARGET)" -a -n "$(DCIP)" || { echo "set TARGET=<winrm-host> DCIP=<dc-ip>"; exit 1; }
./scripts/verify-matrix.sh $(TARGET) $(DCIP)
pre-commit: check
@echo "Pre-commit checks passed."
hooks:
@mkdir -p .git/hooks
@printf '#!/bin/sh\nmake pre-commit\n' > .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
@echo "Pre-commit hook installed."
clean:
rm -f $(BIN) wsmancer-sealcheck