avatarTeri Radichel

Summary

Teri Radichel is experiencing an intermittent issue where parameter values passed between Bash functions randomly change when running scripts on an AWS Linux EC2 instance, possibly related to having multiple terminal windows open.

Abstract

Teri Radichel has encountered a peculiar problem when executing command-line scripts on AWS. While working with scripts from the SecurityMetricsAutomation GitHub repository on an Amazon EC2 Linux host, she has observed that the values of parameters passed between Bash functions occasionally and unpredictably change to "1". This issue seems to be triggered by opening a second terminal window, although the exact cause remains elusive as the problem does not occur consistently. Radichel has identified a function in her code that validates values and returns "1" if a value is missing, which could be contributing to the observed behavior. However, she is certain that her code is not at fault, suggesting a potential bug in the Amazon EC2 Linux environment. The inconsistency of the error makes it challenging to diagnose, and a workaround has not been reliable. Radichel plans to provide updates as she continues to investigate this random error that affects the deployment of CloudFormation templates for network stacks.

Opinions

  • Radichel suspects that the issue is external to her code, possibly related to the EC2 Linux environment or the terminal windows on the local host (MacOS).
  • The problem is believed to be random and related to background processes that execute intermittently.
  • Initially, a workaround was considered by avoiding the use of multiple terminal windows, but this was not a consistent solution as the error occurred even with a single window open.
  • The author has a strong background in cybersecurity, holding various certifications and awards, which lends credibility to her investigation and troubleshooting approach.
  • Radichel is open to community engagement and updates, inviting followers to stay informed about the resolution of the issue.

Strange Issue on AWS Linux EC2 Instance

Randomly changes the value of parameters passed between Bash functions

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

⚙️ Check out my series on Automating Cybersecurity Metrics. The Code.

🔒 Related Stories: AWS Security | Application Security | CloudFormation

💻 Free Content on Jobs in Cybersecurity | ✉️ Sign up for the Email List

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I’m having an intermittent problem trying to run command line scripts into AWS. I’m not sure if the issue would be with the terminal windows on the local host (MacOS) or the remote Amazon Linux operating system.

I’m running a terminal window to connect to an Amazon EC2 Linux host to run the scripts in this GitHub repository.

I recently started adding scripts to deploy networks.

I have a common function that calculates and adds a parameter to a comma separated list of values. I pass that list into a function that is supposed to deploy a CloudFormation template for a network stack.

What happens is that if I open a second terminal window, the parameter list will randomly show up as “1” instead of the correct parameter list. Since my code has not changed at all I know this inconsistency is something outside my code. I have somehow pinpointed it to having two terminal windows open. When I close the second window the error goes away.

I have a function that validates that a value exists. If it doesn’t it returns “1” and the program exits. It could be that somehow when it checks for the value, the value is null and that function returns one giving me this very confusing result.

However, there is no way my code is passing an empty value to that function. Additionally, the problem does not occur every time I have a second terminal window open. It is random. That means there’s something randomly executing in the background causing this (I think).

Well, at least I have a work around…but no….actually I don’t. I had to come back and update this post because I had it occur when I did not have two windows open. So it seems like a potential bug on Amazon EC2 Linux. The code is definitely not changing and works consistently most of the time — until I get this random error.

Follow for updates.

Teri Radichel | © 2nd Sight Lab 2022

About Teri Radichel:
~~~~~~~~~~~~~~~~~~~~
⭐️ Author: Cybersecurity Books
⭐️ Presentations: Presentations by Teri Radichel
⭐️ Recognition: SANS Award, AWS Security Hero, IANS Faculty
⭐️ Certifications: SANS ~ GSE 240
⭐️ Education: BA Business, Master of Software Engineering, Master of Infosec
⭐️ Company: Penetration Tests, Assessments, Phone Consulting ~ 2nd Sight Lab
Need Help With Cybersecurity, Cloud, or Application Security?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
🔒 Request a penetration test or security assessment
🔒 Schedule a consulting call
🔒 Cybersecurity Speaker for Presentation
Follow for more stories like this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
❤️ Sign Up my Medium Email List
❤️ Twitter: @teriradichel
❤️ LinkedIn: https://www.linkedin.com/in/teriradichel
❤️ Mastodon: @teriradichel@infosec.exchange
❤️ Facebook: 2nd Sight Lab
❤️ YouTube: @2ndsightlab
AWS
Ecw
Bug
Terminal
Windows
Recommended from ReadMedium