- 📘 Introduction
- 💻 System Requirements
- 🚀 Installation
- 🧩 Components
- 🔧 Usage
- 🛡️ Security Considerations
- 🐞 Troubleshooting
- 🎨 Customization
HiveLab is an easy-to-deploy lab system that provides isolated environments for users on a shared host. It uses Docker containers to create separate workspaces for each user, allowing them to work in their own environment without affecting others or the host system.
- Ubuntu-based Linux distribution (tested on Ubuntu 20.04 LTS and newer)
- Supported architectures: amd64 or arm64
- Sudo privileges for installation
- SSH server installed and running
- Internet connection for package downloads
- Download the installation script to your server.
- Make the script executable:
chmod +x install_hivelab.sh
- Run the script with sudo privileges:
sudo ./install_hivelab.sh
- The script will automatically:
- Update and upgrade system packages
- Install necessary dependencies (jq, docker.io)
- Set up Docker permissions
- Create required directories and scripts
- Modify SSH configuration
- Restart the SSH service
After installation, you may need to log out and log back in for group changes to take effect.
HiveLab consists of several components:
-
on-login.sh: This script runs when a user logs in via SSH. It starts or ensures the user's container is running and then executes an interactive bash session inside the container.
-
manage_container.sh: This script manages user containers (start, stop, remove).
-
Docker containers: Each user gets their own Docker container based on the Ubuntu image.
-
Modified SSH configuration: Forces the execution of the on-login script for non-root users.
- To access HiveLab:
ssh user@host
- To bypass HiveLab and get a regular shell:
ssh user@host bypass
- To manage a user's container:
/opt/hivelab/manage_container.sh username [start|stop|remove]
- Each user is isolated in their own container.
- Users have sudo access within their containers but not on the host system.
- The Docker socket is mounted in user containers, which could be a potential security risk if users are not trusted.
- If a user can't access their container, ensure the Docker service is running:
sudo systemctl status docker
- Check container status:
docker ps -a
- Review logs:
docker logs hivelab-username
To customize the user environment:
- Modify the
manage_container.sh
script to add additional setup steps or install more packages. - Change the base image in
manage_container.sh
fromubuntu:latest
to a custom image with pre-installed tools. - Adjust resource limits by adding Docker run options in
manage_container.sh
.
Remember to test thoroughly after making any changes.