Logic Machine Forum
How to share values between LM in diferent buildings (secure way) - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: How to share values between LM in diferent buildings (secure way) (/showthread.php?tid=3936)



How to share values between LM in diferent buildings (secure way) - batistacaceres - 15.03.2022

Hello:
I need to share values between group address from different logicMachine located in different buildings. Whats the best way or the best protocol, (the best secure) to get it??.
best regards


RE: How to share values between LM in diferent buildings (secure way) - Daniel - 15.03.2022

If they are located on same network you can use KNX IP secure. If they are not then you can use MQTT but you need broker somewhere. You can even use our cloud. If you add all LMs to the same cloud network then objects added to cloud will exchange data. Objects added to mosaic are the one exported to cloud or you can tag objects with tag 'lmcloud'


RE: How to share values between LM in diferent buildings (secure way) - batistacaceres - 17.03.2022

(15.03.2022, 16:42)Daniel Wrote: If they are located on same network you can use KNX IP secure.  If they are not then you can use MQTT but you need broker somewhere.  You can even use our cloud. If you add all LMs to the same cloud network then objects added to cloud will exchange data. Objects added to mosaic are the one exported to cloud or you can tag objects with tag 'lmcloud'

Thank you Daniel:

They are not on the same network, maybe cloud solution is a good idea thank a lot...


I'll expose what I want for any other comments, all ideas are welcome.

I have one logicMachine like "Master" and others maybe 20 like "Slaves", reporting its status, ones an hour. Now the LM "slaves" comunicate it status using remote services:
http://remote:remote@192.168.0.10/scada-remote?m=json&r=grp&fn=write&alias=1/1/2&value=true
but I want to know if there is a better (secure way) to do that because I dont want to send user:password by url ..... thinking always in security. Is there a way to send that password encripted? or may be i am demanding so much, and all of this is not fully necessary.
Sorry I ask this from my ignorance on the subject.

best regard..., and thank all...


RE: How to share values between LM in diferent buildings (secure way) - admin - 17.03.2022

You can use HTTPS for remote services.


RE: How to share values between LM in diferent buildings (secure way) - batistacaceres - 18.03.2022

(17.03.2022, 10:14)admin Wrote: You can use HTTPS for remote services.

Hello admin:

How could I use HTTPS for remote services?, I am trying :
https://remote:remote@192.168.0.10/scada-...value=true;
but it doesnt work, and also I dont want to send user and password in the url, any example in the forum?. Sorry my ignorance about those subjects..

bestregards, Thank..


RE: How to share values between LM in diferent buildings (secure way) - admin - 18.03.2022

If you are trying via browser you might see a security notification that a self-signed certificate is used. You have to accept it and it will work. No extra configuration is needed from LM, just change http to https in your script and it should work. There's no other way to pass credentials but to set them in the URL. But if you are using HTTPS it will be encrypted.


RE: How to share values between LM in diferent buildings (secure way) - batistacaceres - 18.03.2022

(18.03.2022, 14:50)admin Wrote: If you are trying via browser you might see a security notification that a self-signed certificate is used. You have to accept it and it will work. No extra configuration is needed from LM, just change http to https in your script and it should work. There's no other way to pass credentials but to set them in the URL. But if you are using HTTPS it will be encrypted.

Ill test it,

best regards, Thank you, very much.


RE: How to share values between LM in diferent buildings (secure way) - khalil - 30.06.2022

Hello admin
I try the remote service via the browser and its work.
but how to use it in the script?
 
I use this SCript
Code:
require('ssl.https')
ssl.https.TIMEOUT = 5

-- Read from object
local reply = ssl.https.request('https://remote:remote@*.*.*.*/scada-remote?m=json&r=grp&fn=getvalue&alias=62/7/30')
log(reply)

Where should I but the username and password and what is the format?
Admin username password is something like "P@s0ord"


RE: How to share values between LM in diferent buildings (secure way) - admin - 01.07.2022

Like this:
Code:
http = require('socket.http')
mime = require('mime')

result = http.request({
  url = 'https://*.*.*.*/scada-remote?m=json&r=grp&fn=getvalue&alias=62/7/30',
  headers = {
    Authorization = 'Basic ' .. mime.b64('remote:P@s0ord')
  }
})

log(result)



RE: How to share values between LM in diferent buildings (secure way) - khalil - 02.07.2022

(01.07.2022, 05:58)admin Wrote: Like this:
Code:
http = require('socket.http')
mime = require('mime')

result = http.request({
  url = 'https://*.*.*.*/scada-remote?m=json&r=grp&fn=getvalue&alias=62/7/30',
  headers = {
    Authorization = 'Basic ' .. mime.b64('remote:P@s0ord')
  }
})

log(result)

Thank you admin 
Work perfect


RE: How to share values between LM in diferent buildings (secure way) - khalil - 21.09.2022

(01.07.2022, 05:58)admin Wrote: Like this:
Code:
http = require('socket.http')
mime = require('mime')

result = http.request({
  url = 'https://*.*.*.*/scada-remote?m=json&r=grp&fn=getvalue&alias=62/7/30',
  headers = {
    Authorization = 'Basic ' .. mime.b64('remote:P@s0ord')
  }
})

log(result)

Hello Admin
How to write Boolean value to object?


RE: How to share values between LM in diferent buildings (secure way) - khalil - 22.09.2022

Code:
http = require('socket.http')
mime = require('mime')
cmdbool = event.getvalue()

cmdstr = tostring(cmdbool)

result1 = http.request({
  url = 'https://**.**.**.**/scada-remote?m=json&r=grp&fn=write&alias=11/0/3&value=' .. cmdstr,
  headers = {
    Authorization = 'Basic ' .. mime.b64('remote:*******')
  }
       
})


I tried This code but it didn't work, any idea?


RE: How to share values between LM in diferent buildings (secure way) - admin - 22.09.2022

log what the http request result/error is:
Code:
res, code, hdrs, stat = http.request({ ... })
log(res, code, hdrs, stat)



RE: How to share values between LM in diferent buildings (secure way) - khalil - 22.09.2022

(22.09.2022, 12:54)admin Wrote: log what the http request result/error is:
Code:
res, code, hdrs, stat = http.request({ ... })
log(res, code, hdrs, stat)

This is what I got
Code:
* arg: 1
  * string: Object not found
* arg: 2
  * number: 200
* arg: 3
  * table:
   ["date"]
    * string: Thu, 22 Sep 2022 13:04:27 GMT
   ["transfer-encoding"]
    * string: chunked
   ["content-type"]
    * string: text/plain
   ["connection"]
    * string: close
* arg: 4
  * string: HTTP/1.1 200 OK



RE: How to share values between LM in diferent buildings (secure way) - admin - 22.09.2022

Do you have Export set for this object? Alternatively you can disable "Allow only exported objects" in Remote services settings.


RE: How to share values between LM in diferent buildings (secure way) - khalil - 22.09.2022

(22.09.2022, 13:07)admin Wrote: Do you have Export set for this object? Alternatively you can disable "Allow only exported objects" in Remote services settings.

Oops forget that Smile


RE: How to share values between LM in diferent buildings (secure way) - Re-G - 12.10.2023

Hi.

I don't get it. I put this code:

Code:
http = require('socket.http')

mime = require('mime')

result = http.request({
  url = 'https://XXX.YYY.VVV.ZZZ/scada-remote?m=json&r=grp&fn=getvalue&alias=32/7/1',
  headers = {
    Authorization = 'Basic ' .. mime.b64('remote:Password')
  }
})
grp.write('0/0/16', result)
log(result)


address 32/7/1 is 1-bit - true/false
address 0/0/16 is 1-bit - true/false

in log i have:
* string: false


but address 0/0/16 is true

if i use function toboolean  is still true on 0/0/16

what im doing wrong?


RE: How to share values between LM in diferent buildings (secure way) - admin - 12.10.2023

You need to decode the received value using JSON.