pymodbus starttcpserver - how do I restrict access

65 views Asked by At

I have a bit of code from pymodbus:

store = ModbusSlaveContext(hr=ModbusSequentialDataBlock(0, [0]*100))
context = ModbusServerContext(slaves=store, single=True)

if debug:
    print('pymobus in debug')
    pymodbus_apply_logging_config("DEBUG")

# Start the Modbus server on the specified TCP port
try:
    print(f'Starting ModbusTCP server at port {port}.')
    StartTcpServer(context=context, address=("0.0.0.0", port))

How do I set up an access list to restrict which IP addresses the clients are connecting from?

I been googling, but documentation is poor :-(.

I have been googling everywhere but no luck. I want to set up an access list but I do not know.

1

There are 1 answers

1
Cyril On

Not sure it is already developed. But your request is good. In my case, after executing StartTcpServer, the script is blocked, even if I excecute it in a thread. Server is running properly (I can read and write in the modbus table ...)