-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (50 loc) · 1.83 KB
/
Makefile
File metadata and controls
71 lines (50 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
.SUFFIXES:
TEST_USER := $(shell echo ${TEST_USER})
BUILD_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
SCRIPT_DIR = $(BUILD_DIR)/scripts
export PATH := $(shell echo $(SCRIPT_DIR):$${PATH})
PACKAGE_NAME = https-user-management
PACKAGE_FILE = $(PACKAGE_NAME).deb
PACKAGE_CONTROL = $(PACKAGE_NAME)/DEBIAN/control
INSTALL_TARGETS := \
/etc/pam.d/pam_https \
/lib/x86_64-linux-gnu/security/pam_https.so \
/lib/x86_64-linux-gnu/libnss_https.so.2
BUILD_TARGETS := $(PACKAGE_NAME)/lib/x86_64-linux-gnu/security/pam_https.so \
$(PACKAGE_NAME)/lib/x86_64-linux-gnu/libnss_https.so.2
include templates.mk
default: package
dep:
sudo apt -y install libpam0g-dev pamtester
.PHONY: changelog
changelog:
@./scripts/git-changelog > $@
$(PACKAGE_CONTROL): templates/$(PACKAGE_CONTROL)
@: $(call render_template,$<,$@)
$(PACKAGE_FILE): $(BUILD_TARGETS) $(PACKAGE_CONTROL)
@dpkg-deb -v --build --root-owner-group $(PACKAGE_NAME)
@echo >&2 "Package Info:"
@dpkg-deb -v --info $@
@echo >&2 "Package Contents:"
@dpkg-deb -v --contents $@
$(PACKAGE_NAME)/lib/x86_64-linux-gnu/security/pam_https.so: $(wildcard pam-https/*.go)
@mkdir -p $(@D)
@go build -buildmode=c-shared -o $@ $^
$(PACKAGE_NAME)/lib/x86_64-linux-gnu/libnss_https.so.2: $(wildcard nss-https/*.go)
@mkdir -p $(@D)
@CGO_CFLAGS="-g -O2 -D __LIB_NSS_NAME=https" go build --buildmode=c-shared -o $@ $^
/lib/%: $(PACKAGE_NAME)/lib/%
@sudo cp $< $@
/etc/pam.d/%: $(PACKAGE_NAME)/etc/pam.d/%
@sudo cp $< $@
build: $(BUILD_TARGETS)
install: $(INSTALL_TARGETS)
package: $(PACKAGE_FILE)
integrate: install
@sudo getent passwd $(TEST_USER)
@sudo getent shadow $(TEST_USER)
@sudo pamtester -v -I rhost=localhost pam_https $(TEST_USER) authenticate
docker: package
docker build -t dockerpamtest .
clean:
@rm -rf $(BUILD_TARGETS) $(PACKAGE_FILE) $(PACKAGE_CONTROL)