public inbox for ipfire-scm@lists.ipfire.org
 help / color / mirror / Atom feed
* [git.ipfire.org] IPFire 2.x development tree branch, next, updated. f1180ec2dc9f96fee9d694262b4036029a36e4b2
@ 2022-02-21 21:36 Peter Müller
  0 siblings, 0 replies; only message in thread
From: Peter Müller @ 2022-02-21 21:36 UTC (permalink / raw)
  To: ipfire-scm

[-- Attachment #1: Type: text/plain, Size: 3149 bytes --]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".

The branch, next has been updated
       via  f1180ec2dc9f96fee9d694262b4036029a36e4b2 (commit)
       via  d5538121d7b61f03e53a2fe48ed81728019df411 (commit)
      from  efb999548a2f0540067314f43434712fd446e42e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f1180ec2dc9f96fee9d694262b4036029a36e4b2
Author: Peter Müller <peter.mueller(a)ipfire.org>
Date:   Mon Feb 21 21:36:18 2022 +0000

    Core Update 165: Ship oci-setup initscript
    
    Signed-off-by: Peter Müller <peter.mueller(a)ipfire.org>

commit d5538121d7b61f03e53a2fe48ed81728019df411
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Mon Feb 21 17:24:56 2022 +0000

    oci: user-data: Try to decode base64 content
    
    Terraform only supports sending any shell scripts encoded in base64
    which is however not required by Oracle. Therefore we have to test if
    the script is encoded or not.
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
    Reviewed-by: Peter Müller <peter.mueller(a)ipfire.org>

-----------------------------------------------------------------------

Summary of changes:
 config/rootfiles/core/165/filelists/files |  1 +
 src/initscripts/helper/oci-setup          | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

Difference in files:
diff --git a/config/rootfiles/core/165/filelists/files b/config/rootfiles/core/165/filelists/files
index 7ad9a521e..a5ae67f43 100644
--- a/config/rootfiles/core/165/filelists/files
+++ b/config/rootfiles/core/165/filelists/files
@@ -1,4 +1,5 @@
 etc/rc.d/init.d/firewall
+etc/rc.d/helper/oci-setup
 opt/pakfire/etc/pakfire.conf
 opt/pakfire/lib/functions.pl
 srv/web/ipfire/cgi-bin/backup.cgi
diff --git a/src/initscripts/helper/oci-setup b/src/initscripts/helper/oci-setup
index 4dbc05ae3..782fde5a2 100644
--- a/src/initscripts/helper/oci-setup
+++ b/src/initscripts/helper/oci-setup
@@ -34,6 +34,24 @@ get() {
 	wget -qO - "http://169.254.169.254/opc/v1/${file}"
 }
 
+try_base64_decode() {
+	local input="${1}"
+
+	local tmp="$(mktemp)"
+
+	# Try to decode this and return output if successful
+	if base64 -d <<< "${input}" > "${tmp}" 2>/dev/null; then
+		echo "$(<${tmp})"
+
+	# Otherwise just return the input
+	else
+		echo "${input}"
+	fi
+
+	# Cleanup
+	unlink "${tmp}"
+}
+
 to_address() {
 	local n="${1}"
 
@@ -134,6 +152,9 @@ import_oci_configuration() {
 		# Download a startup script
 		local script="$(get instance/metadata/user_data)"
 
+		# Try to decode this
+		script="$(try_base64_decode "${script}")"
+
 		# Execute the script
 		if [ "${script:0:2}" = "#!" ]; then
 			echo "${script}" > /tmp/user-data.script


hooks/post-receive
--
IPFire 2.x development tree

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-21 21:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21 21:36 [git.ipfire.org] IPFire 2.x development tree branch, next, updated. f1180ec2dc9f96fee9d694262b4036029a36e4b2 Peter Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox