summaryrefslogtreecommitdiffstats
path: root/src/tests/keywords/pap-ssha2
blob: a8c9c9bc7f1b52a06545dc76fa220ea094a84c42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#
# PRE: update if pap
#

#
#  Skip if the server wasn't built with openssl
#
if ('${feature.tls}' != 'yes') {
	update control {
		Response-Packet-Type := Access-Accept
	}
	handled
}

update {
	reply:Filter-Id := 'filter'
	control: !* ANY
	request:Tmp-String-0 := "5RNqNl8iYLbkCc7JhR8as4TtDDCX6otuuWtcja8rITUyx9zrnHSe9tTHGmKK"	# 60 byte salt
}

#
#  Hex encoded SSHA2-512 password
#
update {
	control:Password-With-Header += "{ssha512}%{sha512:%{request:User-Password}%{&request:Tmp-String-0}}%{hex:&request:Tmp-String-0}"
}

pap.authorize
pap.authenticate {
	reject = 1
}
if (reject) {
	update reply {
		Filter-Id += 'fail 1'
	}
}

update {
	control: !* ANY
}

#
#  Base64 encoded SSHA2-512 password
#
update {
	control:Tmp-String-1 := "%{sha512:%{request:User-Password}%{&request:Tmp-String-0}}%{hex:&request:Tmp-String-0}"
}

# To Binary
update {
	control:Tmp-Octets-0 := "0x%{control:Tmp-String-1}"
}

# To Base64
update {
	control:Tmp-String-1 := "%{base64:&control:Tmp-Octets-0}"
}

update {
	control:Password-With-Header += "{ssha512}%{control:Tmp-String-1}"
}

pap.authorize
pap.authenticate {
	reject = 1
}
if (reject) {
	update reply {
		Filter-Id += 'fail 2'
	}
}

update {
	control: !* ANY
}

#
#  Base64 of Base64 encoded SSHA2-512 password
#
update {
	control:Tmp-String-1 := "%{sha512:%{request:User-Password}%{&request:Tmp-String-0}}%{hex:&request:Tmp-String-0}"
}

# To Binary
update {
	control:Tmp-Octets-0 := "0x%{control:Tmp-String-1}"
}

# To Base64
update {
	control:Tmp-String-1 := "{ssha512}%{base64:&control:Tmp-Octets-0}"
}

update {
	control:Password-With-Header += "%{base64:&control:Tmp-String-1}"
}

pap.authorize
pap.authenticate {
	reject = 1
}
if (reject) {
	update reply {
		Filter-Id += 'fail 3'
	}
}

update {
	control: !* ANY
}

update control {
	Auth-Type := Accept
}