File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22#
33# This is based on: https://docs.openstack.org/glance/latest/user/signature.html
4+ # and it must be executed from the openstackClient POD
45
56openssl genrsa -out private_key.pem 1024
67openssl rsa -pubout -in private_key.pem -out public_key.pem
@@ -16,18 +17,20 @@ function build_image_signature {
1617 base64 -w 0 myimage.signature > myimage.signature.b64
1718}
1819
19-
2020function create_signed_image {
2121 local image_signature=" $1 "
2222 local cert_uuid=" $2 "
23- glance --os-auth-url https://keystone-public-openstack.apps-crc.testing \
24- --os-project-name admin --os-username admin --os-password 12345678 \
23+ local admin_pwd=" $3 "
24+ local keystone=$( cat $HOME /.config/openstack/clouds.yaml | awk ' /auth_url/ {print $2}' )
25+ glance --os-auth-url $keystone \
26+ --os-project-name admin --os-username admin --os-password " $admin_pwd " \
2527 --os-user-domain-name default --os-project-domain-name default \
2628 image-create --name mySignedImage --container-format bare --disk-format qcow2 \
2729 --property img_signature=" $image_signature " --property img_signature_certificate_uuid=" $cert_uuid " \
2830 --property img_signature_hash_method=' SHA-512' --property img_signature_key_type=' RSA-PSS' < myimage
2931}
3032
33+ admin_pwd=${1:- 12345678}
3134build_image_signature
3235image_signature=$( cat myimage.signature.b64)
33- create_signed_image " $image_signature " " $cert_uuid "
36+ create_signed_image " $image_signature " " $cert_uuid " " $admin_pwd "
You can’t perform that action at this time.
0 commit comments