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

ACL support #404

Closed
sbernard31 opened this issue Oct 17, 2017 · 2 comments
Closed

ACL support #404

sbernard31 opened this issue Oct 17, 2017 · 2 comments
Labels
bsserver Impact LWM2M bootstrap server client Impact LWM2M client new feature New feature from LWM2M specification

Comments

@sbernard31
Copy link
Contributor

Add support for ACL at Boostrap side (I think we should go for a better generic way : be able to send any write request).

Add support for ACL at client side.

@sbernard31
Copy link
Contributor Author

implemented by #666.

We didn't add any UI to set acl config in leshan-bs-demo.
But you can use REST API :

import requests
import json

BASE_URL = "https://leshan.eclipse.org/bs/"  # the URL of the server.
url = BASE_URL + "api/bootstrap/clientendpoint"  # the client endpoint here !
data = {"servers": {"0": {"shortId": 123,
                        "lifetime": 20,
                        "defaultMinPeriod": 1,
                        "defaultMaxPeriod": None,
                        "disableTimeout": None,
                        "notifIfDisabled": True,
                        "binding": "U"}},
        "security": {"0":{"uri": "coaps://leshan.eclipse.org:5784",
                        "bootstrapServer": True,
                        "securityMode": "PSK",
                        "publicKeyOrId": [98,111,111,116,115,116,114,97,112,95,99,108,105,101,110,116,95,105,100,101,110,116,105,116,121], #binary represenation of "bootstrap_client_identity"
                        "serverPublicKey" : [],
                        "secretKey": [115,101,99,114,101,116,95,107,101,121], #binary representation of "private_key", the hexa value is 7365637265745f6b6579
                        "smsSecurityMode": "NO_SEC",
                        "smsBindingKeyParam" : [],
                        "smsBindingKeySecret" : [],
                        "serverSmsNumber" : "+3343577911",
                        "serverId" : 0,
                        "clientOldOffTime" : 20},
                   "1":{"uri": "coaps://leshan.eclipse.org:5684",
                        "bootstrapServer": False,
                        "securityMode": "PSK",
                        "publicKeyOrId": [115,101,99,117,114,101,95,99,108,105,101,110,116,95,105,100],#represenation of "secure_client_id"
                        "serverPublicKey" : [],
                        "secretKey": [112,114,105,118,97,116,101,95,107,101,121], #binary representation of "private_key", the hexa value is 707269766174655f6b6579
                        "smsSecurityMode": "NO_SEC",
                        "smsBindingKeyParam" : [],
                        "smsBindingKeySecret" : [],
                        "serverSmsNumber" : "+3343577464",
                        "serverId" : 123,
                        "clientOldOffTime" : 1}},
        "acls": {"0":{
                        "objectId": 3,
                        "objectInstanceId": 0,
                        "acls": {3333: 1},
                        "AccessControlOwner":123                        
                     }}};

headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)
print r.status_code
print r.content

For the better/flexible approach #437, this will probably not available in 1.0.0 maybe for 2.0.0.
For the 1.0.0, I plan to add a way to set your own BootstrapHandler, which should cover most of the use cases.

@sbernard31
Copy link
Contributor Author

Adding a custom BootstrapHandler is now possible : see #669

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bsserver Impact LWM2M bootstrap server client Impact LWM2M client new feature New feature from LWM2M specification
Projects
None yet
Development

No branches or pull requests

1 participant