gitsshsigning

package
v0.5.20-alpha.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HelperScript = `#!/bin/bash

devpod agent git-ssh-signature "$@"
`
	HelperScriptPath  = "/usr/local/bin/devpod-ssh-signature"
	GitConfigTemplate = `
[gpg "ssh"]
	program = devpod-ssh-signature
[gpg]
	format = ssh
[user]
	signingkey = %s
`
)
View Source
const (
	GPGFormatConfigKey       = "gpg.format"
	UsersSigningKeyConfigKey = "user.signingkey"
	GPGFormatSSH             = "ssh"
)

Variables

This section is empty.

Functions

func ConfigureHelper

func ConfigureHelper(userName, gitSigningKey string, log log.Logger) error

ConfigureHelper sets up the Git SSH signing helper script and updates the Git configuration for the specified user.

This function: - sets user.signingkey git config - creates a wrapper script for calling git-ssh-signature - users this script as gpg.ssh.program This is needed since git expects `gpg.ssh.program` to be an executable.

func ExtractGitConfiguration

func ExtractGitConfiguration() (string, string, error)

ExtractGitConfiguration is used for extracting values from users local .gitconfig that are needed to setup devpod-ssh-signature helper inside the workspace.

func HandleGitSSHProgramCall

func HandleGitSSHProgramCall(certPath, namespace, bufferFile string, log log.Logger) error

HandleGitSSHProgramCall implements logic handling call from git when signing a commit

func RemoveHelper

func RemoveHelper(userName string) error

RemoveHelper removes the git SSH signing helper script and any related configuration.

Types

type GitSSHSignatureRequest

type GitSSHSignatureRequest struct {
	Content string
	KeyPath string
}

func (*GitSSHSignatureRequest) Sign

Sign signs the content using the private key and returns the signature. This is intended to be a drop-in replacement for gpg.ssh.program for git, so we simply execute ssh-keygen in the same way as git would do locally.

type GitSSHSignatureResponse

type GitSSHSignatureResponse struct {
	Signature []byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL