Skip to content

Commit 3a72fc6

Browse files
authored
Single instance DB projects - verify DB installers (#522)
For the single instance database projects, verify the SHA-256 digest of the database installer file at the beginning of the install.sh script, before installing OS updates. For all single instance database projects: - Add a db_installer.sha256 file containing the SHA-256 digest value for the database installer. (2 digest files for the 12.1.0.2 project, since it uses separate sets of installer files depending on the Oracle edition.) - Add *.sha256 to .gitattributes, to preserve LF line endings on Windows hosts. Otherwise, sha256sum doesn't read the file correctly. - Verify the SHA-256 digest at the start of the install.sh script. If verification fails, exit with an error message explaining what to do. For the XE/Free database projects: - Move the download of the installer rpm to the beginning of the install.sh script. - Modify the install.sh script so it never deletes an installer rpm that the user has previously downloaded. For the 23.3.0-Free project (unrelated, but necessary): - Modify the install.sh script to use oracle-database-preinstall-23ai instead of oracle-database-preinstall-23c, which has been obsoleted in the yum repository. Tested with both VirtualBox and libvirt providers. Fixes #512 Signed-off-by: Paul Neumann <[email protected]>
1 parent c8de3d9 commit 3a72fc6

31 files changed

+259
-51
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.sh text eol=lf
2+
*.sha256 text eol=lf
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
b5039fad2e4f92c68778dcabbd0b4622a6cb025f25f7d6222f9e9de53ebab531 */vagrant/oracle-xe-11.2.0-1.0.x86_64.rpm.zip

OracleDatabase/11.2.0.2/scripts/install.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@ set -e
1616

1717
echo 'INSTALLER: Started up'
1818

19+
# verify that database installer is present and valid
20+
echo 'INSTALLER: Verifying database installer file'
21+
22+
sha256sum --check /vagrant/db_installer.sha256 || {
23+
cat << EOF
24+
25+
INSTALLER: Database installer file missing or invalid.
26+
Destroy this VM (vagrant destroy), then
27+
make sure that the database installer file
28+
is in the same directory as the Vagrantfile,
29+
and that its SHA-256 digest matches the
30+
value in the db_installer.sha256 file,
31+
before running vagrant up again.
32+
33+
EOF
34+
exit 1
35+
}
36+
1937
# get up to date
2038
yum upgrade -y
2139

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.sh text eol=lf
2+
*.sha256 text eol=lf
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
31fdc2af41687b4e547a3a18f796424d8c1af36406d2160f65b0af6a9cd47355 */vagrant/linuxamd64_12102_database_1of2.zip
2+
03da14f5e875304b28f0f3bb02af0ec33227885b99c9865df70749d1e220accd */vagrant/linuxamd64_12102_database_2of2.zip
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
73873369753230f5a0921f95aceadb591388cb06ed72a7f3aea7bcbcea2403bc */vagrant/linuxamd64_12102_database_se2_1of2.zip
2+
2492e1be1e3e3531da83d0843c09c08e435ac8cefd9a00c0df56be4f15ceebf3 */vagrant/linuxamd64_12102_database_se2_2of2.zip

OracleDatabase/12.1.0.2/scripts/install.sh

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,39 @@ set -e
1616

1717
echo 'INSTALLER: Started up'
1818

19+
# verify that database installers are present and valid
20+
echo 'INSTALLER: Verifying database installer files'
21+
22+
case "$ORACLE_EDITION" in
23+
'EE')
24+
digest_file='db_installer-EE.sha256'
25+
installer_zips='linuxamd64_12102_database_?of2.zip'
26+
;;
27+
'SE2')
28+
digest_file='db_installer-SE2.sha256'
29+
installer_zips='linuxamd64_12102_database_se2_?of2.zip'
30+
;;
31+
*)
32+
echo "INSTALLER: Invalid ORACLE_EDITION ${ORACLE_EDITION}. Must be EE or SE2. Exiting."
33+
exit 1
34+
;;
35+
esac
36+
37+
sha256sum --check /vagrant/"${digest_file}" || {
38+
cat << EOF
39+
40+
INSTALLER: Database installer files missing or invalid.
41+
Destroy this VM (vagrant destroy), then
42+
make sure that the database installer files
43+
are in the same directory as the Vagrantfile,
44+
and that their SHA-256 digests match the
45+
values in the ${digest_file} file,
46+
before running vagrant up again.
47+
48+
EOF
49+
exit 1
50+
}
51+
1952
# get up to date
2053
yum upgrade -y
2154

@@ -55,18 +88,7 @@ echo 'INSTALLER: Environment variables set'
5588

5689
# Install Oracle
5790

58-
case "$ORACLE_EDITION" in
59-
"EE")
60-
unzip '/vagrant/linuxamd64_12102_database_?of2.zip' -d /tmp
61-
;;
62-
"SE2")
63-
unzip '/vagrant/linuxamd64_12102_database_se2_?of2.zip' -d /tmp
64-
;;
65-
*)
66-
echo "INSTALLER: Invalid ORACLE_EDITION $ORACLE_EDITION. Must be EE or SE2. Exiting."
67-
exit 1
68-
;;
69-
esac
91+
unzip /vagrant/"${installer_zips}" -d /tmp
7092

7193
cp /vagrant/ora-response/db_install.rsp.tmpl /tmp/db_install.rsp
7294
sed -i -e "s|###ORACLE_BASE###|$ORACLE_BASE|g" /tmp/db_install.rsp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.sh text eol=lf
2+
*.sha256 text eol=lf
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
96ed97d21f15c1ac0cce3749da6c3dac7059bb60672d76b008103fc754d22dde */vagrant/linuxx64_12201_database.zip

OracleDatabase/12.2.0.1/scripts/install.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@ set -e
1616

1717
echo 'INSTALLER: Started up'
1818

19+
# verify that database installer is present and valid
20+
echo 'INSTALLER: Verifying database installer file'
21+
22+
sha256sum --check /vagrant/db_installer.sha256 || {
23+
cat << EOF
24+
25+
INSTALLER: Database installer file missing or invalid.
26+
Destroy this VM (vagrant destroy), then
27+
make sure that the database installer file
28+
is in the same directory as the Vagrantfile,
29+
and that its SHA-256 digest matches the
30+
value in the db_installer.sha256 file,
31+
before running vagrant up again.
32+
33+
EOF
34+
exit 1
35+
}
36+
1937
# get up to date
2038
yum upgrade -y
2139

0 commit comments

Comments
 (0)