Debian Codegraph @

src/tests/keywords/pap-ssha2

raw
1 #
2 # PRE: update if pap
3 #
4
5 #
6 # Skip if the server wasn't built with openssl
7 #
8 if ('${feature.tls}' != 'yes') {
9 update control {
10 Response-Packet-Type := Access-Accept
11 }
12 handled
13 }
14
15 update {
16 reply:Filter-Id := 'filter'
17 control: !* ANY
18 request:Tmp-String-0 := "5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK" # 60 byte salt
19 }
20
21 #
22 # Hex encoded SSHA2-512 password
23 #
24 update {
25 control:Password-With-Header += "{ssha512}%{sha512:%{request:User-Password}%{&request:Tmp-String-0}}%{hex:&request:Tmp-String-0}"
26 }
27
28 pap.authorize
29 pap.authenticate {
30 reject = 1
31 }
32 if (reject) {
33 update reply {
34 Filter-Id += 'fail 1'
35 }
36 }
37
38 update {
39 control: !* ANY
40 }
41
42 #
43 # Base64 encoded SSHA2-512 password
44 #
45 update {
46 control:Tmp-String-1 := "%{sha512:%{request:User-Password}%{&request:Tmp-String-0}}%{hex:&request:Tmp-String-0}"
47 }
48
49 # To Binary
50 update {
51 control:Tmp-Octets-0 := "0x%{control:Tmp-String-1}"
52 }
53
54 # To Base64
55 update {
56 control:Tmp-String-1 := "%{base64:&control:Tmp-Octets-0}"
57 }
58
59 update {
60 control:Password-With-Header += "{ssha512}%{control:Tmp-String-1}"
61 }
62
63 pap.authorize
64 pap.authenticate {
65 reject = 1
66 }
67 if (reject) {
68 update reply {
69 Filter-Id += 'fail 2'
70 }
71 }
72
73 update {
74 control: !* ANY
75 }
76
77 #
78 # Base64 of Base64 encoded SSHA2-512 password
79 #
80 update {
81 control:Tmp-String-1 := "%{sha512:%{request:User-Password}%{&request:Tmp-String-0}}%{hex:&request:Tmp-String-0}"
82 }
83
84 # To Binary
85 update {
86 control:Tmp-Octets-0 := "0x%{control:Tmp-String-1}"
87 }
88
89 # To Base64
90 update {
91 control:Tmp-String-1 := "{ssha512}%{base64:&control:Tmp-Octets-0}"
92 }
93
94 update {
95 control:Password-With-Header += "%{base64:&control:Tmp-String-1}"
96 }
97
98 pap.authorize
99 pap.authenticate {
100 reject = 1
101 }
102 if (reject) {
103 update reply {
104 Filter-Id += 'fail 3'
105 }
106 }
107
108 update {
109 control: !* ANY
110 }
111
112 update control {
113 Auth-Type := Accept
114 }