Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

userpassword string is empty #93

Open
Gictorbit opened this issue Jun 25, 2021 · 1 comment
Open

userpassword string is empty #93

Gictorbit opened this issue Jun 25, 2021 · 1 comment

Comments

@Gictorbit
Copy link

Gictorbit commented Jun 25, 2021

I'm using server example code on Linux and android client and EAP method is on PEAP when user tries to connect to ap and sends a request,the password is empty but username string is valid how can I solve the problem?

func Radius() {
	handler := func(w radius.ResponseWriter, r *radius.Request) {
		username := rfc2865.UserName_GetString(r.Packet)
		password := rfc2865.UserPassword_GetString(r.Packet) 

		fmt.Println(username,password)
		var code radius.Code
		if username == "admin" && password == "12345678" {  //this condition is false always because password is empty 
			code = radius.CodeAccessAccept
		} else {
			code = radius.CodeAccessReject
		}
		log.Printf("Writing %v to %v", code, r.RemoteAddr)
		w.Write(r.Response(code))
	}

	server := radius.PacketServer{
		Handler:      radius.HandlerFunc(handler),
		SecretSource: radius.StaticSecretSource([]byte(`secret`)),
	}

	log.Printf("Starting server on :1812")
	if err := server.ListenAndServe(); err != nil {
		log.Fatal(err)
	}
}
@seanenck
Copy link

When clients use EAP/PEAP the password string is never going to be filled out because the user's password is inside of the EAP section of a packet. You can see a bit more about using EAP with this library in #10 (I don't think anything has changed on this front).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants