Skip to content

Instantly share code, notes, and snippets.

@kouzouigh
Last active April 8, 2021 09:13
Show Gist options
  • Save kouzouigh/b2455dd1951a7cfedc3a5cae57107e8e to your computer and use it in GitHub Desktop.
Save kouzouigh/b2455dd1951a7cfedc3a5cae57107e8e to your computer and use it in GitHub Desktop.
Generate CSR with with openssl executed with groovy script
(1..150).each {
def command = ["openssl", "req", "-nodes", "-newkey", "rsa:2048", "-keyout", "/tmp/csr/example${it}.key", "-out", "/tmp/csr/csr_example_${it}.csr", "-subj", "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=example${it}.com"]
def sout = new StringBuilder(), serr = new StringBuilder()
def proc = command.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitFor()
println "out> $sout\nerr> $serr"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment