Add some input to system command

I am trying to generate client key using openssl under NodeRED. But for client key, I need input 2 times password. Something looks like this

image

So after entering the encryption command, 2 times password muss be input. My currently flow looks like:

[{"id":"e6461769.ff4f78","type":"exec","z":"bdda48a3.6daf","command":"openssl genrsa -out ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":370,"y":820,"wires":[["e4fefc78.fde458","47c647c0.dc3b88"],[],[]]},{"id":"12b493d.b0a436c","type":"inject","z":"bdda48a3.6daf","name":"Test command","props":[{"p":"payload"},{"p":"payload2","v":"test_client.key -out test_client.csr -subj \"/C=DE/ST=NRW/L=Dortmund/O=EMQX/CN=client\"","vt":"str"},{"p":"payload3","v":"test_client.csr -CA ca.pem -CAkey ca.key -CAcreateserial -out test_client.pem","vt":"str"},{"p":"payload4","v":"test_client.pem -inkey test_client.key -name \"$test_client's certificate/key\" -out test_client.p12 fhDO2021 fhDO2021","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"test_client.key 2048","payloadType":"str","x":150,"y":820,"wires":[["e6461769.ff4f78"]]},{"id":"e4fefc78.fde458","type":"debug","z":"bdda48a3.6daf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":130,"y":960,"wires":[]},{"id":"c67b7575.e6979","type":"debug","z":"bdda48a3.6daf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":940,"wires":[]},{"id":"1523730c.ccb68d","type":"exec","z":"bdda48a3.6daf","command":"openssl req -new -key ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":680,"y":740,"wires":[["21923fa.1b64e4","99460d04.dc9d88"],[],[]]},{"id":"47c647c0.dc3b88","type":"change","z":"bdda48a3.6daf","name":"","rules":[{"t":"move","p":"payload2","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":740,"wires":[["1523730c.ccb68d","5191e82f.71a2a8"]]},{"id":"eb0f74dc.d06548","type":"exec","z":"bdda48a3.6daf","command":"openssl x509 -req -days 3650 -in ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":460,"y":960,"wires":[["c67b7575.e6979","12af44dd.c7a76b"],[],[]]},{"id":"21923fa.1b64e4","type":"change","z":"bdda48a3.6daf","name":"","rules":[{"t":"move","p":"payload3","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":820,"wires":[["eb0f74dc.d06548","47ac890e.a61fb"]]},{"id":"99460d04.dc9d88","type":"debug","z":"bdda48a3.6daf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":890,"y":660,"wires":[]},{"id":"47ac890e.a61fb","type":"debug","z":"bdda48a3.6daf","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":780,"wires":[]},{"id":"5191e82f.71a2a8","type":"debug","z":"bdda48a3.6daf","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":350,"y":660,"wires":[]},{"id":"162abf7b.326489","type":"exec","z":"bdda48a3.6daf","command":"openssl pkcs12 -export -in ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":370,"y":1200,"wires":[["3025bab3.9a602e"],[],[]]},{"id":"12af44dd.c7a76b","type":"change","z":"bdda48a3.6daf","name":"","rules":[{"t":"move","p":"payload4","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":1080,"wires":[["162abf7b.326489","c3ef90b0.f4631"]]},{"id":"3025bab3.9a602e","type":"debug","z":"bdda48a3.6daf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":650,"y":1100,"wires":[]},{"id":"c3ef90b0.f4631","type":"debug","z":"bdda48a3.6daf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":1040,"wires":[]}]

Thanks in advance

You cannot interact with a command line as there is no actual console to interact with when using the exec node.

I can't remember whether openssl allows you to supply the password as a parameter, that would be the easiest. Alternatively, you may be able to pass it using an input pipe, something like openssl blah blah <password.

You are right, man.

openssl pkcs12 -export -in client.pem -inkey client.key -name "$client's certificate/key" -out client.p12 -password pass:abcdef

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.