Skip to content

Commit

Permalink
chore: migrate from previous repository
Browse files Browse the repository at this point in the history
  • Loading branch information
yankeguo committed Jul 23, 2024
0 parents commit e7802f7
Show file tree
Hide file tree
Showing 67 changed files with 14,172 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/ui/.nuxt
/ui/node_modules
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: release

on:
workflow_dispatch: {}
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
- name: checkout
uses: actions/checkout@v3
with:
submodules: recursive

- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: "pnpm"
cache-dependency-path: "ui/pnpm-lock.yaml"

- run: pnpm install
working-directory: ui

- run: pnpm run generate
working-directory: ui

- name: docker-setup
uses: docker/setup-buildx-action@v2

- name: docker-login-ghcr
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: docker-login-dockerhub
uses: docker/login-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: docker-meta
id: meta
uses: docker/metadata-action@v4
with:
images: |-
ghcr.io/${{ github.repository }}
${{ github.repository }}
tags: |-
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=pr,enable=${{ github.event_name == 'pull_request' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
- name: docker-build-and-push
id: build-and-push
uses: docker/build-push-action@v3
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
pull: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work

# Binary
/bunker

# Data
/bunker.yaml
/database.sqlite3
/users.yaml
/ssh_host_*_key
/ssh_client_*_key
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM golang:1.21 AS builder
ENV CGO_ENABLED 0
ARG VERSION
WORKDIR /go/src/app
ADD . .
RUN go build -o /bunker ./cmd/bunker

FROM debian:12

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y locales locales-all tzdata ca-certificates docker.io tini && \
rm -rf /var/lib/apt/lists/*

EXPOSE 8080

COPY --from=builder /bunker /bunker

WORKDIR /data

ENTRYPOINT [ "tini", "--" ]

CMD ["/bunker"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Yanke G.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# bunker

A simple bastion system for linux hosts

## Installation

### From Binary

Visit [GitHub Releases](https://github.com/yankeguo/bunker/releases) and download the latest release.

Static assets are embedded in the binary, so you don't need to download anything else.

- Prepare a `data` directory and put `bunker.yaml` configuration file in it
- Run `bunker --data-dir data`

### From Container Image

Visit [DockerHub Repository](https://hub.docker.com/repository/docker/yankeguo/bunker) or [GitHub Packages](https://github.com/yankeguo?tab=packages&repo_name=bunker) for container images

- Prepare a `data` directory and put `bunker.yaml` configuration file in it
- Run contaienr image with `/data` mounted, `docker run -p 8080:8080 -p 8022:8022 -v $PWD/data:/data yankeguo/bunker:latest`

## Initial Users

Put a `users.yaml` file in `data-dir` to initialize the system with users.

```yaml
username: yanke
password: qwerty
is_admin: true
update_existing: true
---
username: guest
password: guest
```
## Configuration File
```yaml
server:
listen: ":8080"
ssh_server:
listen: ":8022"
```
## Credits
GUO YANKE, MIT License
Loading

0 comments on commit e7802f7

Please sign in to comment.