Skip to content

Commit

Permalink
generate auto signed certs to app
Browse files Browse the repository at this point in the history
  • Loading branch information
muriloAvlis committed Mar 1, 2024
1 parent 1736508 commit 9351ea9
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/iqos-xapp/iqos-xapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func main() {
// set manager configuration
cfg := manager.Config{
AppID: "iqos-xapp",
CAPath: "/etc/iqos-xapp/certs/tls.cacrt",
CAPath: "/etc/iqos-xapp/certs/ca.pem",
KeyPath: "/etc/iqos-xapp/certs/tls.key",
CertPath: "/etc/iqos-xapp/certs/tls.crt",
E2tEndpoint: "onos-e2t",
Expand Down
Empty file removed deploys/helm-chart/TODO
Empty file.
23 changes: 23 additions & 0 deletions deploys/helm-chart/iqos-chart/files/certs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Credits Open Networking Foundation (ONF) -->

## Self-signed Certificates (Test Environment Only!!)
This folder contains self-signed certificates for use in testing. _DO NOT USE THESE
CERTIFICATES IN PRODUCTION!_

The certificates were generated based on the script
[generate_certs.sh](/deployments/helm-chart/qmai/files/certs/generate_certs.sh), as shown below:

```bash
generate-certs.sh qmai.gercom.ufpa.br
```

In this folder they **must** be (re)named
* tls.cacrt
* tls.crt
* tls.key

Use
```bash
openssl x509 -in tls.crt -text -noout
```
to verify the contents (especially the subject).
73 changes: 73 additions & 0 deletions deploys/helm-chart/iqos-chart/files/certs/generate_certs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Credits to Open Networking Foundation (ONF)
# Original script in: https://github.com/onosproject/gnxi-simulators/blob/master/pkg/certs/generate_certs.sh

#!/bin/sh

SUBJBASE="/C=BR/ST=PA/L=Belem/O=UFPA/OU=GERCOM/"
DEVICE=${1:-device1.opennetworking.org}
SUBJ=${SUBJBASE}"CN="${DEVICE}

print_usage() {
echo "Generate a certificate."
echo
echo "Usage: <devicename>"
echo " [-h | --help]"
echo "Options:"
echo " DEVICENAME e.g. device1.opennetworking.org or localhost"
echo " [-h | --help] Print this help"
echo "";
}

# Print usage
if [ "${1}" = "-h" -o "${1}" = "--help" ]; then
print_usage
exit 0
fi

if [ "${PWD##*/}" != "certs" ]; then
cd certs
fi

rm -f ${DEVICE}.*

## BEFORE
# Generate private key for CA
openssl genrsa -out ca.key 4096

# Generate a CA ceriticate
openssl req -x509 -new -nodes -key ca.key -sha256 -days 1825 -out tls.cacert -subj $SUBJ

# Generate Server Private Key
openssl req \
-newkey rsa:4096 \
-nodes \
-keyout tls.key \
-noout \
-subj $SUBJ \
> /dev/null 2>&1

# Generate Req
openssl req \
-key tls.key \
-new -out ${DEVICE}.csr \
-subj $SUBJ \
> /dev/null 2>&1

# Generate x509 with signed CA
openssl x509 \
-req \
-in ${DEVICE}.csr \
-CA tls.cacert \
-CAkey ca.key \
-CAcreateserial \
-days 3650 \
-sha256 \
-out tls.crt \
> /dev/null 2>&1

rm ${DEVICE}.csr ca.key tls.srl

echo " == Certificate Generated: "${DEVICE}.crt" =="
openssl verify -verbose -purpose sslserver -CAfile onfca.crt ${DEVICE}.crt > /dev/null 2>&1
exit $?
#To see full details run 'openssl x509 -in "${TYPE}${INDEX}".crt -text -noout'
33 changes: 33 additions & 0 deletions deploys/helm-chart/iqos-chart/files/certs/tls.cacert
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-----BEGIN CERTIFICATE-----
MIIFuzCCA6OgAwIBAgIUbju5aB5kxkJ/m7XjZ6spvrnPTVMwDQYJKoZIhvcNAQEL
BQAwbTELMAkGA1UEBhMCQlIxCzAJBgNVBAgMAlBBMQ4wDAYDVQQHDAVCZWxlbTEN
MAsGA1UECgwEVUZQQTEPMA0GA1UECwwGR0VSQ09NMSEwHwYDVQQDDBhpcW9zLXhh
cHAuZ2VyY29tLnVmcGEuYnIwHhcNMjQwMzAxMTkyMzMyWhcNMjkwMjI4MTkyMzMy
WjBtMQswCQYDVQQGEwJ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UP0yXLpluO/PHQViWIf2V
3AI0GqE+su++9suqdSKuiOOrJ+vD97e4klARS6cGdnM0MhF2IesrVfbEAjM8cqA9
LAif+fs1Nd6BNLP5axeLLMrKsLNgqdmdBf/4rf03qgNx70D65mWU6ljqpdRaypoM
7xshDMI+plYRKZOJ69bbcl84pXIPbFMW52gPdR0e9Bv2CHm+mkBX/L8Ou4dYgPzD
hkPuoI9pCUfCLEI1Ejp3wJnhme/ph7IBl91/VUEC+O9Gbq3NzyFxq1gBVd+nlzO6
yZ5NbihpO2KEmkYPWwwdP66W6anaUQmMYM0yYmRMZl1GTm5svF5WR0sxa6Vxh9Np
IgJxlbMkTxGm1UON9VzDMrB/4XsoXCbUk3yc8oJ9tAAm6v80+7UvIkYOHhnAMMzj
CroEcqpk7dJrcYZPgFWDnCOAvkwj2qa0uR2NujVk/vrBSIeg+DEKQ/WXHRpufeT3
gMfFhBYJxS1kdHKJ5b2DvzwAQLYvlrvPZlIE2G+KvuGiR6oc0A7f5k3wg7RCMaUc
vtbhRcvjjYLoUilAz1cI33REgku/5zcw2aPMToB3GX/vL7COvUMLBqZ+94jHAvB5
j0WjIAdGtSu/DWReu/k9Q4+i2KTWL+owPt/VBnlA1w==
-----END CERTIFICATE-----
33 changes: 33 additions & 0 deletions deploys/helm-chart/iqos-chart/files/certs/tls.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-----BEGIN CERTIFICATE-----
MIIFqjCCA5KgAwIBAgIUXWcRZM4UQYWxpPFPJv1W7YV7tR8wDQYJKoZIhvcNAQEL
BQAwbTELMAkGA1UEBhMCQlIxCzAJBgNVBAgMAlBBMQ4wDAYDVQQHDAVCZWxlbTEN
MAsGA1UECgwEVUZQQTEPMA0GA1UECwwGR0VSQ09NMSEwHwYDVQQDDBhpcW9zLXhh
cHAuZ2VyY29tLnVmcGEuYnIwHhcNMjQwMzAxMTkyMzMyWhcNMzQwMjI3MTkyMzMy
WjBtMQswCQYDVQQGEwJCUjELMAkGA1UECAw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UoQBW6oxPtBqPI/DhgBuHAz6vKkMx6s6csbfWRpI10kHCnQse5
SwDmJdSDjEkdz170s/bExvSRIhO8IuHYRPWdXUQ3gydnjmubDBjPH2EvaxAeX9Ia
wXklfipFmr3mRMZ10F8BrOVk8hBSv26RZX1VbO+VuqavEJ6bgbtRUnivNT7PHWLA
H9eS4xuKciU6BFr3pyDUAIANYu+Rt6UFbi+lK+IJT3zuBC/Iycb9EgWMzGaym6sy
P2BsbiGm/7P2xG1+g6hPTIaukGycKEMHGAj5b09ixX2FQnocy0MleiBPWU+E1FvQ
nhWQUnVdLFIlq47hB8Q3Zlr5aQ3ZxW2fSmpgv//i8f9vLW2eTls2Oo/cFNkSdjTZ
py8ONXAodY2Ruolfy8afhRi5oMBuDy8yc/ursQxkKAknOkLRjQ9K5Oth9vw2AGGN
IT1rqH6DEAFmivRGxClBqGwmdRUS+5xsmu7+juGrFg442p2Gn4Wbt1orlKEjc1wL
oJ0O/TVFeQ7MIMZ0Q2SPuuDv/oKIh8qpJmk3SHAHTC5JeIA+JBN545XWQ/VllGMM
vES0B9koni8IuPR9rFk=
-----END CERTIFICATE-----
52 changes: 52 additions & 0 deletions deploys/helm-chart/iqos-chart/files/certs/tls.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDnhauaqLY9G81f
NS24l9dN+E/22liYkeLpvEp7kF385230GKJStJO3mGQs9hfYwCXLIKwV7VoOlJJs
19d1s0QSbcoiLxUrALzVwCDbND7ghH4BZfSr/oDMqOcro5M0jFXjcsPBmpYPT1KQ
ZkukqIjac8CeHHsUgC8+ounO30Pa1QjysKXfxkczsZPbreMEaHbJ2DZLTD2Bs8zs
Ez5RjtGYVAES9Xjzw9+LssPzVs1Qydz1yvXPEfhwkGrMPfUN/nj2p718QlYjZSVf
x/LriqG/0s2ZSdZa8ya2aw/e5yI5Q/diZOAOF8X7BWs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gu3bsHuGMneWwv7mDrRm+V2BpAoIBABxW3snPC2hxxLQYftgy
ebxdioXvLorzqIN6PMCEmP6xcrS+g1VxoQA0mHyNfwpB86Mtc4P3HewkRgnPNe0w
aWM2UR4e79w7RZuqZKg1iKGMSyeA3rUnqtW1VV9KsUwbEj6ZLP45gPFWvU0KRWix
j+enM9DyJbqMBwB+INIc1KOISuU2Zt3meoiJQgSq50VwY8J3ILLcPdsFjdOCIrvS
7BTMYuHLj1LFYbnrBmDHTk1WPkS390sq89VQofmniP+g/POf2SIka+LoK+4hjLqJ
YdR12tcx6jUP8vnyips2KdowT6ns/UCfRwK24MoLSsiZEwe0rXms+QCZR3unIkul
1SECggEAI82Me3c3EWIcVxjCTRVhqtNqoFbV98MgxkLCnPdZfn6JyPdwDhhoKcvh
p+EMov6s3SHAdlkIT/kAyuT85ND4iPwsH2m8J8+5X/RUZNbbiFKV4bSIveUAfPMI
R4O6/L5VZuoyZ+3j62nte7/Cm7dcyK/oUvXfWmDvAgLFFyyI8kyZRW1yS4fwLvKy
4PZ3usqz8P3anog8k+nYw30qSJJal3vmY1F9dkP0QwiVQD7lK7TBelkhdi4h56ag
CfpJJTLSoNuFGOIbMmovaBMF4KdXO00FJzrUhIgym6bq3OvnqCYP0duMRAtuASFS
ACyB/vYp0FwDxf6we3+0WNEe7ZSulA==
-----END PRIVATE KEY-----
21 changes: 21 additions & 0 deletions deploys/helm-chart/iqos-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ service:
enabled: false
port: 31701

config:
iqos-xapp:
# e2tEndpoint: "onos-e2t:5150" (TODO)
# kpmVersion: "v2"
configJson:
reportPeriod:
interval: 1000 # 1000 ms ??
granularity: 1000 # 1000 ms ??
slices: # (TODO)

resources: {}

Expand All @@ -41,3 +50,15 @@ ingress:
autoscaling:
enabled: false
minReplicas: 1

logging:
loggers:
root:
level: info
output:
stdout:
sink: stdout
sinks:
stdout:
type: stdout
stdout: {}

0 comments on commit 9351ea9

Please sign in to comment.