Tech/Hardware/USB-32COM-RM

From lathama
< Tech‎ | Hardware
Jump to navigation Jump to search

USB32comrm.jpg

Notes around https://www.coolgear.com/product/32-port-rs-232-usb-to-serial-adapter as an option for https://freetserv.github.io/

Device

Serial USB stack.jpg Serial USB HUB.jpg Serial usb power.jpg


lsusb output
Bus 003 Device 018: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
Bus 003 Device 017: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
Bus 003 Device 015: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
Bus 003 Device 013: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
Bus 003 Device 016: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
Bus 003 Device 014: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
Bus 003 Device 012: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
Bus 003 Device 011: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC

/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/5p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 5: Dev 53, If 0, Class=Hub, Driver=hub/4p, 480M
        ID 05e3:0610 Genesys Logic, Inc. Hub
        |__ Port 1: Dev 54, If 0, Class=Hub, Driver=hub/4p, 480M
            ID 05e3:0610 Genesys Logic, Inc. Hub
            |__ Port 1: Dev 56, If 2, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 1: Dev 56, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 1: Dev 56, If 3, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 1: Dev 56, If 1, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 2: Dev 58, If 2, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 2: Dev 58, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 2: Dev 58, If 3, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 2: Dev 58, If 1, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 3: Dev 60, If 3, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 3: Dev 60, If 1, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 3: Dev 60, If 2, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 3: Dev 60, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 4: Dev 62, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 4: Dev 62, If 1, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 4: Dev 62, If 2, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 4: Dev 62, If 3, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
        |__ Port 2: Dev 55, If 0, Class=Hub, Driver=hub/4p, 480M
            ID 05e3:0610 Genesys Logic, Inc. Hub
            |__ Port 3: Dev 61, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 3: Dev 61, If 3, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 3: Dev 61, If 1, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 3: Dev 61, If 2, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 1: Dev 57, If 1, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 1: Dev 57, If 2, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 1: Dev 57, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 1: Dev 57, If 3, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 4: Dev 63, If 2, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 4: Dev 63, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 4: Dev 63, If 3, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 4: Dev 63, If 1, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 2: Dev 59, If 3, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 2: Dev 59, If 1, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 2: Dev 59, If 2, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
            |__ Port 2: Dev 59, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 480M
                ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC

Software Setup

The Linux Kernel does a great job of setting up most of the work for us. The dialout group has all the rights needed. So I create a bunch of users for each port with the right group. The forcecommand should make it safe but removing /bin/bash is a todo still.

  • Debian Bullseye
  • PC Engines APU2
apt install tio
mkdir -p /home/ports/.ssh
cp /home/lathama/.ssh/authorized_keys /home/ports/.ssh/authorized_keys
chown -R root.dialout /home/ports
chmod -R g+r /home/ports
cat users.txt 
port1:*::dialout::/home/ports:/bin/bash
port2:*::dialout::/home/ports:/bin/bash
port3:*::dialout::/home/ports:/bin/bash
port4:*::dialout::/home/ports:/bin/bash
port5:*::dialout::/home/ports:/bin/bash
port6:*::dialout::/home/ports:/bin/bash
port7:*::dialout::/home/ports:/bin/bash
port8:*::dialout::/home/ports:/bin/bash
port9:*::dialout::/home/ports:/bin/bash
port10:*::dialout::/home/ports:/bin/bash
port11:*::dialout::/home/ports:/bin/bash
port12:*::dialout::/home/ports:/bin/bash
port13:*::dialout::/home/ports:/bin/bash
port14:*::dialout::/home/ports:/bin/bash
port15:*::dialout::/home/ports:/bin/bash
port16:*::dialout::/home/ports:/bin/bash
port17:*::dialout::/home/ports:/bin/bash
port18:*::dialout::/home/ports:/bin/bash
port19:*::dialout::/home/ports:/bin/bash
port20:*::dialout::/home/ports:/bin/bash
port21:*::dialout::/home/ports:/bin/bash
port22:*::dialout::/home/ports:/bin/bash
port23:*::dialout::/home/ports:/bin/bash
port24:*::dialout::/home/ports:/bin/bash
port25:*::dialout::/home/ports:/bin/bash
port26:*::dialout::/home/ports:/bin/bash
port27:*::dialout::/home/ports:/bin/bash
port28:*::dialout::/home/ports:/bin/bash
port29:*::dialout::/home/ports:/bin/bash
port30:*::dialout::/home/ports:/bin/bash
port31:*::dialout::/home/ports:/bin/bash
port32:*::dialout::/home/ports:/bin/bash
newusers users.txt
cat /etc/ssh/sshd_config.d/serialports.conf
Match User port1
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB0
  Banner none
Match User port2
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB1
  Banner none
Match User port3
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB2
  Banner none
Match User port4
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB3
  Banner none
Match User port5
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB4
  Banner none
Match User port6
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB5
  Banner none
Match User port7
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB6
  Banner none
Match User port8
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB7
  Banner none
Match User port9
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB8
  Banner none
Match User port10
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB9
  Banner none
Match User port11
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB10
  Banner none
Match User port12
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB11
  Banner none
Match User port13
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB12
  Banner none
Match User port14
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB13
  Banner none
Match User port15
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB14
  Banner none
Match User port16
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB15
  Banner none
Match User port17
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB16
  Banner none
Match User port18
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB17
  Banner none
Match User port19
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB18
  Banner none
Match User port20
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB19
  Banner none
Match User port21
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB20
  Banner none
Match User port22
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB21
  Banner none
Match User port23
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB22
  Banner none
Match User port24
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB23
  Banner none
Match User port25
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB24
  Banner none
Match User port26
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB25
  Banner none
Match User port27
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB26
  Banner none
Match User port28
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB27
  Banner none
Match User port29
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB28
  Banner none
Match User port30
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB29
  Banner none
Match User port31
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB30
  Banner none
Match User port32
  PasswordAuthentication no
  ForceCommand tio /dev/ttyUSB31
  Banner none
systemctl reload sshd