Skip to content

Commit

Permalink
adding sentinel policy to enforce username for ssh secret engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Klaas committed Dec 6, 2018
1 parent 1910808 commit 120068d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions governance/sentinel/enforce-ad-username-ssh-engine.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import "strings"
import "strings"

username_match = func() {
# Make sure there is request data
if length(request.data else 0) is 0 {
return false
}

# Make sure request data includes username
if length(request.data.username else 0) is 0 {
return false
}

# Make sure the supplied username matches the user's name
if request.data.username != identity.entity.aliases[0].name {
return false
}

return true
}

main = rule {
strings.has_prefix(request.path, "ssh-client-signer/sign/my-role") and username_match()
}

0 comments on commit 120068d

Please sign in to comment.