Skip to content

Commit

Permalink
feat: restructure project and fix vault/sdk version
Browse files Browse the repository at this point in the history
Signed-off-by: Harald Hoyer <[email protected]>
  • Loading branch information
renovate[bot] authored and haraldh committed Feb 12, 2024
1 parent 518b1bc commit 0f94b4c
Show file tree
Hide file tree
Showing 14 changed files with 655 additions and 300 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go --mount
mkdir -p /go/src/github.com/matter-labs/vault-auth-tee; \
cd /go/src/github.com/matter-labs/vault-auth-tee; \
rsync -a --delete-after /data/ ./ ; \
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o vault-auth-tee; \
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o vault-auth-tee cmd/vault-auth-tee/main.go ; \
mkdir -p /opt/vault/plugins; \
cp vault-auth-tee /opt/vault/plugins/vault-auth-tee; \
:
Expand Down
6 changes: 2 additions & 4 deletions tee/backend.go → backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
// Copyright (c) HashiCorp, Inc.
// Copyright (c) Matter Labs

package tee
package vault_auth_tee

import (
"context"
"github.com/matter-labs/vault-auth-tee/version"

"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/logical"
)
Expand Down Expand Up @@ -39,7 +37,7 @@ func Backend() *backend {
},
AuthRenew: b.loginPathWrapper(b.pathLoginRenew),
BackendType: logical.TypeCredential,
RunningVersion: "v" + version.Version,
RunningVersion: "v" + Version,
}

return &b
Expand Down
2 changes: 1 addition & 1 deletion tee/backend_test.go → backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) HashiCorp, Inc.
// Copyright (c) Matter Labs

package tee
package vault_auth_tee

import (
"context"
Expand Down
5 changes: 2 additions & 3 deletions main.go → cmd/vault-auth-tee/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
package main

import (
"github.com/matter-labs/vault-auth-tee"
"os"

hclog "github.com/hashicorp/go-hclog"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/sdk/plugin"

"github.com/matter-labs/vault-auth-tee/tee"
)

func main() {
Expand All @@ -23,7 +22,7 @@ func main() {
tlsProviderFunc := api.VaultPluginTLSProvider(tlsConfig)

if err := plugin.ServeMultiplex(&plugin.ServeOpts{
BackendFactoryFunc: tee.Factory,
BackendFactoryFunc: vault_auth_tee.Factory,
// set the TLSProviderFunc so that the plugin maintains backwards
// compatibility with Vault versions that don’t support plugin AutoMTLS
TLSProviderFunc: tlsProviderFunc,
Expand Down
170 changes: 110 additions & 60 deletions go.mod

Large diffs are not rendered by default.

746 changes: 529 additions & 217 deletions go.sum

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions tee/path_info.go → path_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
// Copyright (c) HashiCorp, Inc.
// Copyright (c) Matter Labs

package tee
package vault_auth_tee

import (
"context"

"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/logical"

"github.com/matter-labs/vault-auth-tee/version"
)

func pathInfo(b *backend) *framework.Path {
Expand All @@ -33,8 +31,8 @@ get help.
func (b *backend) pathInfoRead(ctx context.Context, req *logical.Request, _ *framework.FieldData) (*logical.Response, error) {
return &logical.Response{
Data: map[string]interface{}{
"name": version.Name,
"version": version.Version,
"name": Name,
"version": Version,
},
}, nil
}
5 changes: 2 additions & 3 deletions tee/path_login.go → path_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) HashiCorp, Inc.
// Copyright (c) Matter Labs

package tee
package vault_auth_tee

import (
"bytes"
Expand All @@ -14,15 +14,14 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/matter-labs/vault-auth-tee/ratee"
"strings"
"time"

"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/helper/cidrutil"
"github.com/hashicorp/vault/sdk/helper/policyutil"
"github.com/hashicorp/vault/sdk/logical"

"github.com/matter-labs/vault-auth-tee/ratee"
)

var timeNowFunc = time.Now
Expand Down
2 changes: 1 addition & 1 deletion tee/path_login_test.go → path_login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) HashiCorp, Inc.
// Copyright (c) Matter Labs

package tee
package vault_auth_tee

import (
"context"
Expand Down
5 changes: 2 additions & 3 deletions tee/path_tees.go → path_tees.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
// Copyright (c) HashiCorp, Inc.
// Copyright (c) Matter Labs

package tee
package vault_auth_tee

import "C"
import (
"context"
"encoding/hex"
"fmt"
"github.com/matter-labs/vault-auth-tee/ratee"
"strings"
"time"

"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/helper/tokenutil"
"github.com/hashicorp/vault/sdk/logical"

"github.com/matter-labs/vault-auth-tee/ratee"
)

func pathListTees(b *backend) *framework.Path {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tee/test_responder.go → test_responder.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//
// From https://github.com/cloudflare/cfssl/blob/master/ocsp/responder.go

package tee
package vault_auth_tee

import (
"crypto"
Expand Down
2 changes: 1 addition & 1 deletion version/version.go → version.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) Matter Labs

package version
package vault_auth_tee

const Version = "0.1.0+dev"
const Name = "vault-auth-tee"

0 comments on commit 0f94b4c

Please sign in to comment.