| 1 |
# |
| 2 |
# PRE: update if |
| 3 |
# |
| 4 |
update { |
| 5 |
reply:Filter-Id := 'filter' |
| 6 |
control: !* ANY |
| 7 |
request:Tmp-String-0 := "5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK" # 60 byte salt |
| 8 |
} |
| 9 |
|
| 10 |
# |
| 11 |
# Unencoded Cleartext-Password in password with header |
| 12 |
# |
| 13 |
update { |
| 14 |
control:Password-With-Header := "%{request:User-Password}" |
| 15 |
} |
| 16 |
pap.authorize |
| 17 |
pap.authenticate { |
| 18 |
reject = 1 |
| 19 |
} |
| 20 |
if (reject) { |
| 21 |
update reply { |
| 22 |
Filter-Id += 'fail 0' |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
update { |
| 27 |
control: !* ANY |
| 28 |
} |
| 29 |
|
| 30 |
# |
| 31 |
# Base64 encoded Cleartext-Password in password with header |
| 32 |
# |
| 33 |
update { |
| 34 |
Tmp-String-1 := "{clear}%{User-Password}" |
| 35 |
} |
| 36 |
update { |
| 37 |
control:Password-With-Header := "%{base64:&request:Tmp-String-1}" |
| 38 |
} |
| 39 |
pap.authorize |
| 40 |
pap.authenticate { |
| 41 |
reject = 1 |
| 42 |
} |
| 43 |
if (reject) { |
| 44 |
update reply { |
| 45 |
Filter-Id += 'fail 0' |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
update { |
| 50 |
control: !* ANY |
| 51 |
} |
| 52 |
|
| 53 |
# |
| 54 |
# Hex encoded SSHA password |
| 55 |
# |
| 56 |
update { |
| 57 |
control:Password-With-Header += "{ssha}%{sha1:%{request:User-Password}%{&request:Tmp-String-0}}%{hex:&request:Tmp-String-0}" |
| 58 |
} |
| 59 |
|
| 60 |
pap.authorize |
| 61 |
pap.authenticate { |
| 62 |
reject = 1 |
| 63 |
} |
| 64 |
if (reject) { |
| 65 |
update reply { |
| 66 |
Filter-Id += 'fail 1' |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
update { |
| 71 |
control: !* ANY |
| 72 |
} |
| 73 |
|
| 74 |
# |
| 75 |
# Base64 encoded SSHA password |
| 76 |
# |
| 77 |
update { |
| 78 |
control:Tmp-String-1 := "%{sha1:%{request:User-Password}%{&request:Tmp-String-0}}%{hex:&request:Tmp-String-0}" |
| 79 |
} |
| 80 |
|
| 81 |
# To Binary |
| 82 |
update { |
| 83 |
control:Tmp-Octets-0 := "0x%{control:Tmp-String-1}" |
| 84 |
} |
| 85 |
|
| 86 |
# To Base64 |
| 87 |
update { |
| 88 |
control:Tmp-String-1 := "%{base64:&control:Tmp-Octets-0}" |
| 89 |
} |
| 90 |
|
| 91 |
update { |
| 92 |
control:Password-With-Header += "{ssha}%{control:Tmp-String-1}" |
| 93 |
} |
| 94 |
|
| 95 |
pap.authorize |
| 96 |
pap.authenticate { |
| 97 |
reject = 1 |
| 98 |
} |
| 99 |
if (reject) { |
| 100 |
update reply { |
| 101 |
Filter-Id += 'fail 2' |
| 102 |
} |
| 103 |
} |
| 104 |
|
| 105 |
update { |
| 106 |
control: !* ANY |
| 107 |
} |
| 108 |
|
| 109 |
# |
| 110 |
# Base64 of Base64 encoded SSHA password |
| 111 |
# |
| 112 |
update { |
| 113 |
control:Tmp-String-1 := "%{sha1:%{request:User-Password}%{&request:Tmp-String-0}}%{hex:&request:Tmp-String-0}" |
| 114 |
} |
| 115 |
|
| 116 |
# To Binary |
| 117 |
update { |
| 118 |
control:Tmp-Octets-0 := "0x%{control:Tmp-String-1}" |
| 119 |
} |
| 120 |
|
| 121 |
# To Base64 |
| 122 |
update { |
| 123 |
control:Tmp-String-1 := "{ssha}%{base64:&control:Tmp-Octets-0}" |
| 124 |
} |
| 125 |
|
| 126 |
update { |
| 127 |
control:Password-With-Header += "%{base64:&control:Tmp-String-1}" |
| 128 |
} |
| 129 |
|
| 130 |
pap.authorize |
| 131 |
pap.authenticate { |
| 132 |
reject = 1 |
| 133 |
} |
| 134 |
if (reject) { |
| 135 |
update reply { |
| 136 |
Filter-Id += 'fail 3' |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
update { |
| 141 |
control: !* ANY |
| 142 |
} |
| 143 |
|
| 144 |
update control { |
| 145 |
Auth-Type := Accept |
| 146 |
} |