mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 19:47:54 +00:00
Vault SSH: Exposed verify request/response messges to agent
This commit is contained in:
@@ -16,8 +16,16 @@ import (
|
|||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Default path at which SSH backend will be mounted
|
const (
|
||||||
const SSHAgentDefaultMountPoint = "ssh"
|
// Default path at which SSH backend will be mounted
|
||||||
|
SSHAgentDefaultMountPoint = "ssh"
|
||||||
|
|
||||||
|
// Echo request message sent as OTP by the agent
|
||||||
|
VerifyEchoRequest = "verify-echo-request"
|
||||||
|
|
||||||
|
// Echo response message sent as a response to OTP matching echo request
|
||||||
|
VerifyEchoResponse = "verify-echo-response"
|
||||||
|
)
|
||||||
|
|
||||||
// This is a structure representing an SSH agent which can talk to vault server
|
// This is a structure representing an SSH agent which can talk to vault server
|
||||||
// in order to verify the OTP entered by the user. It contains the path at which
|
// in order to verify the OTP entered by the user. It contains the path at which
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
package ssh
|
package ssh
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/hashicorp/vault/api"
|
||||||
"github.com/hashicorp/vault/logical"
|
"github.com/hashicorp/vault/logical"
|
||||||
"github.com/hashicorp/vault/logical/framework"
|
"github.com/hashicorp/vault/logical/framework"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
VerifyEchoRequest = "verify-echo-request"
|
|
||||||
VerifyEchoResponse = "verify-echo-response"
|
|
||||||
)
|
|
||||||
|
|
||||||
func pathVerify(b *backend) *framework.Path {
|
func pathVerify(b *backend) *framework.Path {
|
||||||
return &framework.Path{
|
return &framework.Path{
|
||||||
Pattern: "verify",
|
Pattern: "verify",
|
||||||
@@ -33,10 +29,10 @@ func (b *backend) pathVerifyWrite(req *logical.Request, d *framework.FieldData)
|
|||||||
// If OTP is not a UUID and a string matching VerifyEchoRequest, then the
|
// If OTP is not a UUID and a string matching VerifyEchoRequest, then the
|
||||||
// response will be VerifyEchoResponse. This is used by agent to check if
|
// response will be VerifyEchoResponse. This is used by agent to check if
|
||||||
// connection to Vault server is proper.
|
// connection to Vault server is proper.
|
||||||
if otp == VerifyEchoRequest {
|
if otp == api.VerifyEchoRequest {
|
||||||
return &logical.Response{
|
return &logical.Response{
|
||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
"message": VerifyEchoResponse,
|
"message": api.VerifyEchoResponse,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user