1
1
#! /bin/bash
2
2
#
3
- # Version: @(#).secure.storage.sh 1.0.0
3
+ # Version: @(#).secure.storage.sh 1.0.1
4
4
# License
5
5
# Copyright (c) 2023 Oracle and/or its affiliates.
6
6
# Licensed under the Universal Permissive License (UPL), Version 1.0.
11
11
#
12
12
# Update history:
13
13
#
14
+ # V 1.0.1 12.07.2023 add Changing the encryption key for a volume backup
14
15
# V 1.0.0 28.06.2023 initial version
15
16
#
16
17
18
+
17
19
# ---------------------------------------------------------------------------------------------------------------------------------------------
18
20
# prepare environement (load functions)
19
21
# ---------------------------------------------------------------------------------------------------------------------------------------------
@@ -36,14 +38,14 @@ echo "=====================================================================" >>
36
38
echo " ${PF1} $( date " +%d.%m.%Y %H:%M:%S" ) " >> " ${LOG_FILE} "
37
39
echo " ${PF1} --------------------------------------------------------------" >> " ${LOG_FILE} "
38
40
39
- color_print " ${MYcolor} " " ${PF1} create BLOCK volume"
40
- if [ 1 -eq 1 ] ; then # create BLOCK volume
41
41
42
+ if [ 1 -eq 1 ] ; then # create BLOCK volume
43
+ color_print " ${MYcolor} " " ${PF1} create BLOCK volume"
42
44
if [ ${CREATE_BLOCK_VOLUME} -eq 1 ] ; then # create block volume
43
45
oci --profile " ${REGION_PROFILE} " bv volume create --availability-domain " ${FRANKFURT_AVAILABILITY_DOMAIN} " \
44
46
--compartment-id " ${COMPARTMENT_OCID} " \
45
- --display-name " ${FRANKFURT_BLOCK_VOLUME_NAME} " \
46
- --size-in-gbs 50 \
47
+ --display-name " ${FRANKFURT_BLOCK_VOLUME_NAME} " \
48
+ --size-in-gbs 50 \
47
49
--wait-for-state " AVAILABLE"
48
50
fi
49
51
61
63
done
62
64
fi
63
65
64
- color_print " ${MYcolor} " " ${PF1} get VAULT details"
65
66
if [ 1 -eq 1 ] ; then # get VAULT details
67
+ color_print " ${MYcolor} " " ${PF1} get VAULT details"
66
68
tempfile myTEMPFILE
67
69
oci --profile " ${REGION_PROFILE} " kms management vault get --vault-id " ${VAULT_OCID} " > " ${myTEMPFILE} "
68
70
myNAME=$( cat " ${myTEMPFILE} " | grep " display-name" | awk ' {print $2}' | sed ' s/\"//g' | sed ' s/,//g' )
@@ -76,9 +78,8 @@ if [ 1 -eq 1 ] ; then # get VAULT details
76
78
echo " ${PF1} Master Encryption Key name: ${myNAME} " >> " ${LOG_FILE} "
77
79
fi
78
80
79
- color_print " ${MYcolor} " " ${PF1} create BLOCK volume backup"
80
81
if [ 1 -eq 1 ] ; then # create BLOCK volume backup
81
-
82
+ color_print " ${MYcolor} " " ${PF1} create BLOCK volume backup "
82
83
if [ ${CREATE_BLOCK_VOLUME_BACKUP} -eq 1 ] ; then # create block volume backup
83
84
oci --profile " ${REGION_PROFILE} " bv backup create --volume-id " ${BLOCK_VOLUME_OCID} " --display-name " ${FRANKFURT_BLOCK_VOLUME_NAME} Backup" --wait-for-state " AVAILABLE"
84
85
fi
@@ -101,8 +102,7 @@ echo "${PF1} --------------------------------------------------------------" >>
101
102
echo " " >> " ${LOG_FILE} "
102
103
fi
103
104
104
-
105
- MYOUTPUT=" Secure Storage with Customer-managed Key" && MYCOUNT=$(( $MYCOUNT + 1 ))
105
+ MYOUTPUT=" Secure Storage with Customer managed Key" && MYCOUNT=$(( $MYCOUNT + 1 ))
106
106
if [ 1 -eq 1 ] ; then
107
107
color_print " ${IGreen} " " ($MYCOUNT ) $( date " +%d.%m.%Y %H:%M:%S" ) : $MYOUTPUT "
108
108
@@ -116,60 +116,63 @@ echo "=====================================================================" >>
116
116
echo " ${PF1} $( date " +%d.%m.%Y %H:%M:%S" ) " >> " ${LOG_FILE} "
117
117
echo " ${PF1} --------------------------------------------------------------" >> " ${LOG_FILE} "
118
118
119
- color_print " ${MYcolor} " " ${PF1} BLOCK volume change from Oracle- managed Key to Customer- managed Key"
120
- if [ 1 -eq 1 ] ; then # BLOCK volume change from Oracle- managed Key to Customer- managed Key
119
+ if [ 1 -eq 1 ] ; then # BLOCK volume change from Oracle managed Key to Customer managed Key
120
+ color_print " ${MYcolor} " " ${PF1} BLOCK volume change from Oracle managed Key to Customer managed Key"
121
121
oci --profile " ${REGION_PROFILE} " bv volume-kms-key update --volume-id " ${BLOCK_VOLUME_OCID} " --kms-key-id " ${MasterEncryptionKey_OCID} "
122
- echo " ${PF1} BLOCK volume change from Oracle- managed Key to Customer- managed Key" >> " ${LOG_FILE} "
122
+ echo " ${PF1} BLOCK volume change from Oracle managed Key to Customer managed Key ${MasterEncryptionKey_OCID} " >> " ${LOG_FILE} "
123
123
fi
124
124
125
- color_print " ${MYcolor} " " ${PF1} BLOCK volume backup change from Oracle-managed Key to Customer-managed Key (coming soon)"
126
- if [ 1 -eq 0 ] ; then # BLOCK volume backup change from Oracle-managed Key to Customer-managed Key (coming soon)
125
+ if [ 1 -eq 1 ] ; then # BLOCK volume backup change from Oracle managed Key to Customer managed Key
127
126
: ' ---------------------------------------------------------------------------------------------------------------------------------------
128
- Backup Data in Storage Services https://docs.oracle.com/en/solutions/oci-best-practices/back-your-data1.html
127
+ Backup Data in Storage Services https://docs.oracle.com/en/solutions/oci-best-practices/back-your-data1.html
128
+ Changing the encryption key for a volume backup https://docs.oracle.com/en-us/iaas/releasenotes/changes/1d439da6-eeec-4fa2-acef-89be177ce266/
129
+ Release Date: July 12, 2023; bv backup-kms-key update is availaible since oci cli version 3.29.3
129
130
-------------------------------------------------------------------------------------------------------------------------------------------'
130
- oci --profile " ${REGION_PROFILE} " bv backup-kms-key update --volume-id " ${BLOCK_VOLUME_BACKUP_OCID} " --kms-key-id " ${MasterEncryptionKey_OCID} "
131
-
131
+ color_print " ${MYcolor} " " ${PF1} BLOCK volume backup change from Oracle managed Key to Customer managed Key"
132
132
oci --profile " ${REGION_PROFILE} " bv backup update --volume-backup-id " ${BLOCK_VOLUME_BACKUP_OCID} " --kms-key-id " ${MasterEncryptionKey_OCID} "
133
- echo " ${PF1} BLOCK volume backup change from Oracle- managed Key to Customer- managed Key" >> " ${LOG_FILE} "
133
+ echo " ${PF1} BLOCK volume backup change from Oracle managed Key to Customer managed Key ${MasterEncryptionKey_OCID} " >> " ${LOG_FILE} "
134
134
fi
135
135
136
- color_print " ${MYcolor} " " ${PF1} Rotation of Customer-managed Key"
137
- if [ 1 -eq 1 ] ; then # Rotation of Customer-managed Key
138
-
136
+ if [ 1 -eq 1 ] ; then # Rotation of Customer managed Key
139
137
: ' ---------------------------------------------------------------------------------------------------------------------------------------
140
138
Periodically rotating keys limits the amount of data
141
139
encrypted or signed by one key version. If a key is
142
140
ever compromised, key rotation thus reduces the risk. https://docs.oracle.com/en-us/iaas/Content/KeyManagement/Concepts/keyoverview.htm#concepts
143
141
kms management key-version create https://docs.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/kms/management/key-version/create.html
144
142
-------------------------------------------------------------------------------------------------------------------------------------------'
145
-
143
+ color_print " ${MYcolor} " " ${PF1} Rotation of Customer managed Key "
146
144
oci --profile " ${REGION_PROFILE} " kms management key-version create --key-id " ${MasterEncryptionKey_OCID} " --endpoint " ${ManagementEndpoint} " --wait-for-state " ENABLED"
147
- echo " ${PF1} Rotation of Customer- managed Key" >> " ${LOG_FILE} "
145
+ echo " ${PF1} Rotation of Customer managed Key" >> " ${LOG_FILE} "
148
146
fi
149
147
150
148
echo " ${PF1} --------------------------------------------------------------" >> " ${LOG_FILE} "
151
149
echo " " >> " ${LOG_FILE} "
152
150
fi
153
151
154
- MYOUTPUT=" Secure Storage with Oracle- managed Key" && MYCOUNT=$(( $MYCOUNT + 1 ))
152
+ MYOUTPUT=" Secure Storage with Oracle managed Key" && MYCOUNT=$(( $MYCOUNT + 1 ))
155
153
if [ 1 -eq 1 ] ; then
156
154
color_print " ${IGreen} " " ($MYCOUNT ) $( date " +%d.%m.%Y %H:%M:%S" ) : $MYOUTPUT "
157
155
158
- echo " Secure Storage with Oracle- managed Key" >> " ${LOG_FILE} "
156
+ echo " Secure Storage with Oracle managed Key" >> " ${LOG_FILE} "
159
157
echo " =====================================================================" >> " ${LOG_FILE} "
160
158
echo " ${PF1} $( date " +%d.%m.%Y %H:%M:%S" ) " >> " ${LOG_FILE} "
161
159
echo " ${PF1} --------------------------------------------------------------" >> " ${LOG_FILE} "
162
160
163
- color_print " ${MYcolor} " " ${PF1} BLOCK volume change from Customer-managed Key to Oracle-managed Key"
164
161
if [ 1 -eq 1 ] ; then # BLOCK volume change from Customer managed Key to Oracle managed Key
165
- oci --profile " ${REGION_PROFILE} " bv volume-kms-key update --volume-id " ${BLOCK_VOLUME_OCID} " --kms-key-id " ${MasterEncryptionKey_OCID} "
166
- echo " ${PF1} BLOCK volume change from Customer-managed Key to Oracle-managed Key" >> " ${LOG_FILE} "
162
+ color_print " ${MYcolor} " " ${PF1} BLOCK volume change from Customer managed Key to Oracle managed Key"
163
+ oci --profile " ${REGION_PROFILE} " bv volume-kms-key update --volume-id " ${BLOCK_VOLUME_OCID} " --kms-key-id " "
164
+ echo " ${PF1} BLOCK volume change from Customer managed Key to Oracle managed Key" >> " ${LOG_FILE} "
167
165
fi
168
166
169
- color_print " ${MYcolor} " " ${PF1} BLOCK volume backup change from Customer-managed Key to Oracle-managed Key (coming soon)"
170
- if [ 1 -eq 0 ] ; then # BLOCK volume backup change from Customer-managed Key to Oracle-managed Key (coming soon)
171
- # oci --profile "${REGION_PROFILE}" bv backup-kms-key update --volume-id "${BLOCK_VOLUME_BACKUP_OCID}" --kms-key-id "${MasterEncryptionKey_OCID}"
172
- echo " ${PF1} BLOCK volume backup change from Customer-managed Key to Oracle-managed Key" >> " ${LOG_FILE} "
167
+ if [ 1 -eq 1 ] ; then # BLOCK volume backup change from Customer managed Key to Oracle managed Key
168
+ : ' ---------------------------------------------------------------------------------------------------------------------------------------
169
+ Backup Data in Storage Services https://docs.oracle.com/en/solutions/oci-best-practices/back-your-data1.html
170
+ Changing the encryption key for a volume backup https://docs.oracle.com/en-us/iaas/releasenotes/changes/1d439da6-eeec-4fa2-acef-89be177ce266/
171
+ Release Date: July 12, 2023; bv backup-kms-key update is availaible since oci cli version 3.29.3
172
+ -------------------------------------------------------------------------------------------------------------------------------------------'
173
+ color_print " ${MYcolor} " " ${PF1} BLOCK volume backup change from Customer managed Key to Oracle managed Key"
174
+ oci --profile " ${REGION_PROFILE} " bv backup update --volume-backup-id " ${BLOCK_VOLUME_BACKUP_OCID} " --kms-key-id " "
175
+ echo " ${PF1} BLOCK volume backup change from Customer managed Key to Oracle managed Key" >> " ${LOG_FILE} "
173
176
fi
174
177
175
178
echo " ${PF1} --------------------------------------------------------------" >> " ${LOG_FILE} "
@@ -181,4 +184,4 @@ MYOUTPUT="End of Programm" && MYCOUNT=$(($MYCOUNT + 1))
181
184
color_print " ${IGreen} " " ($MYCOUNT ) $( date " +%d.%m.%Y %H:%M:%S" ) : $MYOUTPUT "
182
185
# ---------------------------------------------------------------------------------------------------------------------------------------------
183
186
# end of file
184
- # ---------------------------------------------------------------------------------------------------------------------------------------------
187
+ # ---------------------------------------------------------------------------------------------------------------------------------------------
0 commit comments