@@ -23,6 +23,7 @@ with import ../../../lib.nix;
23
23
, useLegacyDataLayer ? false
24
24
, extraParams ? ""
25
25
, useStackBinaries ? false
26
+ , tlsConfig ? { }
26
27
} :
27
28
28
29
# TODO: DEVOPS-159: relays DNS should be more predictable
82
83
-H "Content-Type: application/json; charset=utf-8" \
83
84
"https://${ walletListen } /$request_path" "$@"
84
85
'' ;
86
+ tlsConfigResultant = {
87
+ organization = "Company Name" ;
88
+
89
+ caCommonName = "Company Name Self-Signed Root CA" ;
90
+ caEexpiryDays = 3650 ;
91
+
92
+ serverCommonName = "Company Name Wallet Node" ;
93
+ serverExpiryDays = 365 ;
94
+ serverAltDNS = [
95
+ "localhost"
96
+ "localhost.localdomain"
97
+ "127.0.0.1"
98
+ "::1"
99
+ ] ;
100
+ serverAltDNSExtra = [ ] ;
101
+
102
+ clientCommonName = "Company Name Wallet Node Client" ;
103
+ clientExpiryDays = 365 ;
104
+ } // tlsConfig ;
105
+ tlsConfigFile = let cfg = tlsConfigResultant ; in writeText "tls-config-${ environment } .yaml" ( ''
106
+ ${ environments . ${ environment } . confKey } :
107
+ tls:
108
+ ca:
109
+ organization: ${ cfg . organization }
110
+ commonName: ${ cfg . caCommonName }
111
+ expiryDays: ${ toString cfg . caEexpiryDays }
112
+
113
+ server:
114
+ organization: ${ cfg . organization }
115
+ commonName: ${ cfg . serverCommonName }
116
+ expiryDays: ${ toString cfg . serverExpiryDays }
117
+ altDNS:
118
+ '' +
119
+ ( let sep = " - " ; in sep + ( concatStringsSep ( "\n " + sep ) ( cfg . serverAltDNS ++ cfg . serverAltDNSExtra ) ) + "\n " )
120
+ + ''
121
+ ####
122
+ clients:
123
+ - organization: ${ cfg . organization }
124
+ commonName: ${ cfg . clientCommonName }
125
+ expiryDays: ${ toString cfg . clientExpiryDays }
126
+ '' ) ;
85
127
86
128
in writeScript "${ executable } -connect-to-${ environment } " ''
87
129
#!${ stdenv . shell }
@@ -111,7 +153,8 @@ in writeScript "${executable}-connect-to-${environment}" ''
111
153
${ executables . x509gen } \
112
154
--server-out-dir ${ stateDir } /tls/server \
113
155
--clients-out-dir ${ stateDir } /tls/client \
114
- ${ configurationArgs }
156
+ --configuration-file ${ tlsConfigFile } \
157
+ --configuration-key ${ environments . ${ environment } . confKey }
115
158
fi
116
159
ln -sf ${ curlScript } ${ stateDir } /curl
117
160
'' }
0 commit comments