mirror of
https://github.com/house-of-vanity/khm.git
synced 2025-08-21 14:27:14 +00:00
Disabled musl build
This commit is contained in:
122
.github/workflows/main.yml
vendored
122
.github/workflows/main.yml
vendored
@@ -17,10 +17,10 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
build_target: x86_64-unknown-linux-musl
|
||||
platform_name: linux-amd64-musl
|
||||
build_type: musl
|
||||
# - os: ubuntu-latest
|
||||
# build_target: x86_64-unknown-linux-musl
|
||||
# platform_name: linux-amd64-musl
|
||||
# build_type: musl
|
||||
- os: ubuntu-latest
|
||||
build_target: x86_64-unknown-linux-gnu
|
||||
platform_name: linux-amd64
|
||||
@@ -77,16 +77,16 @@ jobs:
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.build_type == 'dynamic'
|
||||
run: cargo build --target ${{ matrix.build_target }} --release
|
||||
|
||||
- name: Build Linux MUSL (no GUI)
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.build_type == 'musl'
|
||||
uses: gmiam/rust-musl-action@master
|
||||
with:
|
||||
args: |
|
||||
sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list
|
||||
sed -i 's/security.debian.org/archive.debian.org/g' /etc/apt/sources.list
|
||||
sed -i '/buster-updates/d' /etc/apt/sources.list
|
||||
apt-get update && apt-get install -y pkg-config
|
||||
cargo build --target ${{ matrix.build_target }} --release --no-default-features --features server
|
||||
# - name: Build Linux MUSL (no GUI)
|
||||
# if: matrix.os == 'ubuntu-latest' && matrix.build_type == 'musl'
|
||||
# uses: gmiam/rust-musl-action@master
|
||||
# with:
|
||||
# args: |
|
||||
# sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list
|
||||
# sed -i 's/security.debian.org/archive.debian.org/g' /etc/apt/sources.list
|
||||
# sed -i '/buster-updates/d' /etc/apt/sources.list
|
||||
# apt-get update && apt-get install -y pkg-config
|
||||
# cargo build --target ${{ matrix.build_target }} --release --no-default-features --features server
|
||||
|
||||
- name: Build MacOS
|
||||
if: matrix.os == 'macos-latest'
|
||||
@@ -133,8 +133,8 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
platform_name: linux-amd64-musl
|
||||
# - os: ubuntu-latest
|
||||
# platform_name: linux-amd64-musl
|
||||
- os: ubuntu-latest
|
||||
platform_name: linux-amd64
|
||||
- os: windows-latest
|
||||
@@ -172,49 +172,49 @@ jobs:
|
||||
asset_name: ${{ env.BINARY_NAME }}_${{ matrix.platform_name }}${{ matrix.platform_name == 'windows-amd64' && '.exe' || '' }}
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
build_docker:
|
||||
name: Build and Publish Docker Image
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
name: Download Linux MUSL artifact
|
||||
with:
|
||||
name: ${{ env.BINARY_NAME }}_linux-amd64-musl
|
||||
path: .
|
||||
|
||||
- name: ls
|
||||
run: |
|
||||
ls -lah
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ultradesu
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Set exec flag
|
||||
run: |
|
||||
chmod +x ${{ env.BINARY_NAME }}
|
||||
|
||||
- name: Set outputs
|
||||
id: get_tag
|
||||
run: |
|
||||
echo "tag=$(echo ${GITHUB_REF} | cut -d'/' -f3)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ultradesu/${{ env.BINARY_NAME }}:latest,ultradesu/${{ env.BINARY_NAME }}:${{ steps.get_tag.outputs.tag }}
|
||||
# build_docker:
|
||||
# name: Build and Publish Docker Image
|
||||
# needs: build
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
#
|
||||
# - uses: actions/download-artifact@v4
|
||||
# name: Download Linux MUSL artifact
|
||||
# with:
|
||||
# name: ${{ env.BINARY_NAME }}_linux-amd64-musl
|
||||
# path: .
|
||||
#
|
||||
# - name: ls
|
||||
# run: |
|
||||
# ls -lah
|
||||
#
|
||||
# - name: Set up Docker Buildx
|
||||
# uses: docker/setup-buildx-action@v3
|
||||
#
|
||||
# - name: Set up QEMU
|
||||
# uses: docker/setup-qemu-action@v3
|
||||
#
|
||||
# - name: Login to Docker Hub
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# username: ultradesu
|
||||
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
#
|
||||
# - name: Set exec flag
|
||||
# run: |
|
||||
# chmod +x ${{ env.BINARY_NAME }}
|
||||
#
|
||||
# - name: Set outputs
|
||||
# id: get_tag
|
||||
# run: |
|
||||
# echo "tag=$(echo ${GITHUB_REF} | cut -d'/' -f3)" >> $GITHUB_OUTPUT
|
||||
#
|
||||
# - name: Build and push Docker image
|
||||
# uses: docker/build-push-action@v5
|
||||
# with:
|
||||
# context: .
|
||||
# platforms: linux/amd64,linux/arm64
|
||||
# push: true
|
||||
# tags: ultradesu/${{ env.BINARY_NAME }}:latest,ultradesu/${{ env.BINARY_NAME }}:${{ steps.get_tag.outputs.tag }}
|
||||
|
||||
|
173
README.MD
173
README.MD
@@ -1,65 +1,164 @@
|
||||
# KHM - Known Hosts Manager
|
||||
|
||||
KHM allows you to synchronize the `known_hosts` file across multiple hosts. This application manages SSH keys and flows, either as a server or client. In server mode, it stores keys and flows in a PostgreSQL database. In client mode, it sends keys to the server and can update the `known_hosts` file with keys from the server.
|
||||
KHM is a comprehensive SSH key management tool that allows you to synchronize `known_hosts` files across multiple hosts and environments. The application supports multiple operation modes: server mode for centralized key storage, client mode for synchronization, and GUI mode for easy management.
|
||||
|
||||
## Features
|
||||
|
||||
- Synchronize `known_hosts` file across multiple hosts.
|
||||
- Manage SSH keys and flows in a PostgreSQL database.
|
||||
- Operate in both server and client modes.
|
||||
- Automatically update `known_hosts` file with keys from the server.
|
||||
- **Multi-mode operation**: Server, client, and GUI modes
|
||||
- **Centralized key management**: Store SSH keys and flows in PostgreSQL database
|
||||
- **Cross-platform GUI**: Modern tray application with settings window
|
||||
- **Automatic synchronization**: Keep `known_hosts` files updated across environments
|
||||
- **Flow-based organization**: Manage different environments (production, staging, development)
|
||||
- **Authentication support**: Basic authentication for secure API access
|
||||
- **Real-time monitoring**: Auto-sync capabilities with configurable intervals
|
||||
|
||||
## Usage
|
||||
## Operation Modes
|
||||
|
||||
### Server Mode
|
||||
|
||||
To run the application in server mode, use the following command:
|
||||
Runs a web server that stores and manages SSH keys in a PostgreSQL database.
|
||||
|
||||
```bash
|
||||
khm --server --ip 127.0.0.1 --port 8080 --db-host 127.0.0.1 --db-name khm --db-user admin --db-password <SECRET> --flows work,home
|
||||
khm --server --ip 0.0.0.0 --port 1337 --db-host psql.psql.svc --db-name khm --db-user admin --db-password <SECRET> --flows work,home
|
||||
```
|
||||
|
||||
### Client Mode
|
||||
|
||||
To run the application in client mode, use the following command:
|
||||
Connects to a KHM server to send local keys and optionally sync the `known_hosts` file.
|
||||
|
||||
```bash
|
||||
khm --host http://khm.example.com:8080/<FLOW_NAME>/ --known-hosts ~/.ssh/known_hosts --in-place
|
||||
khm --host https://khm.example.com --flow work --known-hosts ~/.ssh/known_hosts --in-place
|
||||
```
|
||||
|
||||
### Arguments
|
||||
Options:
|
||||
- `--server` Run in server mode
|
||||
- `--in-place` Server mode: Sync the known_hosts file with keys from the server
|
||||
- `--flows <FLOWS>...` Server mode: Comma-separated list of flows to manage [default: default]
|
||||
- `-i, --ip <IP>` Server mode: IP address to bind the server to [default: 127.0.0.1]
|
||||
- `-p, --port <PORT>` Server mode: Port to bind the server to [default: 8080]
|
||||
- `--db-host <DB_HOST>` Server mode: Hostname or IP address of the PostgreSQL database [default: 127.0.0.1]
|
||||
- `--db-name <DB_NAME>` Server mode: Name of the PostgreSQL database [default: khm]
|
||||
- `--db-user <DB_USER>` Server mode: Username for the PostgreSQL database
|
||||
- `--db-password <DB_PASSWORD>` Server mode: Password for the PostgreSQL database
|
||||
- `--basic-auth <BASIC_AUTH>` Client mode: Basic Auth credentials [default: ""]
|
||||
- `--host <HOST>` Client mode: Full host address of the server to connect to. Like `https://khm.example.com/<FLOW_NAME>`
|
||||
- `--known-hosts <KNOWN_HOSTS>` Client mode: Path to the known_hosts file [default: ~/.ssh/known_hosts]
|
||||
### GUI Mode
|
||||
Launches a system tray application with a modern interface for easy management.
|
||||
|
||||
```bash
|
||||
# Run tray application
|
||||
khm --gui
|
||||
|
||||
# Run settings window only
|
||||
khm --settings-ui
|
||||
```
|
||||
|
||||
## Command Line Arguments
|
||||
|
||||
### General Options
|
||||
- `--server` - Run in server mode
|
||||
- `--gui` - Run with GUI tray interface
|
||||
- `--settings-ui` - Run settings UI window (used with --gui)
|
||||
|
||||
### Server Mode Options
|
||||
- `-i, --ip <IP>` - IP address to bind the server to [default: 127.0.0.1]
|
||||
- `-p, --port <PORT>` - Port to bind the server to [default: 8080]
|
||||
- `--flows <FLOWS>` - Comma-separated list of flows to manage [default: default]
|
||||
- `--db-host <DB_HOST>` - PostgreSQL database hostname [default: 127.0.0.1]
|
||||
- `--db-name <DB_NAME>` - PostgreSQL database name [default: khm]
|
||||
- `--db-user <DB_USER>` - PostgreSQL database username (required)
|
||||
- `--db-password <DB_PASSWORD>` - PostgreSQL database password (required)
|
||||
|
||||
### Client Mode Options
|
||||
- `--host <HOST>` - Server URL (e.g., https://khm.example.com) (required)
|
||||
- `--flow <FLOW>` - Flow name to use on the server (required)
|
||||
- `--known-hosts <PATH>` - Path to known_hosts file [default: ~/.ssh/known_hosts]
|
||||
- `--in-place` - Update known_hosts file with server keys after sync
|
||||
- `--basic-auth <CREDENTIALS>` - Basic authentication (format: user:pass)
|
||||
|
||||
## GUI Features
|
||||
|
||||
The GUI mode provides:
|
||||
|
||||
- **System Tray Integration**: Runs quietly in the system tray
|
||||
- **Settings Management**: Easy configuration through modern UI
|
||||
- **Connection Testing**: Built-in server connectivity testing
|
||||
- **Manual Synchronization**: On-demand sync operations
|
||||
- **Auto-sync Configuration**: Configurable automatic synchronization intervals
|
||||
- **Operation Logging**: Real-time activity monitoring
|
||||
- **Cross-platform Paths**: Automatic path handling for different operating systems
|
||||
|
||||
## Installation
|
||||
|
||||
1. Ensure you have Rust installed. If not, you can install it from [rustup.rs](https://rustup.rs/).
|
||||
### From Binary Releases
|
||||
Download the latest binary from the [Releases](https://github.com/house-of-vanity/khm/releases) page.
|
||||
|
||||
### From Source
|
||||
1. Install Rust from [rustup.rs](https://rustup.rs/)
|
||||
2. Clone the repository:
|
||||
```bash
|
||||
git clone https://github.com/house-of-vanity/khm.git
|
||||
cd khm
|
||||
```
|
||||
3. Run the project:
|
||||
```bash
|
||||
cargo run --release -- --help
|
||||
```
|
||||
```bash
|
||||
git clone https://github.com/house-of-vanity/khm.git
|
||||
cd khm
|
||||
```
|
||||
3. Build and run:
|
||||
```bash
|
||||
# Build with GUI support (default)
|
||||
cargo build --release
|
||||
|
||||
# Build server-only version
|
||||
cargo build --release --no-default-features --features server
|
||||
```
|
||||
|
||||
### System Dependencies
|
||||
For GUI features on Linux:
|
||||
```bash
|
||||
sudo apt-get install libgtk-3-dev libglib2.0-dev libcairo2-dev libpango1.0-dev libatk1.0-dev libgdk-pixbuf2.0-dev
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### GUI Configuration
|
||||
Settings are automatically saved to:
|
||||
- **Windows**: `%USERPROFILE%\.khm\khm_config.json`
|
||||
- **macOS**: `~/.khm/khm_config.json`
|
||||
- **Linux**: `~/.khm/khm_config.json`
|
||||
|
||||
### Example Configuration
|
||||
```json
|
||||
{
|
||||
"host": "https://khm.example.com",
|
||||
"flow": "production",
|
||||
"known_hosts": "/home/user/.ssh/known_hosts",
|
||||
"basic_auth": "",
|
||||
"in_place": true,
|
||||
"auto_sync_interval_minutes": 60
|
||||
}
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Complete Server Setup
|
||||
```bash
|
||||
# Start server with multiple flows
|
||||
khm --server \
|
||||
--ip 0.0.0.0 \
|
||||
--port 8080 \
|
||||
--db-host localhost \
|
||||
--db-name khm \
|
||||
--db-user khm_user \
|
||||
--db-password secure_password \
|
||||
--flows production,staging,development
|
||||
```
|
||||
|
||||
### Client Synchronization
|
||||
```bash
|
||||
# Send keys and update local known_hosts
|
||||
khm --host https://khm.company.com \
|
||||
--flow production \
|
||||
--known-hosts ~/.ssh/known_hosts \
|
||||
--in-place \
|
||||
--basic-auth "username:password"
|
||||
```
|
||||
|
||||
### GUI Usage
|
||||
```bash
|
||||
# Launch tray application
|
||||
khm --gui
|
||||
|
||||
# Open settings window directly
|
||||
khm --settings-ui
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome! Please open an issue or submit a pull request for any changes.
|
||||
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the WTFPL License.
|
||||
This project is licensed under the WTFPL License - see the [LICENSE](LICENSE) file for details.
|
Reference in New Issue
Block a user