#!/bin/bash

# Nokia
#IANA_REGISTRY=192.168.100.2:5000
# TS
IANA_REGISTRY=192.168.100.2:5000

mkdir -p certs/"$IANA_REGISTRY"

(
  cd certs/"$IANA_REGISTRY" || exit 1

  openssl s_client -showcerts -connect "$IANA_REGISTRY" </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' >ca.crt

  openssl genrsa -out client.key 4096
  openssl req -new -x509 -text -key client.key -out client.cert \
    -subj "/C=DE/ST=Northrhine Westphalia/L=Essen/O=University Duisburg-Essen/emailAddress=tuan-dat.tran@stud.uni-due.de"
)
