-
Notifications
You must be signed in to change notification settings - Fork 16
/
makefile.certs
70 lines (47 loc) · 3.94 KB
/
makefile.certs
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
#this is macos/linux makefile to build the test keys
all: cmd/keymaster/testcerts_test.go cmd/keymasterd/testcerts_test.go lib/vip/testcerts_test.go lib/authutil/testcerts_test.go lib/pwauth/ldap/testcerts_test.go lib/client/twofa/testcerts_test.go
lib/client/twofa/testcerts_test.go:
echo "package twofa\n\nconst rootCAPem = \``cat misc/testcerts/root.pem`\`\n\nconst localhostCertPem = \``cat misc/testcerts/localhost.pem`\`\n\nconst localhostKeyPem = \``cat misc/testcerts/eekey.pem`\`\n\n" > lib/client/twofa/testcerts_test.go
lib/pwauth/ldap/testcerts_test.go:
echo "package ldap\n\nconst rootCAPem = \``cat misc/testcerts/root.pem`\`\n\nconst localhostCertPem = \``cat misc/testcerts/localhost.pem`\`\n\nconst localhostKeyPem = \``cat misc/testcerts/eekey.pem`\`\n\n" > lib/pwauth/ldap/testcerts_test.go
lib/authutil/testcerts_test.go:
echo "package authutil\n\nconst rootCAPem = \``cat misc/testcerts/root.pem`\`\n\nconst localhostCertPem = \``cat misc/testcerts/localhost.pem`\`\n\nconst localhostKeyPem = \``cat misc/testcerts/eekey.pem`\`\n\n" > lib/authutil/testcerts_test.go
lib/vip/testcerts_test.go:
echo "package vip\n\nconst rootCAPem = \``cat misc/testcerts/root.pem`\`\n\nconst localhostCertPem = \``cat misc/testcerts/localhost.pem`\`\n\nconst localhostKeyPem = \``cat misc/testcerts/eekey.pem`\`\n\n" > lib/vip/testcerts_test.go
cmd/keymasterd/testcerts_test.go: misc/testcerts/localhost.pem misc/testcerts/root.pem misc/testcerts/eekey.pem
echo "package main\n\nconst rootCAPem = \``cat misc/testcerts/root.pem`\`\n\nconst localhostCertPem = \``cat misc/testcerts/localhost.pem`\`\n\nconst localhostKeyPem = \``cat misc/testcerts/eekey.pem`\`\n\n" > cmd/keymasterd/testcerts_test.go
cmd/keymaster/testcerts_test.go: misc/testcerts/localhost.pem misc/testcerts/root.pem misc/testcerts/eekey.pem
echo "package main\n\nconst rootCAPem = \``cat misc/testcerts/root.pem`\`\n\nconst localhostCertPem = \``cat misc/testcerts/localhost.pem`\`\n\nconst localhostKeyPem = \``cat misc/testcerts/eekey.pem`\`\n\n" > cmd/keymaster/testcerts_test.go
misc/testcerts/localhost.pem: misc/testcerts/localhost.csr misc/testcerts/localhost.ext misc/testcerts/root.pem
openssl x509 -req -sha256 -days 730 -CAkey misc/testcerts/rootkey.pem -CA misc/testcerts/root.pem -set_serial 12312389324 -out misc/testcerts/localhost.pem -in misc/testcerts/localhost.csr -extfile misc/testcerts/localhost.ext
misc/testcerts/localhost.csr: misc/testcerts/eekey.pem
openssl req -new -key misc/testcerts/eekey.pem -batch -out misc/testcerts/localhost.csr -utf8 -subj '/CN=localhost'
misc/testcerts/localhost.ext:
echo "basicConstraints = CA:FALSE\nsubjectAltName =DNS:localhost\nextendedKeyUsage =serverAuth\n" > misc/testcerts/localhost.ext
misc/testcerts/eekey.pem:
openssl genpkey -algorithm RSA -out misc/testcerts/eekey.pem -pkeyopt rsa_keygen_bits:2048
misc/testcerts/root.pem: misc/testcerts/root.csr misc/testcerts/rootkey.pem
openssl x509 -req -sha256 -days 7300 -in misc/testcerts/root.csr -signkey misc/testcerts/rootkey.pem -set_serial 10 -out misc/testcerts/root.pem
misc/testcerts/root.csr: misc/testcerts/rootkey.pem
openssl req -new -key misc/testcerts/rootkey.pem -out misc/testcerts/root.csr -utf8 -subj '/C=US/O=TestOrg/OU=Test CA'
misc/testcerts/root.ext:
echo "basicConstraints = CA:TRUE\n" > misc/testcerts/root.ext
misc/testcerts/rootkey.pem:
openssl genpkey -algorithm RSA -out misc/testcerts/rootkey.pem -pkeyopt rsa_keygen_bits:4096
clean-all: clean cleanint
clean:
rm -f cmd/keymaster/testcerts_test.go
rm -f cmd/keymasterd/testcerts_test.go
rm -f lib/vip/testcerts_test.go
rm -f lib/authutil/testcerts_test.go
rm -f lib/pwauth/ldap/testcerts_test.go
rm -f lib/client/twofa/testcerts_test.go
cleanint:
rm -f misc/testcerts/root.csr
rm -f misc/testcerts/rootkey.pem
rm -f misc/testcerts/root.ext
rm -f misc/testcerts/root.pem
rm -f misc/testcerts/eekey.pem
rm -f misc/testcerts/localhost.csr
rm -f misc/testcerts/localhost.ext
rm -f misc/testcerts/localhost.pem