Giter Site home page Giter Site logo

tokugero / hs-security-lessons Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 30.58 MB

A framework to deploy, manage, and curate security training modules for high school students.

License: GNU General Public License v3.0

Jinja 0.67% Dockerfile 0.23% Shell 0.03% Python 1.92% CSS 49.05% JavaScript 1.59% SCSS 40.11% HTML 5.66% HCL 0.73%

hs-security-lessons's Introduction

hs-security-lessons

A framework to deploy, manage, and curate security training modules for high school students.

The goal of this project is multi-fold, but focused around the central theme of removing toil from generating repeated infrastructure and customizing/tweaking resources for the purpose of teaching security concepts to high school students.

From the professor's perspective: One should be able to curate lesson plans, identify completed exercises, and quickly be able to identify student progress to maximize the time spent teaching while minimizing the red tape of multiple requests from multiple teams. (i.e. someone shouldn't spend time with IT, they should be doing what they're best at: teaching.)

From the student's perspective: One should be able to easily be able to access a curated lesson, understand the objectives, and complete the exercise with minimal touch points from the professor to maximize the value of time spent when that touch point is required. (i.e. someone shouldn't need admin support, but rather educational support.)

My personal goal is to demonstrate web infrastructure technologies to apply to common technical road-blocks in new and unnecessary ways.

Infrastructure Overview

A diagram showing service distribution: Service Distribution

A demonstration of the dashboard experience from the user's perspective. It shows a Jenkins trigger, created k8s resources, the generated Grafana Dashboard, the lesson README, and exposed endpoints at a glance. Dashboard Demo

A TL;DR of the Actual Infrastructure

The k8s service itself is just kubeadm created, 1 raspberry pi 5 with an SSD for a controller, and 3x SFF HP EliteDesk 800 Gen 1 for worker nodes. It's exposed with a Protectli hardware appliance running VyOS, and connected with a dumb 8 port switch.

The cluster is running several services to automate the infra provisioning, and can be scaled to real hardware using these same configurations:

  • MayaStor OpenEBS for storage
  • MetalLB for load balancing
  • KubeVirt for importing and exporting KVM VMs
  • Prometheus for cluster monitoring
  • InfluxDB for every other monitoring
  • CoreDNS/Flannel for DNS and networking

Current State

The majority of infrastructure is deployed via Ansible and services must be discovered (provisioned through DHCP and MetalLB) manually for the time being. VyOS/External Routing must be configured manually, a running configuration can be found in ./manual-configs

Jenkins is configured to do the following:

  • Deploy on-demand kustomize manifests to the cluster based on k8s manifests in the cluster gitea instance.
  • Cleanup of resources when queried.
  • Auto-triggers a rebuild of custom container images whenever a Dockerfile is updated in the gitea instance.

A custom dashboard exposes these features:

  • User management interface to control admin (teacher) and student (student) access.
  • Cluster cleanup interface to remove all resources from the cluster after lessons complete.
  • Lesson management interface to deploy and manage lessons.
  • Link generator to provide students with a unique link to access their cluster resources and remote access.
  • Auto-generated lesson dashboards via gitea READMEs.

To generate the secrets vault for managing ansible, one can run the following commands after copying the vault.yml.sample to vault.yml:

ansible-vault create --vault-id credentials@prompt ansible/group_vars/all/vault.yml
ansible all --ask-vault-pass -i inventory -m debug -a "msg='User: {{ ansible_user }} / Password: {{ ansible_password }}'"

create vault password in ~/.ansible/credentials; chmod 0600

To run the playbooks, one can run the following commands:

# Build the linux nodes
ansible-playbook -i inventory roles/linux/tasks/main.yml

# Configure the cluster
ansible-playbook -i inventory roles/kubernetes/main.yml

Interfacing With The Non-Lesson Based Features Of This Cluster

accessing raw cluster components

  1. Ansible will have provisioned an admin kubeconfig in your ~/.kube/config.hscluster file. You can use this to access with the following tools:
  2. Export the kubeconfig to your environment with export KUBECONFIG=~/.kube/config.hscluster to use any of these tools.

Ubuntu Vm Base Prep For Kubevirt

Future iterations will include Jenkins pipelines to automate this process and export VMs to an easily reachable location.

  1. install ubuntu desktop

  2. give user/pass ubuntu:ubuntu

  3. install openssh-server

  4. run playbook

  5. install qemu-utils locally

  6. ensure vhdx is merged properly and not split into snapshot layers

  7. run qemu-img convert -f vhdx -O qcow2 ubuntu-vm-base.vhdx ubuntu-vm-base.qcow2

  8. install virtctl

        export VERSION=v0.41.0
        wget https://github.com/kubevirt/kubevirt/releases/download/${VERSION}/virtctl-${VERSION}-linux-amd64
    
  9. Add port forward 18443:8443 to uploadproxy.

  10. upload image

        virtctl image-upload dv ubuntu-base --namespace kubevirt-images --size=20Gi --image-path ../images/ubuntu.qcow2 --uploadproxy-url=https://127.0.0.1:18443 --insecure --access-mode ReadWriteOnce --volume-mode filesystem
    

Updating and Deploying Lessons

Future iterations will include a webgui of a vscode-like interface to help with this process.

  1. Browse to the gitea instance and navigate to the lesson you wish to update.
  2. Update it in the gitea instance or clone the repository and work on it locally.

Updating and Deploying the Dashboard

Future iterations will auto-deploy this into the cluster.

  1. Browse to the GITHUB registry, and update accordingly.
  2. Manually docker build and docker push to the in-cluster registry.

hs-security-lessons's People

Contributors

tokugero avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.