avatarTeri Radichel

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3152

Abstract

ical way to resolve that problem would be a VPN as that is the purpose of a VPN. Users must authenticate before connecting to the networking. The IPs allowed to authenticate can come from anywhere. Once you connect then the reported IP address for that user is the VPN and that VPN has access to internal networks and resources.</p><p id="29e2"><i>User-Specific Security Groups: </i>What if you could restrict access to each user based on their own IP address? Then allow that user to connect to a specific host that acts kind of like a bastion host for that user on the network. Then, in your logs, you wouldn’t see the general VPN address for traffic initiated by that user, you would see the IP address of a specific host assigned to a specific user (presuming you track if and when hosts go up and down or IPs change.)</p><p id="4490">Let’s see how we can make that work.</p><p id="bd41"><b>Deploy a User Specific Security Group</b></p><p id="8ba8">We created a CloudFormation template to deploy a security group that allows SSH access for as single IP CIDR or a single IP (a CIDR consisting of the IP address with /32 at the end).</p><div id="0785" class="link-block"> <a href="https://readmedium.com/automated-creation-of-security-groups-on-aws-b173ca7e5209"> <div> <div> <h2>Automated Creation of Security Groups on AWS</h2> <div><h3>ACM.67 Creating Zero Trust rulesets or security groups on AWS</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*SvFcYj_Vfogmr7o0-T1VWQ.png)"></div> </div> </div> </a> </div><p id="4f97">Here’s the code in the deploy script:</p><figure id="41ef"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*C-n8l-waiFWkfZJBM9eDuA.png"><figcaption></figcaption></figure><p id="35d6">Let’s change this to create a security group for every member of a specified group. Create a function to retrieve a list of users in a group and create a security group for each user.</p><figure id="2b87"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*PxbJ4oTuO8uMjksRJH6YtQ.png"><figcaption></figcaption></figure><p id="0cd1">Call the function from the deploy script, replacing the existing code above:</p><figure id="38c7"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*evFi2VrzbVW7Sqn-kBnuUA.png"><figcaption></figcaption></figure><p id="bf60">Now we have one problem. In order to get the users in a group the network admins (Network profile) need permissions to read group users. We’ll add that to the appropriate IAM Policy.</p><figure id="ae79"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*dnHUkCWVwDM915fPrequpA.png"><figcaption></figcaption></figure><p id="9bf1">Deploy the IAM changes.</p><p id="8d59">To make sure this actually works for multiple users in a group, let’s add one more developer:</p><figure id="e29b"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*puxocWjbBLlJL8OxG

Options

S7a4Q.png"><figcaption></figcaption></figure><p id="f6a4">Deploy the new developer user.</p><p id="88c7">Update the group script we created to add the new user to the group.</p><figure id="10a2"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*HufDGqRzJ2NK4Lx4XEsLeg.png"><figcaption></figcaption></figure><p id="2ef7">Deploy that script and verify the user is in the group. Make sure you completely refresh the groups page even if you click on it from the link on the users page.</p><p id="499f">Next run network deploy.sh script to see if the new security groups deploy correctly.</p><div id="bf49"><pre>By <span class="hljs-keyword">the</span> way, I actually created a small test <span class="hljs-keyword">script</span> <span class="hljs-keyword">to</span> test just this function rather than <span class="hljs-built_in">run</span> all <span class="hljs-keyword">the</span> network stacks <span class="hljs-keyword">over</span> <span class="hljs-keyword">and</span> <span class="hljs-keyword">over</span> again <span class="hljs-keyword">while</span> I worked <span class="hljs-keyword">through</span> <span class="hljs-keyword">some</span> bugs.</pre></div><p id="7d1a">Check to make sure the four new groups got created:</p><figure id="f090"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*vueLAJbXbIkGJ53jU7EAgg.png"><figcaption></figcaption></figure><p id="c702">Also check that the security groups have the correct rules with the IP address for each user in the appropriate group rules.</p><p id="35db">Follow for updates.</p><p id="4a3a">Teri Radichel | <i>© <a href="https://2ndsightlab.com/?source=post_page---------------------------">2nd Sight Lab</a> 2022</i></p><div id="8b5f"><pre><span class="hljs-section">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</pre></div><div id="caae"><pre><span class="hljs-section">Need Help With Cybersecurity, Cloud, or Application Security?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span>
🔒 Request a penetration test or security assessment
🔒 Schedule a consulting call
🔒 Cybersecurity Speaker for Presentation</pre></div><div id="5a42"><pre>Follow <span class="hljs-keyword">for</span> more stories like <span class="hljs-keyword">this</span>:

❤️ Sign Up my Medium Email List ❤️ Twitter: <span class="hljs-meta">@teriradichel</span> ❤️ LinkedIn: https:<span class="hljs-comment">//www.linkedin.com/in/teriradichel</span> ❤️ Mastodon: <span class="hljs-meta">@teriradichel</span><span class="hljs-meta">@infosec</span>.exchange ❤️ Facebook: 2nd Sight Lab ❤️ YouTube: @2ndsightlab</pre></div><figure id="faf5"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*H9Ew1KCl-29nZiPR.jpeg"><figcaption></figcaption></figure></article></body>

User-Specific Security Group for Remote Access

ACM.114 Create a security group with a specific user’s IP address

Part of my series on Automating Cybersecurity Metrics. Network Security. The Code.

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

In the last post I explained how failure to report errors causes systems and software to break.

Now we’re going to move on to deploying a user-specific VM on AWS.

We’ve deployed an EC2 instance

With a security group that limits access to SSH from a specific IP address:

What if you have a number of remote users that are logging in from different IP addresses?

VPN: A typical way to resolve that problem would be a VPN as that is the purpose of a VPN. Users must authenticate before connecting to the networking. The IPs allowed to authenticate can come from anywhere. Once you connect then the reported IP address for that user is the VPN and that VPN has access to internal networks and resources.

User-Specific Security Groups: What if you could restrict access to each user based on their own IP address? Then allow that user to connect to a specific host that acts kind of like a bastion host for that user on the network. Then, in your logs, you wouldn’t see the general VPN address for traffic initiated by that user, you would see the IP address of a specific host assigned to a specific user (presuming you track if and when hosts go up and down or IPs change.)

Let’s see how we can make that work.

Deploy a User Specific Security Group

We created a CloudFormation template to deploy a security group that allows SSH access for as single IP CIDR or a single IP (a CIDR consisting of the IP address with /32 at the end).

Here’s the code in the deploy script:

Let’s change this to create a security group for every member of a specified group. Create a function to retrieve a list of users in a group and create a security group for each user.

Call the function from the deploy script, replacing the existing code above:

Now we have one problem. In order to get the users in a group the network admins (Network profile) need permissions to read group users. We’ll add that to the appropriate IAM Policy.

Deploy the IAM changes.

To make sure this actually works for multiple users in a group, let’s add one more developer:

Deploy the new developer user.

Update the group script we created to add the new user to the group.

Deploy that script and verify the user is in the group. Make sure you completely refresh the groups page even if you click on it from the link on the users page.

Next run network deploy.sh script to see if the new security groups deploy correctly.

By the way, I actually created a small test script to test just this function rather than run all the network stacks over and over again while I worked through some bugs.

Check to make sure the four new groups got created:

Also check that the security groups have the correct rules with the IP address for each user in the appropriate group rules.

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
Cloud Security
Zero Trust
Network Security
AWS
Security Group
Recommended from ReadMedium