@@ -21,7 +21,7 @@ The FED builder takes the `.pol` and `.env` archive and JSON files to configure
2121The script is invoked with the `jython` interpreter provided with the package and deployment tools of the API Gateway.
2222
2323....
24- $ jython buildfed.py --help
24+ $ buildfed.sh --help
2525Usage: buildfed.py OPTIONS
2626
2727Options:
@@ -56,7 +56,13 @@ Options:
5656 --passphrase-out=PASSPHRASE
5757 Passphrase for output archive files [optional]
5858 -s, --simulate Enable simulation mode [optional]
59- -b, --base-dir Base directory for certificate files [optional]
59+ -b DIRECTORY, --base-dir=DIRECTORY
60+ Base directory for certificate files [optional]
61+ --secrets-file=FILEPATH
62+ Path of JSON file containing confidential propertiers
63+ [optional]
64+ --secrets-passphrase=PASSPHRASE
65+ Passphrase to decrypt confidential properties [optional]
6066....
6167
6268If environmentalized fields or certificates are not configured, the build fails.
@@ -67,7 +73,6 @@ Missing fields or certificates are automatically added to the configuration file
6773|Option
6874|Description
6975
70-
7176|-e, --env
7277|The `.env` file as generated by the `projpack` tool.
7378The option is mandatory.
@@ -150,9 +155,75 @@ To avoid errors due to incompatible types (e.g. placeholder string used for an i
150155|-b, --base-dir
151156|Base directory for certificate files.
152157If specified relative path to certificate files is based on this directory.
158+
159+ |--secrets-file
160+ |Path of JSON file containing confidential properties.
161+ The file has to be created by the `encrypt` tool.
162+
163+ |--secrets-passphrase
164+ |Passphrase to decryt confidential properties.
165+ This parameter is requried if a secrets file is specified.
166+ The passphrase has to be the same as on creating the secrets file.
153167|===
154168
155169
170+ == Encrypt Secrets
171+
172+ The `encrypt` tools is used to generate an initial secrets file and to encrypt the values of the properties.
173+ The script is invoked with the `jython` interpreter provided with the package and deployment tools of the API Gateway.
174+
175+ The tool requries a path to the secrets file and a passphrase to encryt the values.
176+ If the secrets file doesn't exist a new file will be created.
177+ For existing files the given passphrase is checked against the passphrase used on file creation.
178+
179+ ....
180+ $ encrypt.sh -h
181+ Usage: secrets.py OPTIONS
182+
183+ Options:
184+ --version show program's version number and exit
185+ -h, --help show this help message and exit
186+ -v, --verbose Enable verbose messages [optional]
187+ --secrets-file=FILEPATH
188+ Path of JSON file containing confidential properties
189+ --secrets-passphrase=PASSPHRASE
190+ Passphrase to decrypt confidential values
191+
192+ Encrypt credentials.
193+ ....
194+
195+ [cols="2,5a", options="header"]
196+ |===
197+ |Option
198+ |Description
199+
200+ |--secrets-file
201+ |Path of JSON file containing confidential properties.
202+
203+ |--secrets-passphrase
204+ |Passphrase to decrypt confidential properties.
205+ This parameter is requried if a secrets file is specified.
206+ |===
207+
208+ To add new properties tag the values with the `encrypt:` prefix.
209+ Values having this prefix will be encrypted on running the tool.
210+
211+ [source,json]
212+ ----
213+ {
214+ "secrets": {
215+ "__": "3QjoMSfhSelmvMlvcgCdyHf+oTyVnHlyneA3stpN0iQKJ1BUIrY9OA==", <1>
216+ "my.password": "encrypt:changeme", <2>
217+ "cert.password": "eL5+ogfSxQue8+NA0/l859g/2nTFwxBUp/7l7z/sMOE=" <3>
218+ }
219+ }
220+ ----
221+ <1> Marker to check the passphrase. Don't delete or change it.
222+ <2> The prefix `encrypt:` indicates that the value `changeme` has to be encrypted.
223+ <3> Values without the prefix are already encrypted and will not be changed.
224+
225+ NOTE: The `encrypt` tool use the cipher of the entity store.
226+
156227== Configuration Files
157228
158229For the configuration of the environment specific deployment archive, various configuration files are used.
@@ -269,9 +340,20 @@ If the `gateway.info.json` file is not available the property contains an empty
269340 "value": "USERNAME" <11>
270341 }
271342 }
343+ },
344+ "/[CircuitContainer]name=Hello World/[FilterCircuit]name=Hello World Message/[SetAttributeFilter]name=Secret": {
345+ "description": "Some secret information",
346+ "fields": {
347+ "attributeValue#0": {
348+ "source": "secrets" <12>
349+ "type": "string",
350+ "used": true,
351+ "value": "secret" <13>
352+ }
353+ }
272354 }
273355 }
274- "properties": { <12 >
356+ "properties": { <14 >
275357 "foobar": "myvalue"
276358 }
277359}
@@ -289,9 +371,12 @@ The property is automatically maintained by the plugin.
289371<9> Literal value for the field.
290372<10> Specifies an environment variable as the source for the field value.
291373<11> Field value is retrieved from the `USERNAME` environment variable.
292- <12> An optional local definition of properties.
374+ <12> Specifies an property from the secrets file as the source for the field value.
375+ <13> Field value is retrieved from the `secret` property in the secrets file.
376+ <14> An optional local definition of properties.
293377If the same property is defined in a separate property file (see below), the separate property has precedence.
294378
379+
295380NOTE: If `value` is _null_ the field is treated as undefined and the build will fail.
296381
297382=== Certificates
@@ -418,3 +503,25 @@ The shift of properties to a separate file enables them to be exclude from the s
418503In productive environments secretes may be stored in a secured configuration database.
419504For the build process the property file may be temporarily generated from the configuration database.
420505====
506+
507+ === Secrets
508+
509+ A secrets file is used to store confidential configurations (e.g. passwords).
510+ The values of the properties are encrypted and can be access with a passphrase only.
511+ All values are encrypted with the same passphrase.
512+
513+ .gateway.crypt.json
514+ [source,json]
515+ ----
516+ {
517+ "secrets": { <1>
518+ "__": "3QjoMSfhSelmvMlvcgCdyHf+oTyVnHlyneA3stpN0iQKJ1BUIrY9OA==", <2>
519+ "my.password": "encrypt:changeme", <3>
520+ "cert.password": "eL5+ogfSxQue8+NA0/l859g/2nTFwxBUp/7l7z/sMOE=" <4>
521+ }
522+ }
523+ ----
524+ <1> The `secrets` property is requried.
525+ <2> Marker to check the passphrase. Don't delete or change it.
526+ <3> The prefix `encrypt:` indicates that the value `changeme` has to be encrypted by the `encrypt` tool.
527+ <4> Values without the prefix are already encrypted.
0 commit comments