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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
| mkdir -p ssl/ca cfssl print-defaults config > ssl/ca/ca-config.json cfssl print-defaults csr > ssl/ca/ca-csr.json
cat << 'EOF' > ssl/ca/ca-config.json { "signing": { "default": { "expiry": "2540400h" }, "profiles": { "server": { "expiry": "2540400h", "usages": [ "signing", "key encipherment", "server auth" ] }, "client": { "expiry": "2540400h", "usages": [ "signing", "key encipherment", "client auth" ] }, "peer": { "expiry": "2540400h", "usages": [ "signing", "key encipherment", "server auth", "client auth" ] } } } } EOF
cfssl gencert -initca ssl/ca/ca-csr.json | cfssljson -bare ssl/ca/ca -
mkdir -p ssl/server cfssl print-defaults csr > ssl/server/server.json
cat << 'EOF' > ssl/server/server.json { "CN": "server1", "hosts": [ "192.168.100.201", "page.pikeszfish.me", "www.pikeszfish.me" ], "key": { "algo": "ecdsa", "size": 256 }, "names": [ { "C": "CN", "ST": "SH", "L": "Shanghai" } ] } EOF
cfssl gencert -ca=ssl/ca/ca.pem -ca-key=ssl/ca/ca-key.pem -config=ssl/ca/ca-config.json -profile=server ssl/server/server.json | cfssljson -bare ssl/server/server
mkdir -p ssl/client cfssl print-defaults csr > ssl/client/client.json
cat << 'EOF' > ssl/client/client.json { "CN": "client", "hosts": [], "key": { "algo": "ecdsa", "size": 256 }, "names": [ { "C": "CN", "ST": "SH", "L": "Shanghai" } ] } EOF
cfssl gencert -ca=ssl/ca/ca.pem -ca-key=ssl/ca/ca-key.pem -config=ssl/ca/ca-config.json -profile=client ssl/client/client.json | cfssljson -bare ssl/client/client
mkdir -p ssl/peer cfssl print-defaults csr > ssl/peer/peer.json
cat << 'EOF' > ssl/peer/peer.json { "CN": "example.net", "hosts": [ "example.net", "www.example.net" ], "key": { "algo": "ecdsa", "size": 256 }, "names": [ { "C": "US", "ST": "CA", "L": "San Francisco" } ] } EOF
cfssl gencert -ca=ssl/ca/ca.pem -ca-key=ssl/ca/ca-key.pem -config=ssl/ca/ca-config.json -profile=peer ssl/peer/peer.json | cfssljson -bare ssl/peer/peer
|