diff --git a/.gitignore b/.gitignore index 7946e3f..92aef27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1 @@ -/ssh-keys/id_ed25519 -/ssh-keys/id_ed25519.ppk -/ssh-keys/id_rsa -/ssh-keys/id_rsa.ppk +/ssh-keys diff --git a/docs/index.md b/docs/index.md index 445eb3d..81d1a48 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,6 +3,86 @@ layout: default title: Home --- -## Welcome to Custom SSH Server Docker +# Custom SSH Server Docker Setup -This is the landing page for our custom SSH server Docker project. +This repository contains a Docker setup for creating a custom SSH server based on Alpine Linux. The setup includes the ability to use static SSH host keys, configure SSH key and password authentication, and set up user-specific SSH key pairs. + +[![Build](https://github.com/haravich/custom-ssh-server/actions/workflows/docker-image.yml/badge.svg)](https://github.com/haravich/custom-ssh-server/actions/workflows/docker-image.yml) + +## Table of Contents + +- [Custom SSH Server Docker Setup](#custom-ssh-server-docker-setup) + - [Table of Contents](#table-of-contents) + - [Introduction](#introduction) + - [Prerequisites](#prerequisites) + - [Getting Started](#getting-started) + - [Usage](#usage) + - [Customization](#customization) + - [License](#license) + +## Introduction + +This project provides a Dockerized environment for creating a custom SSH server with the following features: + +- SSH key and password authentication +- User-specific SSH key pair generation + +## Prerequisites + +Before you begin, ensure you have the following installed: + +- Docker: Follow the official [Docker installation guide](https://docs.docker.com/get-docker/) to install Docker on your system. + +## Getting Started + +1. **Clone the Repository**: + + Clone this repository to your local machine: + + ```bash + git clone https://github.com/haravich/custom-ssh-server.git + cd custom-ssh-server + ``` + +2. **Customize Configuration**: + + Modify the setup-ssh-user.sh script to customize user creation and SSH key settings. + Place your public key in the ssh-keys directory (needed). + Customize the sshd_config file to adjust SSH server settings. + +3. **Build and Run**: + + Build the Docker image and run the container: + + ```bash + docker build -t custom-ssh-server . + docker run -d -p 2222:22 -e SSH_USER= -e SSH_PASSWORD= custom-ssh-server + + (or) + + docker run -d -p 2222:22 -e SSH_USER= -e SSH_PUBLIC_KEY=" || $(cat /ssh-keys/*.pub)" custom-ssh-server + + (or) + + docker run -d -p 2222:22 -e SSH_USER= -e SSH_PASSWORD= -e SSH_PUBLIC_KEY=" | $(cat /ssh-keys/*.pub)" custom-ssh-server + ``` + Replace , and with appropriate values. + +## Usage + +To connect to the SSH server: + +```bash +ssh -i /path/to/private_key_file -p 2222 @localhost +``` +Replace /path/to/private_key_file and with appropriate values. + +## Customization +* Adjust the SSH server settings in the sshd_config file. +* Customize the setup-ssh-user.sh script to modify user creation. + +## License +This project is licensed under the [MIT License](LICENSE.md). See the [LICENSE.md](LICENSE.md) file for details. +``` +Copy and paste this Markdown content into a file named README.md in the root of your repository. Feel free to adjust the formatting and content as needed for your project. +``` diff --git a/ssh-keys/id_ed25519.pub b/ssh-keys/id_ed25519.pub deleted file mode 100644 index b3035c7..0000000 --- a/ssh-keys/id_ed25519.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOsn8rHuoLekmpACn1yqlDfKQ9/SJvnLIBUeytcDWWC6 user@local diff --git a/ssh-keys/id_rsa.pub b/ssh-keys/id_rsa.pub deleted file mode 100644 index daa3718..0000000 --- a/ssh-keys/id_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDRc4cykJxHZATwOaadf7OEAsI/A5g2sKpgl/zg39iuE7nj3fZdYtxfrqoi2ekTpm58L7M7Civ00S/F3LqAGgq13K7q5Z6m4KZ4QSdK/gfUkcK1N4WpwhSkHJGEytooo5PxtOx38IrRBQ2VIJTM3zTnAF17XNSC1XgQKqwOgQKxT869oXZ92IWHyvgjTu1XwwVOK2nO/xV5ZZoNuSAU4+EyezQP60lnGPuvMMlge77KwkSWGjbNc5rxiESmWS3J+XyW87ctz336nqVbXgKMgNJeELIlSZfEdBRL1/7nNobpX9DL/WcN2sm07+u9lTXplSIVkwBB0IAuH6ZK81zVaXY5Njlb1FMTrDZ7Vpx8O6ajXJyWKSjVZUlLM+sXUI742WsR8C1yVGj2JWUOm6fa9ROnjsZmMM7muWOPD1aibL89AP34VPmblVf80+q4VAPmKyXisN8lgpd6tJ4HscMnL0quoJYFD4B0bfsUwUQcEPYZB7L+JjXnZ/HvD/tnVtZL3I8= user@local