PRACTICE LAB 10

Cloud Security Configuration Review

Audit S3 bucket access policies to block public permissions, configure secure multi-stage Dockerfiles running with non-root user credentials, and integrate scanning tooling.

Environment
Docker / AWS S3 / CLI
Difficulty
Beginner (Level 4)
Course Module
Cloud & Container Security
Deliverables
Hardened Dockerfile & S3 block status
1. System Architecture & Workflow

The diagram below represents the system architecture and operational data flow routing designed for this project.

Architecture Diagram
2. Part 1: Step-by-Step Action Items & Key Execution Steps
STEP 1

Harden S3 Bucket Configurations via AWS Console

Locate exposed storage buckets in the AWS console and block public lookup access.

  1. Navigate to the S3 Management Console inside AWS.
  2. Click on the name of your target storage bucket (e.g. student-vulnerable-bucket).
  3. Go to the Permissions tab in the top menu bar.
  4. Scroll to the Block public access (bucket settings) block, and click Edit.
  5. Check the box labeled Block *all* public access. Click Save changes, type confirm in the validation prompt, and click Confirm. This denies external public requests.
STEP 2

Develop a Hardened Dockerfile Container Manifest

Construct a multi-stage Dockerfile that runs application nodes using non-root privileges.

  1. In your Kali terminal, create a project directory named node-container.
  2. Use the multi-stage config in Step 4 to design a secure building template.
  3. Build and scan the container image using the commands below:
$ sudo docker build -t node-secure:1.0 .
This command runs the local compiler build engine to assemble the image from the Dockerfile.
PartWhat It Does
dockerThe Docker container runtime CLI tool
-tShow only TCP connections
$ docker run -it --entrypoint whoami node-secure:1.0
This checks the default execution username, confirming it prints node rather than root.
4. Part 2: Complete Deliverable Assets & Production Templates

Below is the complete, secure multi-stage Dockerfile for application compilation:

Code Breakdown — Line by Line

Copy
Line 1: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
# Multi-stage secure Dockerfile configuration baseline
Line 2: This is a comment that describes what the code does: "Multi-stage secure Dockerfile configuration baseline". Comments start with # and are ignored by Python.
FROM node:18-alpine AS builder
Line 3: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
WORKDIR /app
Line 4: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
COPY package*.json ./
Line 5: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
RUN npm ci
Line 6: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
FROM node:18-alpine
Line 7: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
WORKDIR /app
Line 8: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
COPY --from=builder /app/node_modules ./node_modules
Line 9: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
COPY . .
Line 10: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
# Enforce non-root execution permissions
Line 11: This is a comment that describes what the code does: "Enforce non-root execution permissions". Comments start with # and are ignored by Python.
USER node
Line 12: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
EXPOSE 8080
Line 13: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
CMD ["node", "server.js"]
Line 14: This line performs an operation as part of the script logic. It contributes to the overall functionality of the program.
✓ Complete Combined Script: All lines explained above are combined into the full script shown below. Copy and paste the entire script into your file.
Copy
# Multi-stage secure Dockerfile configuration baseline
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci

FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY . .

# Enforce non-root execution permissions
USER node
EXPOSE 8080
CMD ["node", "server.js"]
5. Deliverables Summary

Created Files / Templates

  • Hardened Dockerfile configuration file
  • Cloud audit summary report listing bucket permissions

Verification Artifacts

  • Screenshots showing Block Public Access activated on S3.
  • Command output of docker run printing the non-root execution user.
3. Automation Architecture

The diagram below highlights the automated execution flow pipeline or scripting loop implemented for this module.

Automation Flow Diagram