diff --git a/.github/workflows/lab3.yml b/.github/workflows/lab3.yml new file mode 100644 index 0000000..f39e22d --- /dev/null +++ b/.github/workflows/lab3.yml @@ -0,0 +1,79 @@ +name: Lab 3 β€” CI/CD Quickstart + System Info + +on: + push: + branches: + - '**' # run on any branch push (including feature/lab3) + workflow_dispatch: # manual trigger from the Actions tab + +jobs: + quickstart: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Hello from GitHub Actions + run: | + echo "πŸ‘‹ Hello from ${{ github.workflow }}!" + echo "Triggered by: ${{ github.event_name }}" + echo "Actor: ${{ github.actor }}" + echo "Branch/Ref: ${{ github.ref }}" + echo "Commit SHA: ${{ github.sha }}" + + - name: Print environment summary + run: | + echo "Runner OS: ${{ runner.os }}" + echo "Job: ${{ github.job }}" + echo "Workflow run number: ${{ github.run_number }}" + echo "Workflow run ID: ${{ github.run_id }}" + + - name: Gather system information + id: sysinfo + shell: bash + run: | + set -euxo pipefail + { + echo "# Runner system information" + date -u +"Collected at (UTC): %Y-%m-%dT%H:%M:%SZ" + echo "Runner.OS: ${{ runner.os }}" + echo "Runner.Name: ${{ runner.name }}" + echo "Runner.Arch: $(uname -m)" + echo + + echo "## OS release" + if [ -f /etc/os-release ]; then cat /etc/os-release; else sw_vers || systeminfo || ver || true; fi + echo + + echo "## Kernel" + uname -a || true + echo + + echo "## CPU" + (command -v lscpu >/dev/null && lscpu) || (sysctl -a 2>/dev/null | grep -iE 'brand|cpu\.(core|thread)|machdep.cpu' || true) || (wmic cpu get name,NumberOfCores,NumberOfLogicalProcessors || true) + echo + + echo "## Memory" + (free -h || vm_stat || (systeminfo | findstr /C:"Total Physical Memory") || true) + echo + + echo "## Disk usage" + df -h || true + + echo + echo "## Tools" + bash --version | head -n 1 || true + python3 --version || true + node --version || true + npm --version || true + } > system-info.txt + echo "file=system-info.txt" >> "$GITHUB_OUTPUT" + + - name: Upload system-info artifact + uses: actions/upload-artifact@v4 + with: + name: system-info + path: system-info.txt + if-no-files-found: error + retention-days: 7 diff --git a/a.txt b/a.txt new file mode 100644 index 0000000..879f7b0 --- /dev/null +++ b/a.txt @@ -0,0 +1,2 @@ +Hello +Line 2 diff --git a/demo.txt b/demo.txt new file mode 100644 index 0000000..565d87a --- /dev/null +++ b/demo.txt @@ -0,0 +1,2 @@ +scratch +scratch diff --git a/labs/submission1.md b/labs/submission1.md new file mode 100644 index 0000000..aceb1f5 --- /dev/null +++ b/labs/submission1.md @@ -0,0 +1,7 @@ +# Why sign Git commits? + +- Confirms the author's identity +- Ensures commit integrity +- Lets orgs enforce trust +- Improves auditability and supply-chain security + diff --git a/labs/submission2.md b/labs/submission2.md new file mode 100644 index 0000000..34de3a3 --- /dev/null +++ b/labs/submission2.md @@ -0,0 +1,390 @@ +# Lab 2 β€” Submission + +## Task 1 β€” Git Object Model + +- **Commands run:** + +**1.1** +```bash +$ git rev-parse HEAD +2a6f5659536108b1330a9c5aa4057d10bd201239 +``` + +**1.2** +```bash +$ git cat-file -p 2a6f5659536108b1330a9c5aa4057d10bd201239 +``` + +**2.1** +```bash +$ git rev-parse HEAD^{tree} +c223eb926a9deecba14c173dbc35536f41a4d316 +``` + +**2.2** +```bash +$ git cat-file -p c223eb926a9deecba14c173dbc35536f41a4d316 +``` + +**3.1** +```bash +$ git ls-tree -r HEAD +100644 blob 4db373667a50f14a411bb5c7e879690fd08aacc1 README.md +100644 blob 879f7b0a4bf49956fb34fe513a15463a8ddbb143 a.txt +100644 blob b1f8af089a94f160ce00ed7710f07a7e9ba6c584 labs/lab1.md +100644 blob 1468ba02d6bcacd3fee5fd378cc02717a8cb2fbc labs/lab2.md +100644 blob 890d3c25c2ea110419b0fd28afbeb468cb97a171 labs/lab3.md +100644 blob aceb1f5b85dfb9f5a3586498d64d40343fadef8a labs/submission1.md +100644 blob 81407a8214e2fcfeb3b2412b8b0037bfde7584c1 labs/submission2.md +100644 blob 304628578f83a142e37ad867c4d94e0dfe3797de lectures/lec1.md +100644 blob c4f16b6b7ad4b9c00970949aba60b8d26aae656f lectures/lec2.md +100644 blob 337a6f9942f26e6f9af8f43df1002ae0f81bd8cd lectures/lec3.md +100644 blob e38d7f6166c0658c5019b23a0f05a057b5fe7eb4 notes.txt +``` + +**3.2** +```bash +$ git cat-file -p 4db373667a50f14a411bb5c7e879690fd08aacc1 +``` + +- **Outputs:** + +**1) `git cat-file -p `** +```text +tree c223eb926a9deecba14c173dbc35536f41a4d316 +parent 4ecb0e3dbbdfddd760b0f776f3a7224902bd280d +author NoNesmer 1758031152 +0300 +committer NoNesmer 1758031152 +0300 +gpgsig -----BEGIN SSH SIGNATURE----- + U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgFNB3gltOciUAt/ZtkSfs0VgCCo + MO+RqYm+IISudUqlwAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 + AAAAQEgvBnIyRoEK/IMG1q55SFEdMGvPqzmeWpkSwQiLvRTsTYngLMNkhUcfVXR598WrM+ + /NlYucMa71fevTCeR15A8= + -----END SSH SIGNATURE----- + +Add notes.txt +``` + +**2) `git cat-file -p `** +```text +100644 blob 4db373667a50f14a411bb5c7e879690fd08aacc1 README.md +100644 blob 879f7b0a4bf49956fb34fe513a15463a8ddbb143 a.txt +040000 tree d5e0f66d9b08d9cc7468dd61eddadcab969edbfd labs +040000 tree 2f0387f9eebb6ad846cd02dbd1e7a4a151c06a7e lectures +100644 blob e38d7f6166c0658c5019b23a0f05a057b5fe7eb4 notes.txt +``` + +**3) `git cat-file -p ` (README.md)** +````text +# πŸš€ DevOps Introduction Course: Principles, Practices & Tooling + +[![Labs](https://img.shields.io/badge/Labs-80%25-blue)](#-lab-based-learning-experience) +[![Exam](https://img.shields.io/badge/Exam-20%25-orange)](#-evaluation-framework) +[![Hands-On](https://img.shields.io/badge/Focus-Hands--On%20Labs-success)](#-lab-based-learning-experience) +[![Level](https://img.shields.io/badge/Level-Bachelor-lightgrey)](#-course-roadmap) + +Welcome to the **DevOps Introduction Course**, where you will gain a **solid foundation in DevOps principles and practical skills**. +This course is designed to provide a comprehensive understanding of DevOps and its key components. + +Through **hands-on labs and lectures**, you’ll explore version control, software distribution, CI/CD, containerization, cloud computing, and beyond β€” the same workflows used by modern engineering teams. + +--- + +## πŸ“š Course Roadmap + +Practical modules designed for incremental skill development: + +| # | Module | Key Topics & Technologies | +|----|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------| +| 1 | **Introduction to DevOps** | Core principles, essential tools, DevOps concepts | +| 2 | **Version Control** | Collaborative development workflows, Git tooling | +| 3 | **CI/CD** | Continuous integration/deployment practices | +| 4 | **Networking & OS for DevOps** | IP/DNS, firewalls, Linux fundamentals (shell/systemd/logs), permissions, troubleshooting, DevOps-friendly distros | +| 5 | **Virtualization** | Virtualization concepts, benefits in modern IT infrastructures | +| 6 | **Containers** | Docker containerization, Kubernetes orchestration | +| 7 | **GitOps & Progressive Delivery** | Git as source of truth, Argo CD, canary/blue-green deployments, feature flags, rollbacks | +| 8 | **SRE & Resilience** | SLOs/SLAs/SLIs, error budgets, incident management, chaos engineering, postmortems | +| 9 | **Security in DevOps (DevSecOps)** | Shift-left security, SAST/DAST, SBOM, container/image scanning (Trivy/Snyk), secret management | +| 10 | **Cloud Fundamentals** | AWS/Azure/GCP basics, IaaS/PaaS/SaaS, regions/zones, pricing, core services (EC2/S3/IAM/VPC), cloud-native patterns | +| 11 | **Bonus** | Web3 Infrastructure, decentralized storage, IPFS, Fleek | + +--- + +## πŸ–Ό Module Flow Diagram + +```mermaid +flowchart TD + A[Intro to DevOps] --> B[Version Control] + B --> C[CI/CD] + C --> D[Networking & OS] + D --> E[Virtualization] + E --> F[Containers] + F --> G[GitOps & Progressive Delivery] + G --> H[SRE & Resilience] + H --> I[Security in DevOps] + I --> J[Cloud Fundamentals] + J --> K[Bonus: Web3 Infrastructure] +``` + +--- + +## πŸ›  Lab-Based Learning Experience + +**80% of your grade comes from hands-on labs** β€” each designed to build real-world skills: + +1. **Lab Structure** + + * Task-oriented challenges with clear objectives + * Safe environments using containers or local VMs + +2. **Submission Workflow** + + * Fork course repository β†’ Create lab branch β†’ Complete tasks + * Push to fork β†’ Open Pull Request β†’ Receive feedback & evaluation + +3. **Grading Advantage** + + * **Perfect Lab Submissions (10/10)**: Exam exemption + bonus points + * **On-Time Submissions (β‰₯6/10)**: Guaranteed pass (C or higher) + * **Late Submissions**: Maximum 6/10 + +--- + +## πŸ“Š Evaluation Framework + +*Transparent assessment for skill validation* + +### Grade Composition + +* Labs (10 Γ— 8 points each): **80%** +* Final Exam (comprehensive): **20%** + +### Performance Tiers + +* **A (90-100)**: Mastery of core concepts, innovative solutions +* **B (75-89)**: Consistent completion, minor improvements needed +* **C (60-74)**: Basic competency, needs reinforcement +* **D (0-59)**: Fundamental gaps, re-attempt required + +--- + +## βœ… Success Path + +> *"Complete all labs with β‰₯6/10 to pass. Perfect lab submissions grant exam exemption and bonus points toward an A."* + +--- Brief explanations + +- **Commit β€” `git rev-parse HEAD` + `git cat-file -p `** + A *commit* is a history node that stores metadata (author, timestamp, message), a pointer to a **tree**, and parent commit(s). + In my output I see: `tree c223eb9…`, a `parent …`, `author/committer …`, and the message β€œAdd notes.txt”. + β†’ Conclusion: the commit ties my change to a specific snapshot (its tree) and links it into history. + +- **Tree β€” `git rev-parse HEAD^{tree}` + `git cat-file -p `** + A *tree* is the directory snapshot for that commit: it maps names and modes to object hashes (either **blob** for files or **tree** for subfolders). + In my output I see entries like `README.md β†’ 4db3736… (blob)` and subfolders `labs` and `lectures` as `tree` objects. + β†’ Conclusion: the tree records *what files/folders exist* and *which object IDs* represent them. + +- **Blob β€” `git ls-tree -r HEAD` + `git cat-file -p `** + A *blob* is just the raw file contents for a specific version (no filename or path inside the blob itself). + Printing the blob for `README.md` shows the actual text of the file. + β†’ Conclusion: filenames/paths come from the **tree**; the blob is only the bytes. + + +## Task 2 β€” Reset & Reflog +- **Commands:** +```bash +git switch -c git-reset-practice +echo "First commit" > file.txt && git add file.txt && git commit -m "First commit" +echo "Second commit" >> file.txt && git add file.txt && git commit -m "Second commit" +echo "Third commit" >> file.txt && git add file.txt && git commit -m "Third commit" +git log --oneline -n 5 +git status +git reset --soft HEAD~1 +git status +git log --oneline -n 5 +git reset --hard HEAD~1 +git status +git log --oneline -n 5 +git reflog +git reset --hard f1d49f0 +git log --oneline -n 3 +``` + +- **`git log --oneline` snippet (key moments):** + +**After 3 commits** +```text +f1d49f0 (HEAD -> git-reset-practice) Third commit +4ddc9a6 Second commit +f8f9b40 First commit +2a6f565 (feature/lab2) Add notes.txt +4ecb0e3 Append something to a.txt +``` + +**After `git reset --soft HEAD~1`** +```text +4ddc9a6 (HEAD -> git-reset-practice) Second commit +f8f9b40 First commit +2a6f565 (feature/lab2) Add notes.txt +4ecb0e3 Append something to a.txt +909e555 Add txt file for example +``` + +**After `git reset --hard HEAD~1`** +```text +f8f9b40 (HEAD -> git-reset-practice) First commit +2a6f565 (feature/lab2) Add notes.txt +4ecb0e3 Append something to a.txt +909e555 Add txt file for example +6bc51c6 chore: add submission file for Lab 2 +``` + +**After recovery (`git reset --hard f1d49f0`)** +```text +f1d49f0 (HEAD -> git-reset-practice) Third commit +4ddc9a6 Second commit +f8f9b40 First commit +``` + +- **`git reflog` snippet (recovery references):** +```text +f8f9b40 (HEAD -> git-reset-practice) HEAD@{0}: reset: moving to HEAD~1 +4ddc9a6 HEAD@{1}: reset: moving to HEAD~1 +f1d49f0 HEAD@{2}: commit: Third commit +4ddc9a6 HEAD@{3}: commit: Second commit +f8f9b40 (HEAD -> git-reset-practice) HEAD@{4}: commit: First commit +2a6f565 (feature/lab2) HEAD@{5}: checkout: moving from feature/lab2 to git-reset-practice +``` + +- **What changed (working tree, index, history):** +``` +Soft reset (git reset --soft HEAD~1) +- History: branch pointer moved back one commit. +- Index: now includes the undone commit’s changes (staged). +- Working tree: unchanged (files stayed as they were). + +Hard reset (git reset --hard HEAD~1) +- History: branch pointer moved back one commit. +- Index: reset to match that commit (no staged changes). +- Working tree: files rewritten to that commit (uncommitted edits lost). + +Reflog + recovery +- Reflog recorded each move of HEAD (e.g., HEAD@{2} = "Third commit"). +- Using git reset --hard restored the repo to that earlier state. +``` + +## Task 3 β€” History Graph +- Graph snippet: + +$ git log --oneline --graph --all +* b860921 (side-branch) Side branch commit +| * f1d49f0 (git-reset-practice) Third commit +| * 4ddc9a6 Second commit +| * f8f9b40 First commit +|/ +* 2a6f565 (HEAD -> feature/lab2) Add notes.txt +* 4ecb0e3 Append something to a.txt +* 909e555 Add txt file for example +* 6bc51c6 chore: add submission file for Lab 2 +* 0ec5c78 (origin/feature/lab1, feature/lab1) docs: add commit signing summary +| * 20d0868 (origin/main, origin/HEAD, main) Revert "docs: add commit signing summary" +| * 57f2fe6 docs: add commit signing summary +| * b5d4e00 docs: add PR template +|/ +* 82d1989 feat: publish lab3 and lec3 +* 3f80c83 feat: publish lec2 +* 499f2ba feat: publish lab2 +* af0da89 feat: update lab1 +* 74a8c27 Publish lab1 +* f0485c0 Publish lec1 +* 31dd11b Publish README.md + +- Commit messages list: + +Commit messages list (bullets with just the messages) +Side branch commit +Third commit +Second commit +First commit +Add notes.txt +Append something to a.txt +Add txt file for example +chore: add submission file for Lab 2 +docs: add commit signing summary +Revert "docs: add commit signing summary" +docs: add commit signing summary +docs: add PR template +feat: publish lab3 and lec3 +feat: publish lec2 +feat: publish lab2 +feat: update lab1 +Publish lab1 +Publish lec1 +Publish README.md + +- Reflection: +The git log --graph --oneline --all view makes branch divergence (parallel lines) and merge points (a commit with two parents) obvious, so I can see which commits belong to each branch and where they were combined. + +## Task 4 β€” Tags +- **Tag names, commit hashes:** +```text +v1.0.0 -> fe64344ca6b63415b634accb46a35bddb8c46030 +``` + +- **Why tags matter:** +Tags mark important points in history (like releases). They’re stable, human-friendly references that don’t move, so teams/CI can build, deploy, and compare versions reliable. + +## Task 5 β€” switch vs checkout vs restore + +- **Commands and `git status` / `git branch` snippets:** +```bash +git switch -c cmd-compare +git switch - +git branch +git status +git checkout -b cmd-compare-2 +git checkout - +git branch +git status +echo "scratch" >> demo.txt +git status +# (tried restore on an untracked file; see notes below) +git restore demo.txt +git restore --staged demo.txt +git restore --source=HEAD~1 demo.txt +``` + +**`git branch` output** +```text + cmd-compare + cmd-compare-2 + feature/lab1 +* feature/lab2 + git-reset-practice + main + side-branch +``` + +**`git status` output (after creating demo.txt)** +```text +On branch feature/lab2 +Changes not staged for commit: + (use "git add ..." to update what will be committed) + (use "git restore ..." to discard changes in working directory) + modified: labs/submission2.md + +Untracked files: + (use "git add ..." to include in what will be committed) + demo.txt +``` + +- **Summary of when to use each:** + - **`git switch`** β€” branch operations only (modern, clear): + - `git switch -c cmd-compare` (create & switch), `git switch -` (jump back), `git switch feature/lab2`. + - **`git checkout`** β€” legacy multi-purpose (still works, but prefer `switch`/`restore`): + - You used `git checkout -b cmd-compare-2` and `git checkout -` to hop back. + - **`git restore`** β€” file content & staging: + - `git restore ` β†’ discard **working tree** changes (to match `HEAD`). + - `git restore --staged ` β†’ **unstage** changes (keep them in the working tree). + - `git restore --source= ` β†’ take the version from another commit. + - Note: operates on **tracked** files; remove untracked files with `rm` or `git clean -fd`. diff --git a/labs/submission3.md b/labs/submission3.md new file mode 100644 index 0000000..c947756 --- /dev/null +++ b/labs/submission3.md @@ -0,0 +1,189 @@ +# Lab 3 β€” CI/CD with GitHub Actions (Submission) + +## Task 1 + +### What I did +- Created branch `feature/lab3`. +- Added a minimal push-triggered workflow and pushed to run it. + +### Evidence +- **Successful run link (push): https://github.com/NoNesmer/F25-DevOps-Intro/actions/runs/17919233276** +- **Log snippet (key lines from β€œPrint context” step):** + ```text + My logs for task1: +Run echo "πŸ‘‹ Hello from Lab 3 β€” Quickstart" +πŸ‘‹ Hello from Lab 3 β€” Quickstart +Triggered by: push +Actor: NoNesmer +Ref: refs/heads/feature/lab3 +SHA: f72047a1b0b8c38aa89a709a9a8e3b3d6e4fd655 + +## Task 1 + +### What I did +- Added workflow-dispatch to enable manual runs +- Added a step to gather OS/CPU/memory/disk info and upload system-info.txt as an artifact + +### Evidence +- **Manual run link: https://github.com/NoNesmer/F25-DevOps-Intro/actions/runs/17920488865** +- Artifact (downloaded from the run page): +# Runner system information +Collected at (UTC): 2025-09-22T15:35:21Z +Runner.OS: Linux +Runner.Name: GitHub Actions 1000000006 +Runner.Arch: x86_64 + +## OS release +PRETTY_NAME="Ubuntu 24.04.3 LTS" +NAME="Ubuntu" +VERSION_ID="24.04" +VERSION="24.04.3 LTS (Noble Numbat)" +VERSION_CODENAME=noble +ID=ubuntu +ID_LIKE=debian +HOME_URL="https://www.ubuntu.com/" +SUPPORT_URL="https://help.ubuntu.com/" +BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" +PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" +UBUNTU_CODENAME=noble +LOGO=ubuntu-logo + +## Kernel +Linux runnervmf4ws1 6.11.0-1018-azure #18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux + +## CPU +Architecture: x86_64 +CPU op-mode(s): 32-bit, 64-bit +Address sizes: 48 bits physical, 48 bits virtual +Byte Order: Little Endian +CPU(s): 4 +On-line CPU(s) list: 0-3 +Vendor ID: AuthenticAMD +Model name: AMD EPYC 7763 64-Core Processor +CPU family: 25 +Model: 1 +Thread(s) per core: 2 +Core(s) per socket: 2 +Socket(s): 1 +Stepping: 1 +BogoMIPS: 4890.85 +Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid aperfmperf tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves user_shstk clzero xsaveerptr rdpru arat npt nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload umip vaes vpclmulqdq rdpid fsrm +Virtualization: AMD-V +Hypervisor vendor: Microsoft +Virtualization type: full +L1d cache: 64 KiB (2 instances) +L1i cache: 64 KiB (2 instances) +L2 cache: 1 MiB (2 instances) +L3 cache: 32 MiB (1 instance) +NUMA node(s): 1 +NUMA node0 CPU(s): 0-3 +Vulnerability Gather data sampling: Not affected +Vulnerability Itlb multihit: Not affected +Vulnerability L1tf: Not affected +Vulnerability Mds: Not affected +Vulnerability Meltdown: Not affected +Vulnerability Mmio stale data: Not affected +Vulnerability Reg file data sampling: Not affected +Vulnerability Retbleed: Not affected +Vulnerability Spec rstack overflow: Vulnerable: Safe RET, no microcode +Vulnerability Spec store bypass: Vulnerable +Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization +Vulnerability Spectre v2: Mitigation; Retpolines; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected +Vulnerability Srbds: Not affected +Vulnerability Tsx async abort: Not affected + +## Memory + total used free shared buff/cache available +Mem: 15Gi 778Mi 13Gi 38Mi 1.5Gi 14Gi +Swap: 4.0Gi 0B 4.0Gi + + +### Manual vs automatic: + +Automatic (push): runs on every push to matching branches; best for CI on each commit. + +Manual (workflow_dispatch): started on demand from UI/API; good for ad-hoc checks/demos. + +Both produce similar logs/artifacts; the difference is how they start. + + +### yaml: +name: Lab 3 β€” CI/CD Quickstart + System Info + +on: + push: + branches: + - '**' # run on any branch push (including feature/lab3) + workflow_dispatch: # manual trigger from the Actions tab + +jobs: + quickstart: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Hello from GitHub Actions + run: | + echo "πŸ‘‹ Hello from ${{ github.workflow }}!" + echo "Triggered by: ${{ github.event_name }}" + echo "Actor: ${{ github.actor }}" + echo "Branch/Ref: ${{ github.ref }}" + echo "Commit SHA: ${{ github.sha }}" + + - name: Print environment summary + run: | + echo "Runner OS: ${{ runner.os }}" + echo "Job: ${{ github.job }}" + echo "Workflow run number: ${{ github.run_number }}" + echo "Workflow run ID: ${{ github.run_id }}" + + - name: Gather system information + id: sysinfo + shell: bash + run: | + set -euxo pipefail + { + echo "# Runner system information" + date -u +"Collected at (UTC): %Y-%m-%dT%H:%M:%SZ" + echo "Runner.OS: ${{ runner.os }}" + echo "Runner.Name: ${{ runner.name }}" + echo "Runner.Arch: $(uname -m)" + echo + + echo "## OS release" + if [ -f /etc/os-release ]; then cat /etc/os-release; else sw_vers || systeminfo || ver || true; fi + echo + + echo "## Kernel" + uname -a || true + echo + + echo "## CPU" + (command -v lscpu >/dev/null && lscpu) || (sysctl -a 2>/dev/null | grep -iE 'brand|cpu\.(core|thread)|machdep.cpu' || true) || (wmic cpu get name,NumberOfCores,NumberOfLogicalProcessors || true) + echo + + echo "## Memory" + (free -h || vm_stat || (systeminfo | findstr /C:"Total Physical Memory") || true) + echo + + echo "## Disk usage" + df -h || true + + echo + echo "## Tools" + bash --version | head -n 1 || true + python3 --version || true + node --version || true + npm --version || true + } > system-info.txt + echo "file=system-info.txt" >> "$GITHUB_OUTPUT" + + - name: Upload system-info artifact + uses: actions/upload-artifact@v4 + with: + name: system-info + path: system-info.txt + if-no-files-found: error + retention-days: 7 \ No newline at end of file diff --git a/labs/submission4.md b/labs/submission4.md new file mode 100644 index 0000000..ea04bca --- /dev/null +++ b/labs/submission4.md @@ -0,0 +1,138 @@ +# Lab 4 β€” Operating Systems & Networking β€” Submission + +> Generated on: + - Mon, 29 Sep 2025 23:56:46 +0300 + +## Task 1 β€” Operating System Analysis + +### 1.1 Boot Performance & Load +**Commands** +``` +systemd-analyze +systemd-analyze blame +uptime +w +``` +**Output** +``` +bash: systemd-analyze: command not found + +bash: systemd-analyze: command not found + +./collect_lab4.sh: line 18: uptime: command not found + +./collect_lab4.sh: line 18: w: command not found +``` + +### 1.2 Process Forensics +**Commands** +``` +ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 6 +ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head -n 6 +``` +**Output** +``` +ps: unknown option -- o +Try `ps --help' for more information. + +ps: unknown option -- o +Try `ps --help' for more information. +``` + +**Top memory-consuming process:** (not available) + +### 1.3 Service Dependencies +**Commands** +``` +systemctl list-dependencies +systemctl list-dependencies multi-user.target +``` +**Output** +``` +bash: systemctl: command not found + +bash: systemctl: command not found +``` + +### 1.4 User Sessions +**Commands** +``` +who -a +last -n 5 +``` +**Output** +``` + +bash: last: command not found +``` + +### 1.5 Memory Analysis +**Commands** +``` +free -h +grep -E 'MemTotal|SwapTotal|MemAvailable' /proc/meminfo +``` +**Output** +``` +bash: free: command not found + +MemTotal: 16110760 kB +SwapTotal: 15204352 kB +``` + +**Observations (add brief notes):** +- Boot time hotspots: +- Users logged in: +- Resource utilization patterns: + +--- + +## Task 2 β€” Networking Analysis + +### 2.1 Path Tracing & DNS Resolution +**Commands** +``` +traceroute github.com +dig github.com +``` +**Output** +``` +traceroute not found; skipping. + +dig not found; skipping. +``` + +### 2.2 Packet Capture (DNS) +**Command** +``` +sudo timeout 10 tcpdump -c 5 -i any 'port 53' -nn +``` +**Output (sanitized)** +``` +tcpdump not found; skipping capture. +``` + +**One example DNS query from capture:** (no DNS query captured) + +### 2.3 Reverse DNS (PTR) +**Commands** +``` +dig -x 8.8.4.4 +dig -x 1.1.2.2 +``` +**Output** +``` +dig not found; skipping reverse lookups. + +dig not found; skipping reverse lookups. +``` + +**Comparison / Notes:** +- PTR for 8.8.4.4: +- PTR for 1.1.2.2: + +--- + +## Security Notes +1. IPs in packet capture sanitized (last octet `XXX`). +2. Avoided sensitive process names in analysis text. diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..e38d7f6 --- /dev/null +++ b/notes.txt @@ -0,0 +1 @@ +Notes