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
![](https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*4oxP4LXk8l8c3mpRvO7ejg.png)