Skip to content

Authenticate client using certificates/login #836

@Dubehh

Description

@Dubehh

I found similar questions but didn't find a working answer. I'd like to authenticate the client before he's able to read data, is this possible? I tried using certificates but a client is able to use whatever certificate he or she desires (meaning it's not validated). I saw this reference but i'm not sure if it's the same as what I am looking for.

Server.py

server = Server()
await server.init()
await server.load_certificate("cert.der")
await server.load_private_key("key.pem")

server.set_security_IDs(["Basic256Sha256"])
server.set_endpoint('opc.tcp://127.0.0.1:4840/freeopcua/server/')
server.set_security_policy([ua.SecurityPolicyType.Basic256Sha256_SignAndEncrypt])

Client.py

client = Client("opc.tcp://127.0.0.1:4840/freeopcua/server/")
client.set_security_string(
        "Basic256Sha256,"
        "SignAndEncrypt,"
        "different_cert.der,"
        "different_key.pem")

client.connect()

I used a differently generated certificate/key for the client, yet he's still able to fetch data from the server. How do I validate these certificates?

If there's a way to authenticate with just username/password i'd be happy aswell..

(I test locally)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions