aboutsummaryrefslogtreecommitdiffstats
path: root/external/sshkeys/manifests/namecheck.pp
blob: ad3d1c701f5944ddaabe3d380e5f666d5a7bc5e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# Check a name (e.g. key title or filename) for the allowed form
define sshkeys::namecheck (
  $parm,
  $value
) {
  if $value !~ /^[A-Za-z0-9]/ {
    fail("sshkeys::key: $parm '$value' not allowed: must begin with a letter or digit")
  }
  if $value !~ /^[A-Za-z0-9_.:@-]+$/ {
    fail("sshkeys::key: $parm '$value' not allowed: may only contain the characters A-Za-z0-9_.:@-")
  }
}