-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (53 loc) · 1.69 KB
/
Makefile
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
PKG_DIR = $(NCS_DIR)/packages/auth/cisco-nso-saml2-auth
.PHONY: all packages/cisco-nso-saml2-auth
all: pyvenv packages/cisco-nso-saml2-auth flask-saml2 load start-idp
load:
ncs-setup --dest .
cp ncs.conf.example ncs.conf
(. pyvenv/bin/activate ; make start )
packages/cisco-nso-saml2-auth:
cp -a $(PKG_DIR) $@
$(MAKE) clean all -C $@/src
pyvenv:
virtualenv $@
pyvenv/bin/pip $(PIP_OPTS) install pip --upgrade
flask-saml2: pyvenv
git clone https://github.com/mx-moth/flask-saml2.git
# Patch flask-saml2 to use SHA-256 by default instead of SHA-1
(cd flask-saml2/flask_saml2; sed -i'' -e 's/Sha1/Sha256/g' idp/idp.py sp/sp.py )
pyvenv/bin/pip $(PIP_OPTS) install -e flask-saml2
pyvenv/bin/pip $(PIP_OPTS) install -r flask-saml2/tests/requirements.txt
# pyOpenSSL 22.0.0 is needed on platforms with OpenSSL 3.0.
# Note that flask-saml2 requires pyOpenSSL < 18, but works with newer.
pyvenv/bin/pip $(PIP_OPTS) install pyopenssl --upgrade
pyvenv/bin/pip $(PIP_OPTS) install requests
cisco-nso-saml2-auth-deps: pyvenv
pyvenv/bin/pip $(PIP_OPTS) install -r \
$(PACKAGE_DIR)/cisco-nso-saml2-auth/requirements.txt
touch $@
.PHONY: start-idp
start-idp: flask-saml2
(. pyvenv/bin/activate ; nohup ./idp.py &)
.PHONY: clean
clean: stop
$(MAKE) -C packages/cisco-nso-saml2-auth/src clean || true
rm -rf ./netsim running.DB logs/* state/* ncs-cdb/*
rm -rf pyvenv flask-saml2 __pycache__
rm -f README.n* cisco-nso-saml2-auth-deps ncs.conf
.PHONY: clean
clean-logs:
rm -f logs/*
.PHONY: start
start:
ncs --with-package-reload-force
ncs_load -l -m cisco-nso-saml2-auth.xml
.PHONY: stop
stop:
-ncs --stop
-pkill -f idp.py
.PHONY: cli-c
cli-c:
ncs_cli -C -uadmin
.PHONY: cli-j
cli-j:
ncs_cli -J -uadmin