RADIUS代理实现消息身份验证器错误

问题描述 投票:0回答:1

我正在TinyRadius lib的帮助下实现半径代理。 PAP和CHAP代理没有任何问题,但EAP消息没有。因此,添加代理属性后,我将重新计算半径数据包的[[Request Authenticator,然后根据RFC3579重新计算Message-Authenticator

还有两个问题:

根据RFC3579:Message-Authenticator

= HMAC-MD5(类型,标识符,LengthRequest Authenticator,属性)

1]

长度 =?它是半径包或EAP消息的长度吗?

2)

请求认证器-这是半径数据包的认证器,对吗?因此,如果我将其添加到半径数据包的Message-Authenticator属性中-半径数据包将更改,并且我必须重新计算请求身份验证器,但是如果我重新计算请求身份验证器-Message-Authenticator将无效,因为它取决于请求身份验证器。 >

客户端和端点半径服务器的共享机密是相同的(已多次检查)。

我需要做的是教代理以代理EAP消息,但总是得到:

Received Access-Request Id 191 from 192.168.200.250:1814 to 192.168.200.250:10000 length 171 Dropping packet without response because of error: Received packet from 192.168.200.250 with invalid Message-Authenticator! (Shared secret is incorrect.)

UPDATE:

Request-Authentificator生成:

protected byte[] createRequestAuthenticator(String sharedSecret){ MessageDigest md5=getMd5Digest(); md5.reset(); byte[] requestAuthenticator=new byte[16]; Random r=new Random(); for(int i=0;i<16;i++){ requestAuthenticator[i]=(byte)r.nextInt(); } md5.update(sharedSecret.getBytes(),0,sharedSecret.length()); md5.update(requestAuthenticator,0,requestAuthenticator.length); return md5.digest(); }

Message-Authenticator生成:

] >>protected byte[] createRFC3579MessageAuthenticator(String sharedSecret,int packetLength,byte[] requestAuthenticator,byte[] attributes){ try{ Mac mac=Mac.getInstance("HmacMD5"); mac.init(new SecretKeySpec(sharedSecret.getBytes(),"HmacMD5")); mac.update((byte)getPacketType()); mac.update((byte)getPacketIdentifier()); mac.update((byte)(packetLength>>8)); mac.update((byte)(packetLength&0x0ff)); mac.update(requestAuthenticator,0,requestAuthenticator.length); mac.update(attributes,0,attributes.length); return mac.doFinal(); }catch(NoSuchAlgorithmException|InvalidKeyException ex){ Logger.getLogger(RadiusPacket.class.getName()).log(Level.SEVERE,null,ex); return null; } }
我正在TinyRadius lib的帮助下实现半径代理。 PAP和CHAP代理没有任何问题,但EAP消息没有。因此,我在...
java freeradius radius tinyradius
1个回答
0
投票
1)长度是RADIUS数据包的长度,如果您正在执行EAP,则它包含一个或多个EAP-Message属性。

2]否-请求验证器是RADIUS数据包头中的随机16位质询,用于重复检测,并作为诸如CHAP之类的属性的哈希方案的一部分。仅当您生成新数据包时才应更改,而在重新传输现有数据包时则不应更改。

© www.soinside.com 2019 - 2024. All rights reserved.