mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-06 10:00:24 +08:00
优化SSH认证sudo设置
This commit is contained in:
@@ -89,7 +89,9 @@ func (this *NodeGrantDAO) CreateGrant(tx *dbs.Tx, adminId int64, name string, me
|
|||||||
op.PrivateKey = privateKey
|
op.PrivateKey = privateKey
|
||||||
op.Passphrase = passphrase
|
op.Passphrase = passphrase
|
||||||
}
|
}
|
||||||
|
if username != "root" { // only for non-root user
|
||||||
op.Su = su
|
op.Su = su
|
||||||
|
}
|
||||||
op.Description = description
|
op.Description = description
|
||||||
op.NodeId = nodeId
|
op.NodeId = nodeId
|
||||||
op.State = NodeGrantStateEnabled
|
op.State = NodeGrantStateEnabled
|
||||||
@@ -117,7 +119,11 @@ func (this *NodeGrantDAO) UpdateGrant(tx *dbs.Tx, grantId int64, name string, me
|
|||||||
op.PrivateKey = privateKey
|
op.PrivateKey = privateKey
|
||||||
op.Passphrase = passphrase
|
op.Passphrase = passphrase
|
||||||
}
|
}
|
||||||
|
if username != "root" { // only for non-root user
|
||||||
op.Su = su
|
op.Su = su
|
||||||
|
} else {
|
||||||
|
op.Su = false
|
||||||
|
}
|
||||||
op.Description = description
|
op.Description = description
|
||||||
op.NodeId = nodeId
|
op.NodeId = nodeId
|
||||||
err := this.Save(tx, op)
|
err := this.Save(tx, op)
|
||||||
|
|||||||
Reference in New Issue
Block a user