Rainsbrook
https://www.rainsbrook.co.uk/wiki/
2024-03-19T05:54:31+00:00Rainsbrook
https://www.rainsbrook.co.uk/wiki/
https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?media=wiki:dokuwiki.svgtext/html2024-03-15T11:06:14+00:00andrew (andrew@undisclosed.example.com)iam-key-age
https://www.rainsbrook.co.uk/wiki/doku.php?id=aws:iam-key-age&rev=1710500774&do=diff
iam-key-age
# Written 24/09/2021 by Andrew Stringer
# Prurpose is to detect users with AWS IAM access keys older than a certain number of days (accesskey below)
# Should be run once per week via CloudWatch Events.
# Uses the "email" value in Tags, so these need to be set for users.
import boto3, os, time, datetime, sys, json
from datetime import date
from botocore.exceptions import ClientError
# age of keys
accesskey = 180
AWS_REGION = 'eu-west-2'
iam = boto3.client('iam')
email_list = []…text/html2024-03-12T13:25:08+00:00andrew (andrew@undisclosed.example.com)ecs
https://www.rainsbrook.co.uk/wiki/doku.php?id=aws:ecs&rev=1710249908&do=diff
Amazon ECS cluster
$ aws ecs create-cluster --cluster-name web2048
{
"cluster": {
"status": "ACTIVE",
"defaultCapacityProviderStrategy": [],
"statistics": [],
"capacityProviders": [],
"tags": [],
"clusterName": "web2048",
"settings": [
{
"name": "containerInsights",
"value": "disabled"
}
],
"registeredContainerInstancesCount": 0,
"pendingTasksCount": 0,
…text/html2024-03-12T12:08:51+00:00andrew (andrew@undisclosed.example.com)ecr
https://www.rainsbrook.co.uk/wiki/doku.php?id=aws:ecr&rev=1710245331&do=diff
ECR
$ aws ecr describe-repositories --profile nonprod_admin | jq .[][].repositoryName
"ubuntu1804-infradevtools-container"
Brain Dump FIXME
$ aws ecr create-repository --repository-name web2048
{
"repository": {
"repositoryUri": "356565822870.dkr.ecr.us-west-2.amazonaws.com/web2048",
"imageScanningConfiguration": {
"scanOnPush": false
},
"encryptionConfiguration": {
"encryptionType": "AES256"
},
"registryId": "356…text/html2024-03-12T11:54:43+00:00andrew (andrew@undisclosed.example.com)ec2 - [EC2 metadata - get public ip address]
https://www.rainsbrook.co.uk/wiki/doku.php?id=aws:ec2&rev=1710244483&do=diff
EC2
Listing instances
root@ftphost02:~/.aws# aws ec2 describe-instances --output table --query 'Reservations[].Instances[].Tags[?Key==`Name`].Value'
-------------------
|DescribeInstances|
+-----------------+
| Node1 |
| FTP |
+-----------------+
root@ftphost02:~/.aws# aws ec2 describe-instances --output table --query 'Reservations[].Instances[].[join(`,`,Tags[?Key==`Name`].Value),State.Name]'
----------------------------
| DescribeInstances |
+--------------+--…text/html2024-02-27T13:42:53+00:00andrew (andrew@undisclosed.example.com)git-cheatsheet - [AWS CodeCommit]
https://www.rainsbrook.co.uk/wiki/doku.php?id=rb:git-cheatsheet&rev=1709041373&do=diff
Git Cheatsheet
Don't believe anything here.... :-} At the moment this is just for my benefit and is being added to and edited as I discover “stuff”....
Usernames and passwords
It's recommended that two factor authentication is set up for Github accounts. This does introduce a few subtle gotchas:-000text/html2024-02-26T10:03:55+00:00andrew (andrew@undisclosed.example.com)sts
https://www.rainsbrook.co.uk/wiki/doku.php?id=aws:sts&rev=1708941835&do=diff
AWS Security Token Service
Assume role in other accounts in organisation
#!/bin/bash
thisaccount='123456787654'
role='OrganizationAdminRole'
session_name='AssumeSession'
# Get all the accounts in the organisation
for account in $(aws organizations list-accounts --no-paginate | jq -r '.Accounts[] | .Id ')
do
if [ ${account} = ${thisaccount} ]; then
break
else
printf "Getting temp creds for account sts assume-roles.\n" "${account}"
printf "aws sts assume-role …text/html2024-02-21T16:43:54+00:00andrew (andrew@undisclosed.example.com)bash - [Exit from loop early]
https://www.rainsbrook.co.uk/wiki/doku.php?id=linux:bash&rev=1708533834&do=diff
Bash
What is BASH?
BASH stands for the Bourne Again SHell, which is based on the UNIX C Shell and the Korn Shell. It is POSIX2 compliant.
The shell is the way users or scripts communivate with the Kernel. See <https://askubuntu.com/questions/161511/are-the-linux-utilities-parts-of-the-kernel-shell> for info on shells and kernels.
Bash Config files000text/html2024-02-20T17:01:05+00:00andrew (andrew@undisclosed.example.com)jq - [Parameter Store]
https://www.rainsbrook.co.uk/wiki/doku.php?id=linux:jq&rev=1708448465&do=diff
jq - json parser
jq tutorial:- <https://cameronnokes.com/blog/working-with-json-in-bash-using-jq/>
AWS Policy - get ARN
$ CREATEPOLICY=`aws iam create-policy --profile sandbox --policy-name iam-key-age-test-policy --policy-document file://lambdaPolicy-iam-key-age.json`
{
"Policy": {
"PolicyName": "iam-key-age-test-policy",
"PolicyId": "ANPAYJCO7BT6GMCF63B2L",
"Arn": "arn:aws:iam::569248779516:policy/iam-key-age-test-policy",
"Path": "/",
"Defaul…text/html2024-01-17T17:59:12+00:00andrew (andrew@undisclosed.example.com)fvc-snmp-mib.zip - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=networking%3Afvc-snmp-mib.zip&ns=networking&rev=1705514352&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/images/fileicons/svg/zip.svg" alt="fvc-snmp-mib.zip" loading="lazy" width="500" height="500" />text/html2024-01-03T17:52:49+00:00andrew (andrew@undisclosed.example.com)applenetworkserver.png - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=rb-mac%3Aapplenetworkserver.png&ns=rb-mac&rev=1704304369&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?w=500&h=500&tok=a8e85b&media=rb-mac:applenetworkserver.png" alt="applenetworkserver.png" loading="lazy" width="500" height="500" />text/html2023-11-24T16:57:26+00:00andrew (andrew@undisclosed.example.com)20210607_172032.jpg - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=telecoms%3A20210607_172032.jpg&ns=telecoms&rev=1700845046&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?w=500&h=500&tok=e6e5f6&media=telecoms:20210607_172032.jpg" alt="20210607_172032.jpg" loading="lazy" width="500" height="500" />text/html2023-11-24T16:57:26+00:00andrew (andrew@undisclosed.example.com)20210607_172047.jpg - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=telecoms%3A20210607_172047.jpg&ns=telecoms&rev=1700845046&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?w=500&h=500&tok=5a9449&media=telecoms:20210607_172047.jpg" alt="20210607_172047.jpg" loading="lazy" width="500" height="500" />text/html2023-11-24T16:57:25+00:00andrew (andrew@undisclosed.example.com)20210607_171949.jpg - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=telecoms%3A20210607_171949.jpg&ns=telecoms&rev=1700845045&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?w=500&h=500&tok=2f07f6&media=telecoms:20210607_171949.jpg" alt="20210607_171949.jpg" loading="lazy" width="500" height="500" />text/html2023-11-10T15:28:54+00:00andrew (andrew@undisclosed.example.com)cisco_pa_t3_e3_.jpg - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=networking%3Acisco_pa_t3_e3_.jpg&ns=networking&rev=1699630134&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?w=500&h=500&tok=3b76ab&media=networking:cisco_pa_t3_e3_.jpg" alt="cisco_pa_t3_e3_.jpg" loading="lazy" width="500" height="500" />text/html2023-11-10T15:28:54+00:00andrew (andrew@undisclosed.example.com)pa-2t3_e3-.jpg - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=networking%3Apa-2t3_e3-.jpg&ns=networking&rev=1699630134&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?w=500&h=500&tok=8a02a2&media=networking:pa-2t3_e3-.jpg" alt="pa-2t3_e3-.jpg" loading="lazy" width="500" height="500" />text/html2023-11-09T01:06:17+00:00andrew (andrew@undisclosed.example.com)ehwic-gsm.png - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=networking%3Aehwic-gsm.png&ns=networking&rev=1699491977&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?w=500&h=500&tok=6742fb&media=networking:ehwic-gsm.png" alt="ehwic-gsm.png" loading="lazy" width="500" height="500" />text/html2023-11-06T23:05:50+00:00andrew (andrew@undisclosed.example.com)adva-fsp-102ge.jpg - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=networking%3Aadva-fsp-102ge.jpg&ns=networking&rev=1699311950&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?w=500&h=500&tok=a22e34&media=networking:adva-fsp-102ge.jpg" alt="adva-fsp-102ge.jpg" loading="lazy" width="500" height="500" />text/html2023-11-06T15:12:31+00:00andrew (andrew@undisclosed.example.com)gvg-100-mixer.jpeg - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=telecoms%3Agvg-100-mixer.jpeg&ns=telecoms&rev=1699283551&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?w=500&h=500&tok=6f5f66&media=telecoms:gvg-100-mixer.jpeg" alt="gvg-100-mixer.jpeg" loading="lazy" width="500" height="500" />text/html2023-09-08T08:46:08+00:00andrew (andrew@undisclosed.example.com)dec_rainbow_100_floor_model.jpg - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=telecoms%3Adec_rainbow_100_floor_model.jpg&ns=telecoms&rev=1694162768&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?w=500&h=500&tok=1d188a&media=telecoms:dec_rainbow_100_floor_model.jpg" alt="dec_rainbow_100_floor_model.jpg" loading="lazy" width="500" height="500" />text/html2023-09-08T08:40:13+00:00andrew (andrew@undisclosed.example.com)cablejukebox-laserdisk.jpg - created
https://www.rainsbrook.co.uk/wiki/doku.php?image=telecoms%3Acablejukebox-laserdisk.jpg&ns=telecoms&rev=1694162413&tab_details=history&media_do=diff&do=media
<img src="https://www.rainsbrook.co.uk/wiki/lib/exe/fetch.php?w=500&h=500&tok=061df9&media=telecoms:cablejukebox-laserdisk.jpg" alt="cablejukebox-laserdisk.jpg" loading="lazy" width="500" height="500" />