Add wip lab 3

This commit is contained in:
2025-06-10 10:54:13 -07:00
parent 4bf9dd216b
commit cbe1713adf
25 changed files with 17 additions and 13 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
.env
.envrc
terraform/
private*

View File

Before

Width:  |  Height:  |  Size: 257 KiB

After

Width:  |  Height:  |  Size: 257 KiB

View File

@ -12,11 +12,11 @@
- [x] Modify and make a second commit
![image of terminal](./assets/prep-console.png)
- [x] Test to see if gitea actions works
- [ ] Have an existing s3 bucket
- [x] Have an existing s3 bucket
## Resources
- [x] [Capital One Data Breach](./assets/Capital%20One%20Data%20Breach%20—%202019.%20Introduction%20_%20by%20Tanner%20Jones%20_%20Nerd%20For%20Tech%20_%20Medium.pdf)
- [ ] [Grant IAM User Access to Only One S3 Bucket](./assets/Grant%20IAM%20User%20Access%20to%20Only%20One%20S3%20Bucket%20_%20Medium.pdf)
- [x] [Grant IAM User Access to Only One S3 Bucket](./assets/Grant%20IAM%20User%20Access%20to%20Only%20One%20S3%20Bucket%20_%20Medium.pdf)
- [ ] [IAM Bucket Policies](./assets/From%20IAM%20to%20Bucket%20Policies_%20A%20Comprehensive%20Guide%20to%20S3%20Access%20Control%20with%20Console,%20CLI,%20and%20Terraform%20_%20by%20Mohasina%20Clt%20_%20Medium.pdf)
- [ ] [Dumping S3 Buckets!](https://www.youtube.com/watch?v=ITSZ8743MUk)
@ -47,5 +47,4 @@ graph LR
ExplainIAMIdentity -.-> IAMIdentity
classDef aside fill:#fffbe6,stroke:#bbb,stroke-dasharray: 5 5,stroke-width:2px;
```
ieua((()))
```

View File

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

@ -1,2 +1,5 @@
[tasks.ssh]
run = "ssh -p 5679 vboxuser@127.0.0.1"
run = "ssh -p 5679 vboxuser@127.0.0.1"
[tasks.generate]
run = "./utilities/pdf_make/labs.sh"

View File

@ -2,20 +2,22 @@
# Define image name
IMAGE_NAME="pandoc-report-generator"
PDF_MAKE_DIR="./pdf_make" # Path to your Dockerfile and generate_reports.sh
LABS_DIR="./labs" # Path to your labs directory
PDF_MAKE_DIR="." # Path to your Dockerfile and generate_reports.sh
LABS_DIR="../.." # Path to your labs directory
WORKING_DIRECTORY=$(dirname "$0")
echo "--- Debug Info ---"
echo "Current Working Directory: $(pwd)"
echo "Directory name: $(dirname "$0")"
echo "Current Working Directory: ${WORKING_DIRECTORY}"
echo "Image Name (variable): '$IMAGE_NAME'"
echo "PDF Make Directory (variable): '$PDF_MAKE_DIR'"
echo "Labs Directory (variable): '$LABS_DIR'"
echo "Absolute Labs Mount Path: '$(pwd)/$LABS_DIR'"
echo "Absolute Labs Mount Path: '${WORKING_DIRECTORY}/$LABS_DIR'"
echo "--------------------"
echo "--- Building Docker image: $IMAGE_NAME ---"
# Build the Docker image from the pdf_make directory
docker build -t "$IMAGE_NAME" "$PDF_MAKE_DIR"
docker build -t "$IMAGE_NAME" "$WORKING_DIRECTORY/$PDF_MAKE_DIR"
BUILD_STATUS=$?
echo "Build command exited with status: $BUILD_STATUS"
@ -27,7 +29,7 @@ fi
echo "--- Running report generation inside Docker container ---"
# This single-line docker run command is the most robust way to avoid shell parsing issues.
# It explicitly sets the entrypoint and mounts the /labs directory.
docker run --rm --entrypoint /bin/sh -v "$(pwd)/$LABS_DIR:/labs" "$IMAGE_NAME" /app/generate_reports.sh
docker run --rm --entrypoint /bin/sh -v "${WORKING_DIRECTORY}/$LABS_DIR:/labs" "$IMAGE_NAME" /app/generate_reports.sh
RUN_STATUS=$?
echo "Run command exited with status: $RUN_STATUS"
@ -41,7 +43,7 @@ echo "--- All operations completed successfully. ---"
# --- New Step: Verify Output on Host ---
echo "--- Verifying generated PDFs on host ---"
find "$LABS_DIR" -type f -name "LAB-REPORT.pdf"
find "${WORKING_DIRECTORY}/$LABS_DIR" -type f -name "LAB-REPORT.pdf"
if [ $? -eq 0 ]; then
echo "PDFs should now be available in your '$LABS_DIR' directory."