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

Expose server's middleware for incoming clients control #55

Merged
merged 2 commits into from
Apr 29, 2020

Conversation

Waldz
Copy link
Member

@Waldz Waldz commented Apr 27, 2020

Updates: mysteriumnetwork/node#1838

  • Server's callbacks to subscribe and incoming client data: Openvpn variables, states
  • Expose client authorisation control

openvpn/middlewares/server/auth/middleware.go Outdated Show resolved Hide resolved
openvpn/middlewares/server/auth/middleware.go Outdated Show resolved Hide resolved
openvpn/middlewares/server/auth/middleware.go Outdated Show resolved Hide resolved
openvpn/middlewares/server/auth/middleware.go Outdated Show resolved Hide resolved
openvpn/middlewares/server/auth/middleware.go Outdated Show resolved Hide resolved
password := event.Env["password"]
err := m.authenticateClient(event.ClientID, event.ClientKey, username, password)
if err != nil {
log.Error("Unable to authenticate client:", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we just logging the auth problem and not returning an error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not change this logic. Probably, middleware just logs returning returned errors also.
If you mean returning error to connecting client, it's intentional. Client gets just "wrong username or password"

openvpn/middlewares/server/credentials/middleware_test.go Outdated Show resolved Hide resolved
type middleware struct {
*auth.Middleware
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why filter depends on auth?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple inheritances. auth.Middleware general purpose - subscribes to client status events

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no inheritance for golang, that is why it looks weird when you are trying to invent it yourself.


return true, nil
}
func (m *middleware) ConsumeLine(line string) (bool, error) { return false, nil }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't consume lines anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, now subscribes for consumer client from auth.Middleware

openvpn/middlewares/server/filter/middleware_test.go Outdated Show resolved Hide resolved
@Waldz Waldz force-pushed the feature/expose-server-auth-control branch from 2471728 to 42b4559 Compare April 29, 2020 10:53
Copy link
Member Author

@Waldz Waldz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments fixed

@Waldz Waldz force-pushed the feature/expose-server-auth-control branch from 42b4559 to ae74469 Compare April 29, 2020 10:54
@Waldz Waldz requested a review from soffokl April 29, 2020 10:57
@Waldz Waldz merged commit 7b6a963 into master Apr 29, 2020
@Waldz Waldz deleted the feature/expose-server-auth-control branch April 29, 2020 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants