Posts

AWS Account Management (Resource Management)

There is quite a bit of nuance in managing accounts in AWS.  One particular issue I see come up is with managing account lifecycles (i.e. if a person wants to have "temp" accounts to provide for people to "play" and learn).  This is simply not easily accomplished.  However, there are procedural ways to deal with this if folks need this type of functionality.  I have given it the following moniker: "account recycling" The idea is that you would have different account types: "core" accounts under the control of your master/payer account - and these do not get recycled. Long lived line of business accounts - hosting production, etc... long lived developer accounts - (still trying to work through how these would be managed) "burner" accounts - preset limits for usage, pre-determined length of time the account is available The idea of the burner account is that you would create a "pool" of accounts that could be provided ...

Linux - Visual Studio Code IDE

I put away my pitchforks for protesting Microsoft almost 2 decades ago.  At first I was in the Microsoft is the devil camp... then I started working on Solaris... and then AIX... and then Linux (SuSE) and finally Red Hat Enterprise Linux.  With each iteration along that timeline, I continued to care less and less about what was going on with Microsoft and Windows.  When Microsoft started to show up in the headlines regarding Linux compatibility, Red Hat collaboration, Open Source contributions, I was minimally apprehensive and was actually rather optimistic that times were changing and they saw the light. Today - I am about to install the Linux version of Visual Studio Code (relegating Atom IDE to be the failback). sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo su -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsof...

AWS Route 53 - Updating primary NS (Name Servers)

It is unlikely that many folks will find themselves in this particular situation. I have several AWS master/payer accounts - and one of the accounts "owned" my domain (cloudxabide.com) and I wanted to manage and control that domain from a different master account. Account A - cloudxabide.com. Account B - example.com. myotherexample.com. Initiate the transfer of the domain by... (complete this later) Create Hosted Zone (cloudxabide.com) and retrieve the 4 NS entries. Then click on Registered Domains and the zone you wish to update. Under the Name servers section there should be a "Add or edit name servers" entry - click on that. Replace the existing server entries with the values you found above. Once you have completed this step, you will need to wait for an email indicating the update has occurred.  You may have to wait up to 2 days for the records to finishing traversing the Interwebs, as well. whois cloudxabide.com | grep ^Name dig +short NS clo...

AWS Security - Best Practices (in light of a recent breach)

As of the date that I am creating this, the (actual) details have not been released regarding the 2019 Recent breach involving a WAF exploitation and S3 exfiltration. A particular thread I had reviewed indicated that a 3rd-party WAF was exploited, which implies that it was likely to have been running on an EC2 instance.  This EC2 instance "metadata service" was then exploited by that WAF appliance software. I think there are several potential opportunities to improve the security posture.. IAM SCPs Security Groups S3 access policy defense in depth least privilege One thing that was a concern to me,;preventing access to the "metadata service" (from a host with Internet access), I would like to explore the impact of the following: iptables -A OUTPUT -m owner ! --uid-owner root -d 169.254.169.254 -j DROP I was initially surprised to learn that VPC Flow Logs do not capture the traffic destined for the instance metadata endpoint (but then realiz...

AWS CLI - get yer mind right...

Yay! $ aws ec2 describe-subnets --region us-east-1 --query 'Subnets[*].[CidrBlock,Tags[?Key==`Name`].Value|[0]]' --output table ----------------------------------------- |            DescribeSubnets            | +-----------------+---------------------+ |  10.64.0.0/25   |  Public subnet 1    | |  10.64.2.128/25 |  Private subnet 3A  | |  10.64.1.128/25 |  Private subnet 1A  | |  10.64.1.0/25   |  Public subnet 3    | |  10.64.0.128/25 |  Public subnet 2    | |  10.64.2.0/25   |  Private subnet 2A  | +-----------------+---------------------+ WRONG WAY.... $ aws ec2 describe-subnets --region us-east-1 --query 'Subnets[*].[CidrBlock,Tags[?Key==`Name`].Value[]]' --output text ----------------------- |   DescribeSubnets   | +---------------------+ |  10...

Shell Foo - Right said sed...

Ugh.. this one was a serious PITA. For as long as I can recall, I have been using the following command $ sed -i -e 's/foo/bar/g' file.txt which would swap every occurrence of the word 'foo' with 'bar'. Today, I was attempting to swap 'MyCertificateARN' with a variable $CERTIFICATEARN $ sed -i 's/MyCertificateARN/${CERTIFICATEARN}/g' file.txt sed: -e expression #1, char 69: unknown option to `s' Huh? So, I tried substituting in other variables as a test, using actual text, swapping the ' with "... nothing was working correctly. I then echo'd the variable $ echo ${CERTIFICATEARN} arn:aws:acm:us-east-1:427832613400:certificate/57c534b7-4560-4610-a084-ad78d906d8df Wait.. there's a '/' in there.  After digging for quite a while, I discovered you can use whatever regex delimiter you want for the sed command. $ sed -i "s|MyCertificateARN|${CERTIFICATEARN}|g" ${OUTPUT}'' $ grep "...

Linux Foo - Manage LUKS key

I assume this is a bit of a dated set of procedures... as-in, there is probably a better way to deal with LUKS nowadays.  Also - at some point I will (hopefully) be writing a blog entry about LUKS key accessed from centralized key server. Assessment cryptsetup luksDump /dev/sda1 cryptsetup luksOpen --test-passphrase --key-slot 3 --key-file /root/.keyfile /dev/sda1 Setup # If there is already a crypttab, update it... otherwise, create a new one if [ -f /etc/crypttab ] then    sed -i -e '1i# <target name>    <source device>        <key file>    <options>' /etc/crypttab else   echo "# <target name>    <source device>        <key file>    <options> " > /etc/crypttab fi # Create a "key file" and add it to the device (interactive step) dd if=/dev/urandom of=/root/.keyfile bs=32 count=1 chmod 0400 /root/.ke...