aboutsummaryrefslogtreecommitdiffstats
path: root/external/sshkeys/manifests/namecheck.pp
blob: 52c6e51f0cb2008cd12a86f215d0571d56f8cf80 (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_.:@-")
  }
}