Browse Source

fix(tools): Make the ApplicationUri in the certificate configurable

Julius Pfrommer 5 years ago
parent
commit
5065bb1159
2 changed files with 8 additions and 2 deletions
  1. 6 1
      tools/certs/create_self-signed.py
  2. 2 1
      tools/certs/localhost.cnf

+ 6 - 1
tools/certs/create_self-signed.py

@@ -23,6 +23,7 @@ parser.add_argument('outdir',
 parser.add_argument('-u', '--uri',
                     metavar="<ApplicationUri>",
                     type=str,
+                    default="",
                     dest="uri")
 
 parser.add_argument('-k', '--keysize',
@@ -40,8 +41,12 @@ keysize = 2048
 if args.keysize:
     keysize = args.keysize
 
+if args.uri == "":
+    args.uri = "urn:open62541.server.application"
+    print("No ApplicationUri given for the certificate. Setting to %s" % args.uri)
+os.environ['URI1'] = args.uri
+
 certsdir = os.path.dirname(os.path.abspath(__file__))
-print(certsdir)
 
 # Function return TRUE (1) when an IP address is associated with the
 # given interface

+ 2 - 1
tools/certs/localhost.cnf

@@ -15,6 +15,7 @@ oid_section		= new_oids
 hostname = ${ENV::HOSTNAME}
 ipaddress1 = ${ENV::IPADDRESS1}
 ipaddress2 = ${ENV::IPADDRESS2}
+uri1 = ${ENV::URI1}
 
 # To use this configuration file with the "-extfile" option of the
 # "openssl x509" utility, name here the section containing the
@@ -231,7 +232,7 @@ DNS.1 = ${hostname}
 DNS.2 = ${hostname}
 IP.1 = ${ipaddress1}
 IP.2 = ${ipaddress2}
-URI.1 = urn:open62541.server.application
+URI.1 = ${uri1}
 
 [ v3_ca ]