Skip to content

Commit

Permalink
Use fixed cert and key (sonic-net#121)
Browse files Browse the repository at this point in the history
Why I did it
Use fixed cert, and gnmi client doesn't need to update cert for new test container.

How I did it
Add fixed cert and key to repo.

How to verify it
Use GNMI test container to run basic test.
  • Loading branch information
ganglyu authored Oct 28, 2022
1 parent ec03b12 commit 20326a2
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 18 deletions.
24 changes: 6 additions & 18 deletions dockers/docker-gnmi-test/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,12 @@ COPY gnmi.conf /etc/supervisor/conf.d/
COPY start.sh /usr/bin
RUN chmod +x /usr/bin/start.sh

COPY dsmsroot.conf /root/
COPY server.conf /root/
COPY client.conf /root/

# Create Root key and cert
RUN openssl genrsa -out /root/dsmsroot.key 2048
RUN openssl req -new -sha256 -out /root/dsmsroot.csr -key /root/dsmsroot.key -config /root/dsmsroot.conf -batch
RUN openssl x509 -req -days 3650 -in /root/dsmsroot.csr -signkey /root/dsmsroot.key -out /root/dsmsroot.cer

# Create server key and cert
RUN openssl genrsa -out /root/gnmiserver.key 2048
RUN openssl req -new -sha256 -out /root/gnmiserver.csr -key /root/gnmiserver.key -config /root/server.conf -batch
RUN openssl x509 -req -days 3650 -CA /root/dsmsroot.cer -CAkey /root/dsmsroot.key -CAcreateserial -in /root/gnmiserver.csr -out /root/gnmiserver.cer -extensions req_ext -extfile /root/server.conf

# Create client key and cert
RUN openssl genrsa -out /root/gnmiclient.key 2048
RUN openssl req -new -sha256 -out /root/gnmiclient.csr -key /root/gnmiclient.key -config /root/client.conf -batch
RUN openssl x509 -req -days 3650 -CA /root/dsmsroot.cer -CAkey /root/dsmsroot.key -CAcreateserial -in /root/gnmiclient.csr -out /root/gnmiclient.cer -extensions req_ext -extfile /root/client.conf
COPY dsmsroot.key /root/
COPY dsmsroot.cer /root/
COPY gnmiserver.key /root/
COPY gnmiserver.cer /root/
COPY gnmiclient.key /root/
COPY gnmiclient.cer /root/

RUN cp /root/dsmsroot.cer /etc/sonic/
RUN cp /root/gnmiserver.cer /etc/sonic/
Expand Down
20 changes: 20 additions & 0 deletions dockers/docker-gnmi-test/dsmsroot.cer
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIDMTCCAhkCFFZ16+VeNi405iJg2WOXF/O6batcMA0GCSqGSIb3DQEBCwUAMFUx
CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCQ0ExEjAQBgNVBAoM
CU1pY3Jvc29mdDEYMBYGA1UEAwwPdGVzdC5nbm1pLnNvbmljMB4XDTIyMTAyNzA2
MTExN1oXDTMyMTAyNDA2MTExN1owVTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNB
MQswCQYDVQQHDAJDQTESMBAGA1UECgwJTWljcm9zb2Z0MRgwFgYDVQQDDA90ZXN0
LmdubWkuc29uaWMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDO7RWn
ZIjhxFStKHDjRM0rXqAhpp1DdtisPxHK3qkAT7upVWA8v0wZKJXkMKug6NFg+KZT
lSKieO3K/LU4f0m4v2jPfwHySKhWLiN/2NIq2zJYp0tCVNNAxNh2WqJWyR+unjch
/ub6zGYCS0Phesxo1oOs7i+hCvsEOfb2fUXNKdovZ6wKbzFEI24oUioQZdAtfMcj
oU3LFVaDLdtxPErC0vIzpd3RyhfD6txFc7U3rQhtlLmLQUFJ9aM5O/f8mv6FJ20p
t0yq36V23MwUqL1IlZywYQEbTv4laszDln2DiwTiMeHeHzNDSXmvi9PcHeKEQm7n
NWEgm1A8ZTfGmapXAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAG9PGvT3Ko2rlt7P
zVHjkACS6VI3zXjPxiV90GQVAhJmn//BTRE190ITQ5xVQiQUIC9hEQJDAkmqQM1r
ZCRcbBECxkD1Udk5NQr9Xvq+LMNkRP0o3Tb0UwdG83kh31xn0e/tcCGulRirQ6Yi
56BqdYTw6TA49df74mq1nqdRsfTvMAtCpSTie8orDDWNH3cpFT2Bei9IWf0jEVkx
auDEsekj8otjQasGXMSYyzQi27jJ3czXYHQGxYwaFdkX/daXAKWKll+G4j7zygFF
YsA7FQMHKHgtmRkQVFJFAUvv5GO/0+4OlyBJ6Ej1gytVEYvZVAuPHGfmt+9JrABQ
YnODGdQ=
-----END CERTIFICATE-----
27 changes: 27 additions & 0 deletions dockers/docker-gnmi-test/dsmsroot.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAzu0Vp2SI4cRUrShw40TNK16gIaadQ3bYrD8Ryt6pAE+7qVVg
PL9MGSiV5DCroOjRYPimU5Uionjtyvy1OH9JuL9oz38B8kioVi4jf9jSKtsyWKdL
QlTTQMTYdlqiVskfrp43If7m+sxmAktD4XrMaNaDrO4voQr7BDn29n1FzSnaL2es
Cm8xRCNuKFIqEGXQLXzHI6FNyxVWgy3bcTxKwtLyM6Xd0coXw+rcRXO1N60IbZS5
i0FBSfWjOTv3/Jr+hSdtKbdMqt+ldtzMFKi9SJWcsGEBG07+JWrMw5Z9g4sE4jHh
3h8zQ0l5r4vT3B3ihEJu5zVhIJtQPGU3xpmqVwIDAQABAoIBAACg2ar7dCrzVKp9
7/HQuKrEC8puXhXhW4ESY/RwvqSgmVpHRxaIIiwFYoch2rOPYWtg9ehVEJjbsyUl
pUs5n7iu5BuVMCVTMSep1jPCLckxhzKbt2/JICcXMe0SE2IeFDmMg3BX/M2QJ1Mk
dV1O6SX8WMQCqSRdCywVHPncoYSg9YC2FI4DlwuO2BlVSKxoOTRBhzSueqxfvRK4
jW4Zxv0NFOVUauCVNzoQRMLtYRMQfb6u+cujhFy7binePh+LE189PzToD1m8mIoD
R4UAJGvOH38Jka0UC9k0zoyirmid7S1NT14KbuC1qKSTFglUK96DwZiW/cjco3QW
j2PQAJECgYEA+QMSlUpV33lJnGrAy9vUWIiPUj2IMM4zGopZQXwIQ+ls/74QZMKZ
eYzRs+sgYML5/Gx2kmRleswjafQ2JPO6rcuTO9HiKdoy/TZMWkYC/rvHeauxfZla
0BMhNWcCNAtwS984AKotg33qXohAFAnPQpYvlzCA/+j36XYJIChD2AkCgYEA1Lup
prWfCEZ9ozNtVuJegpr7A2xK09mew74i4Shky+TizJ+iEiTwio85iyf5RwVWq0wX
GsiMA+tvTXf1HKL+AyJFJZFhBsZzswwN1ICcMmWDIs/bnvny/NyzZJ8tUM3dPThh
ODqiCFnoTQYyhWX6wH6ix9TSxb90ryqvGGzyR18CgYEAitjywLndXimkKQrBjCp8
og0rVWEoEoa3qiHgmQoPFccP1x5kx7pWl5c0ywzdVfcCK4VTLFe82hb/3DGnCz24
JvZvl5h1cn7Pla90LZYCT4XnOWnKI02ifIleKAfTC7AhIr1J3d0GWd6ZE7MHf+Tk
Y62YxcXu+EMwEUaW2g55nfkCgYA8sz95PiGert5yjt4ICJeHFMnC9Ed1o4bVu48g
R/Ja63h7gqEwJDIulyeIOWO7jB5qyk9daRPqmmcr56qc/TUVl9W7Hnxc/otM74eS
tw/aoXSFnmHAPvnChQb7EyBPCi6ypT+4V6KcV2sdb0NDJRIjkv7HnkZ1/mdBBCDq
C0wmaQKBgQDIFcd03b+jylIS9tAaiwq6YVTPcCM40Y2OT6Bvokfc/tV6x+ReeXJU
OBuN4uSVMidCnL7p3YcZ6zyQDChaetKsNhWWXNrOmRIBeX0kwUdil0Tefrbt21fM
lfYzfZEib5/KfdXO84VANfkHDtM83ksQZz+LPgiWvZ8CzqPqUHHpqw==
-----END RSA PRIVATE KEY-----
16 changes: 16 additions & 0 deletions dockers/docker-gnmi-test/generate_cert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Create Root key and cert
openssl genrsa -out dsmsroot.key 2048
openssl req -new -sha256 -out dsmsroot.csr -key dsmsroot.key -config dsmsroot.conf -batch
openssl x509 -req -days 3650 -in dsmsroot.csr -signkey dsmsroot.key -out dsmsroot.cer

# Create server key and cert
openssl genrsa -out gnmiserver.key 2048
openssl req -new -sha256 -out gnmiserver.csr -key gnmiserver.key -config server.conf -batch
openssl x509 -req -days 3650 -CA dsmsroot.cer -CAkey dsmsroot.key -CAcreateserial -in gnmiserver.csr -out gnmiserver.cer -extensions req_ext -extfile server.conf

# Create client key and cert
openssl genrsa -out gnmiclient.key 2048
openssl req -new -sha256 -out gnmiclient.csr -key gnmiclient.key -config client.conf -batch
openssl x509 -req -days 3650 -CA dsmsroot.cer -CAkey dsmsroot.key -CAcreateserial -in gnmiclient.csr -out gnmiclient.cer -extensions req_ext -extfile client.conf
20 changes: 20 additions & 0 deletions dockers/docker-gnmi-test/gnmiclient.cer
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIDWTCCAkGgAwIBAgIUeiWDlqtd3pSMeVjdRZl+mfuO688wDQYJKoZIhvcNAQEL
BQAwVTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJDQTESMBAG
A1UECgwJTWljcm9zb2Z0MRgwFgYDVQQDDA90ZXN0LmdubWkuc29uaWMwHhcNMjIx
MDI3MDYxMTE4WhcNMzIxMDI0MDYxMTE4WjBVMQswCQYDVQQGEwJVUzELMAkGA1UE
CAwCQ0ExCzAJBgNVBAcMAkNBMRIwEAYDVQQKDAlNaWNyb3NvZnQxGDAWBgNVBAMM
D3Rlc3QuZ25taS5zb25pYzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AOuZMVrIppPp7lZsDb9ogNW9FAWkXLWbJchfOrKbJVw1YVVuI5SjkD1G9xdFAZOj
hnYHnewaLc3gTTEROKwRCK5aF/I6vy6cLdrqnfj/c9XdzCFbU3sDMBJV+GTY86bG
gMlCOuf42KSahN/5z/y068IvJq1flviHQ+fahgLfuz7b9K4JudrQifi5kAq215PA
cmYghKE1owpdE5nJ0lwz3yGZ3kOiaWMpvpYONz8BvzvZekV5Ksd41n5ISHjUkIPV
vfugZF3aCe4P2/YVq6NJNttAgtCwa9XK3oF3ZpIuBIxsh0Hzr/VWQwIgTHb6rzX1
Fhk9kcK+hBN+wSx7t2Rhk28CAwEAAaMhMB8wHQYDVR0RBBYwFIIMaG9zdG5hbWUu
Y29thwR/AAABMA0GCSqGSIb3DQEBCwUAA4IBAQDEHfhWDpGzInYa8GDJZsDydjWs
G19q/S6OzwnoeQnJpSx5UDPIQoZWsBnXV0yZv/ZxUBhvdDV7vrtZO3PFPfYJ/RFm
05EXOasB8lUJCNQB5MTfUO3SYmmPqr8Mcg38Z0BgrKGzopUMqW/qL/sdN3uQYWIV
lDVxxS0CuY2xyOe/ICwxaakMZHPDSl4ZuGCdr86y3D9jdNlcCqxKJ2El1ie9AjeI
bCAzg+yc9iPwpFTpl8Q4lGJSKtlTZi5ZgOhKPuv9do+OsF9YdOcNkgCdSngzTsuO
1atefuPfCWTAap/aFehClc9imhzNVXVNmqSkjkuxk4s1x81Rum8PJ0kDO2tn
-----END CERTIFICATE-----
27 changes: 27 additions & 0 deletions dockers/docker-gnmi-test/gnmiclient.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA65kxWsimk+nuVmwNv2iA1b0UBaRctZslyF86spslXDVhVW4j
lKOQPUb3F0UBk6OGdged7BotzeBNMRE4rBEIrloX8jq/Lpwt2uqd+P9z1d3MIVtT
ewMwElX4ZNjzpsaAyUI65/jYpJqE3/nP/LTrwi8mrV+W+IdD59qGAt+7Ptv0rgm5
2tCJ+LmQCrbXk8ByZiCEoTWjCl0TmcnSXDPfIZneQ6JpYym+lg43PwG/O9l6RXkq
x3jWfkhIeNSQg9W9+6BkXdoJ7g/b9hWro0k220CC0LBr1cregXdmki4EjGyHQfOv
9VZDAiBMdvqvNfUWGT2Rwr6EE37BLHu3ZGGTbwIDAQABAoIBABCa1HKsj6j/JNAs
f2+NIv9texrGsc4O6EPOCmoKK0Drdje6MoHIYWMg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IdmIJBXL/Ley9zOMtU2q7Fx+AAEv9n8oCb0Mv9ZN8+BKYZvHF8NYTKhZp
CigpXQhfRFlq65exj9NYdMRoGsy3NMVmYmM+mUV5em5hCe3nR4Sulg==
-----END RSA PRIVATE KEY-----
20 changes: 20 additions & 0 deletions dockers/docker-gnmi-test/gnmiserver.cer
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIDWTCCAkGgAwIBAgIUeiWDlqtd3pSMeVjdRZl+mfuO684wDQYJKoZIhvcNAQEL
BQAwVTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJDQTESMBAG
A1UECgwJTWljcm9zb2Z0MRgwFgYDVQQDDA90ZXN0LmdubWkuc29uaWMwHhcNMjIx
MDI3MDYxMTE3WhcNMzIxMDI0MDYxMTE3WjBVMQswCQYDVQQGEwJVUzELMAkGA1UE
CAwCQ0ExCzAJBgNVBAcMAkNBMRIwEAYDVQQKDAlNaWNyb3NvZnQxGDAWBgNVBAMM
D3Rlc3QuZ25taS5zb25pYzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
ANzgWgey9om2dJkLZmUy0x96aTw89RK7YclDfmMIiw5p/+OjfN4ApjDJbqpaELHW
OkrzA0JN5FPa7cBtjmSQr+AzCrJuzIffMpAsWuUZaIDVV300KGcPKoVcb3fdAw19
zx/uJv4kvMwWt5mFEfAvLW9SleCXdOxN60nLvDp611l03Z7lyUOMZHeeq2/OG4o2
UdMzZw4NIMBMBeGRebxV5T2dFcHK3VZFboLXel0PhZHvWsWQuv77UtzlWsBbfxDP
IPDRKhkPK9sHzXszRzXK08lWDRzpbSLxQ/9VnpsSLc3vHGMerw2BnmXy+3LUqT7R
FS2Nq5/zJfucl3EoACybhucCAwEAAaMhMB8wHQYDVR0RBBYwFIIMaG9zdG5hbWUu
Y29thwR/AAABMA0GCSqGSIb3DQEBCwUAA4IBAQB7mdYb1QlBiJf9jdifWcQYBEXQ
9GuxW3MfOEUZQNJR0jyk6/TaiKwywILvRFD6oGCag+KWsUX+aIftLll/FqXcNWCT
GBKhMU6lu013q18ikmOEtvKRvGuAMiDnHyuu1DzEEbvIXW7aW0UPXSmfzupw0sEZ
V/XTIlNp222NZL2FbxfhIZjrXaqwyzZ/INbPOkBurL7JMoZ1PmMiu4iLgzs0Z4OJ
Po/I/39lL24Kf1TYMQCgL1Zn7OmrT54wEGzjNSvX29IeBUcdBaZBv3bX2HDDelM5
jblQtBQoe+n4uzJpM7cPUk+5gLDTyoKUO3x47jLdEJwlw6zNEEpXBAnKB/V+
-----END CERTIFICATE-----
27 changes: 27 additions & 0 deletions dockers/docker-gnmi-test/gnmiserver.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA3OBaB7L2ibZ0mQtmZTLTH3ppPDz1ErthyUN+YwiLDmn/46N8
3gCmMMluqloQsdY6SvMDQk3kU9rtwG2OZJCv4DMKsm7Mh98ykCxa5RlogNVXfTQo
Zw8qhVxvd90DDX3PH+4m/iS8zBa3mYUR8C8tb1KV4Jd07E3rScu8OnrXWXTdnuXJ
Q4xkd56rb84bijZR0zNnDg0gwEwF4ZF5vFXlPZ0VwcrdVkVugtd6XQ+Fke9axZC6
/vtS3OVawFt/EM8g8NEqGQ8r2wfNezNHNcrTyVYNHOltIvFD/1WemxItze8cYx6v
DYGeZfL7ctSpPtEVLY2rn/Ml+5yXcSgALJuG5wIDAQABAoIBAQCnfBvooKTfkhHi
B0nyzNJYmTr5KYPwW1RwCBTrRYwkNu6Jj+vcb4OVlPishjUIlNiJArLi8SuFBoqo
EqsZyLkEec/Ps8K1+OJffrLB7D1ZC+0WjJliZJaqn4gKzPVGorKPlMfOiM78tvEr
oUMT7MI4Gth5gH9xvDgBMlMdyQ5IzrNVoxa0V4+2oAmuV5DlyVLAbSUPLs3h/Wf6
/M0BaLmzfl2GmRJLAud5PTsvsmr3+k7WjfV9OW4M+dAMBl7Po5CH4whcDbiS4C36
ilfBUzlAydEfx5FrRYDK4Jn+SgMExXBe3dQp/8Gj1OJj9/8bI0wxRxLI1s93u2s4
XNBufKmhAoGBAPgwmsOxXAS+K9PH24rfKHK6DdZ8kXRgRGQuF+8zaDmwIokl7otS
/B163NnMqz/JMnORD9RxnXz02XExGWKZCm8Wd3wy5AZRelqyKtilEh+8ZDaf8AWw
fQZ1WB52OGytRdwWyA4fP7AQkyNJlkvIO5jdtznqdH3jTETRLEaYLAf3AoGBAOPT
tkxj/qmTAozTEu93z9SCGOPEanpAuR5zeX/+daLgY/nB4/iFmddRV4qOuYPSGLu+
ROLje7pVe+y+eAmCs++wNB/H+xSjN9u0rZHO08FwZc/yrPDDprVj3M4d0FC+yB93
cxsFM9ATfssBUByCGweGsEwtF6BmrtYPOmXwlByRAoGAVtgLD3a8EBzLESvZslor
uRlJRkgITYRx6ewHC/gc/DKZowvW0IGVHmujY8KuGX+5W57ivx+ST+sNOwJHM60B
baWa4aadC2jvO1UkkPIRyXEOT97fCd6boOrmjqInVD+9Ninyjp54lo72LV7ObG4A
DJloR6e2Y2ZphZr7tygAIDkCgYBzMAR4hQop1HEyoDlvp8UFba2F4zXuj7DI65tf
klkJu6fwjA5mBa5thevb2yOCuYPV0HJlwJw67qOUZAyuyk2Nfyorc2HH4moIhEZJ
dSftIpXnWIwFwvYTueTWtY4wdPUbq7ofzDaRGno9y3EkqMdfu8KBET9j0ubMxbBC
ACvycQKBgQD2VpLmtl151P6xZYq3cexX5AwwD5+ZvPdXaKtzQUMAnPr4IuzTViSV
uZz28U4zFMROJKx5zAoLbRlwcPJPdpMRGfqHWJGL9Yl+4f5iUQCt6EFZEXrvNMtW
f93o5/p3N2imNyid9DkO1EKZdH6HV1c802jtQ+7eG4Kb1I9TRG+E4w==
-----END RSA PRIVATE KEY-----

0 comments on commit 20326a2

Please sign in to comment.