SSH登录支持Passphrase

This commit is contained in:
GoEdgeLab
2021-11-06 15:31:01 +08:00
parent 9fbe20c18a
commit 5a7e3c265f
8 changed files with 32 additions and 9 deletions

View File

@@ -73,7 +73,7 @@ func (this *NodeGrantDAO) FindNodeGrantName(tx *dbs.Tx, id uint32) (string, erro
}
// CreateGrant 创建认证信息
func (this *NodeGrantDAO) CreateGrant(tx *dbs.Tx, adminId int64, name string, method string, username string, password string, privateKey string, description string, nodeId int64) (grantId int64, err error) {
func (this *NodeGrantDAO) CreateGrant(tx *dbs.Tx, adminId int64, name string, method string, username string, password string, privateKey string, passphrase string, description string, nodeId int64) (grantId int64, err error) {
op := NewNodeGrantOperator()
op.AdminId = adminId
op.Name = name
@@ -87,6 +87,7 @@ func (this *NodeGrantDAO) CreateGrant(tx *dbs.Tx, adminId int64, name string, me
case "privateKey":
op.Username = username
op.PrivateKey = privateKey
op.Passphrase = passphrase
}
op.Description = description
op.NodeId = nodeId
@@ -96,7 +97,7 @@ func (this *NodeGrantDAO) CreateGrant(tx *dbs.Tx, adminId int64, name string, me
}
// UpdateGrant 修改认证信息
func (this *NodeGrantDAO) UpdateGrant(tx *dbs.Tx, grantId int64, name string, method string, username string, password string, privateKey string, description string, nodeId int64) error {
func (this *NodeGrantDAO) UpdateGrant(tx *dbs.Tx, grantId int64, name string, method string, username string, password string, privateKey string, passphrase string, description string, nodeId int64) error {
if grantId <= 0 {
return errors.New("invalid grantId")
}
@@ -114,6 +115,7 @@ func (this *NodeGrantDAO) UpdateGrant(tx *dbs.Tx, grantId int64, name string, me
case "privateKey":
op.Username = username
op.PrivateKey = privateKey
op.Passphrase = passphrase
}
op.Description = description
op.NodeId = nodeId