Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
version: 2

project_name: adfssh

before:
hooks:
- go mod tidy
Expand All @@ -18,7 +20,7 @@ builds:
env:
- CGO_ENABLED=0
main: .
binary: bssh
binary: adfssh
ldflags:
- -s
- -w
Expand All @@ -35,7 +37,7 @@ builds:

archives:
- id: default
name_template: "bssh-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}-{{ .Mips }}{{ end }}"
name_template: "adfssh-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}-{{ .Mips }}{{ end }}"
ids:
- default
wrap_in_directory: true
Expand All @@ -49,18 +51,22 @@ checksum:
name_template: "checksums.txt"

nfpms:
- file_name_template: "bssh-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}-{{ .Mips }}{{ end }}"
- file_name_template: "adfssh-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}-{{ .Mips }}{{ end }}"
vendor: adfinis
homepage: "https://github.com/adfinis/bssh"
homepage: "https://github.com/adfinis/adfssh"
maintainer: "jonahz <jonah.zuercher@adfinis.com>"
description: "SSH client for the Bastion"
description: "Adfinis SSH client for the Bastion"
license: "GPLv3"
formats:
- deb
- rpm
- archlinux
dependencies:
- openssh-client
replaces:
- bssh
conflicts:
- bssh
contents:
- src: ./completions/{{ .ProjectName }}.bash
dst: /etc/bash_completion.d/{{ .ProjectName }}
Expand All @@ -79,14 +85,19 @@ nfpms:
- openssh

aurs:
- name: "bssh-bin"
homepage: "https://github.com/adfinis/bssh"
description: "SSH client for the Bastion"
- name: "adfssh-bin"
homepage: "https://github.com/adfinis/adfssh"
description: "Adfinis SSH client for the Bastion"
maintainers:
- "jonahz <jonah.zuercher@adfinis.com>"
license: "GPL3"
private_key: "{{ .Env.AUR_KEY }}"
git_url: "ssh://aur@aur.archlinux.org/bssh-bin.git"
git_url: "ssh://aur@aur.archlinux.org/adfssh-bin.git"
provides:
- adfssh
conflicts:
- adfssh
- bssh-bin
depends:
- openssh
package: |-
Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# BSSH
# adfssh

SSH for The Bastion with fancy autocompletion and OTP callback support.

> **Note:** this project was previously called `bssh` and was renamed to
> `adfssh` to avoid a name clash with the `bssh` tool shipped by avahi.

## Build / Install

```bash
Expand All @@ -12,26 +15,26 @@ go build .
go install .

# Arch (btw):
yay -S bssh-bin
yay -S adfssh-bin

# Other linux distros might find a more suitable solution in the release tab of this repository
```

## Usage

```
bssh [flags] -- <command>
adfssh [flags] -- <command>
```

## Configuration

bssh looks for a `config.yml` file in the following locations (in order):
adfssh looks for a `config.yml` file in the following locations (in order):

1. Current directory (`.`)
2. `$XDG_CONFIG_HOME/bssh/`
3. `/etc/bssh/`
2. `$XDG_CONFIG_HOME/adfssh/`
3. `/etc/adfssh/`

All config values can be overridden with environment variables using the `BSSH_` prefix (e.g. `BSSH_USERNAME`).
All config values can be overridden with environment variables using the `ADFSSH_` prefix (e.g. `ADFSSH_USERNAME`).

### Options

Expand Down Expand Up @@ -66,7 +69,7 @@ otp_callback_command: ykman oath accounts code "Bastion" | cut -d" " -f3

### OpenBao certificate example

When `openbao.enabled` is set, bssh asks the OpenBao SSH secrets engine to sign
When `openbao.enabled` is set, adfssh asks the OpenBao SSH secrets engine to sign
the configured public key and logs in to the bastion with the resulting
short-lived certificate (passed to `ssh` via `CertificateFile`/`IdentityFile`).

Expand Down
6 changes: 3 additions & 3 deletions completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"strings"

"github.com/adfinis/bastion-go"
"github.com/adfinis/bssh/config"
"github.com/adfinis/bssh/openbao"
"github.com/adfinis/bssh/otp"
"github.com/adfinis/adfssh/config"
"github.com/adfinis/adfssh/openbao"
"github.com/adfinis/adfssh/otp"
"github.com/samber/lo"
"github.com/spf13/cobra"
)
Expand Down
8 changes: 4 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func GetViper() *viper.Viper {
func init() {
setDefaults(v)
v.SetConfigType("yaml")
v.SetEnvPrefix("BSSH")
v.SetEnvPrefix("ADFSSH")
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
v.AutomaticEnv()
}
Expand All @@ -56,8 +56,8 @@ func Load(path string) (*Config, error) {
} else {
v.SetConfigName("config")
v.AddConfigPath(".")
v.AddConfigPath(filepath.Join(xdg.ConfigHome, "bssh"))
v.AddConfigPath("/etc/bssh")
v.AddConfigPath(filepath.Join(xdg.ConfigHome, "adfssh"))
v.AddConfigPath("/etc/adfssh")
}

if err := v.ReadInConfig(); err != nil {
Expand Down Expand Up @@ -93,7 +93,7 @@ func setDefaults(v *viper.Viper) {

func validateConfig(c *Config) error {
if c == nil {
return fmt.Errorf("missing bssh config")
return fmt.Errorf("missing adfssh config")
}

if c.Username == "" {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/adfinis/bssh
module github.com/adfinis/adfssh

go 1.25.6

Expand Down
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"syscall"
"time"

"github.com/adfinis/bssh/config"
"github.com/adfinis/bssh/openbao"
"github.com/adfinis/bssh/otp"
"github.com/adfinis/adfssh/config"
"github.com/adfinis/adfssh/openbao"
"github.com/adfinis/adfssh/otp"
"github.com/charmbracelet/fang"
"github.com/charmbracelet/log"
"github.com/creack/pty"
Expand All @@ -25,7 +25,7 @@ import (
)

var (
// Version is the current version of bssh.
// Version is the current version of adfssh.
Version = "devel"
// Commit is the git commit hash of the current version.
Commit = "none"
Expand All @@ -39,7 +39,7 @@ var rootCmdFlags struct {
}

var rootCmd = &cobra.Command{
Use: "bssh [flags] [host] [-- extra-ssh-args...]",
Use: "adfssh [flags] [host] [-- extra-ssh-args...]",
Short: "SSH for The Bastion with fancy autocompletion and OTP callback support",
Args: cobra.ArbitraryArgs,
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
Expand Down
4 changes: 2 additions & 2 deletions openbao/openbao.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

bastion "github.com/adfinis/bastion-go"
"github.com/adfinis/bssh/config"
"github.com/adfinis/adfssh/config"
bao "github.com/openbao/openbao/api/v2"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/agent"
Expand Down Expand Up @@ -75,7 +75,7 @@ func (s *SignedCert) Write(cfg *config.Config) (string, func(), error) {
return path, func() {}, nil
}

f, err := os.CreateTemp("", "bssh-cert-*.pub")
f, err := os.CreateTemp("", "adfssh-cert-*.pub")
if err != nil {
return "", nil, fmt.Errorf("failed to create temporary certificate file: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion otp/otp.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"

bastion "github.com/adfinis/bastion-go"
"github.com/adfinis/bssh/config"
"github.com/adfinis/adfssh/config"
)

// NewCallback returns a function that executes the configured OTP shell command
Expand Down
2 changes: 1 addition & 1 deletion otp/otp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package otp
import (
"testing"

"github.com/adfinis/bssh/config"
"github.com/adfinis/adfssh/config"
"github.com/stretchr/testify/assert"
)

Expand Down