MTA-Setup kWh: verschil tussen versies

Uit MakerSpace Leiden
Ga naar: navigatie, zoeken
Regel 8: Regel 8:
 
      
 
      
 
     [Service]
 
     [Service]
     ExecStart=/usr/bin/ssh -i /etc/kwh-meter-tunnel -l dirkx -p 222 -NT \
+
     ExecStart=/usr/bin/ssh -i /etc/kwh-meter-tunnel -l dirkx -p 222 -T \
                -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes \
+
        -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes \
                -L 9999:192.168.6.111:80 83.163.200.191 -  
+
        -L 9999:192.168.6.111:80 \
 +
        -L 1161:127.0.0.1:1161 \
 +
        83.163.200.191 -
 
     RestartSec=30
 
     RestartSec=30
 
     Restart=always
 
     Restart=always
 
      
 
      
 +
    [Install]
 +
    WantedBy=multi-user.target
 +
 +
and
 +
 +
    [Unit]
 +
    Description=Local end of SNMP Tunnel to kWh meter.
 +
    After=network.target
 +
 +
    [Service]
 +
    ExecStart=/usr/bin/socat -T15 udp4-recvfrom:2161,bind=127.0.0.1,reuseaddr,fork tcp:127.0.0.1:1161
 +
    RestartSec=30
 +
    Restart=always
 +
 
     [Install]
 
     [Install]
 
     WantedBy=multi-user.target
 
     WantedBy=multi-user.target
Regel 19: Regel 35:
 
and this is received by a SSH authorized key line on the space machine:
 
and this is received by a SSH authorized key line on the space machine:
  
    no-pty,permitopen="192.168.6.111:80" ssh-rsa AAAAB3NzaC1yc2EA....NFlObjqxPGezJYI0wMNlI9XiP purely-the-tunnel to the kWh meter
+
no-pty,permitopen="192.168.6.111:80",permitopen="127.0.0.1:1161",command="/usr/local/bin/socat tcp4-listen:1161,reuseaddr,fork UDP:192.168.6.111:161" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1s6ePMM/1s1idGDDygrcGmoeWwEgKiOqBw663uN6JmXluBE4dTn2ux2Mn/ATmp5nwbAPPpSa3wp2p4WPoM0gdNZyaOEHxYjz9RyRgdsa6zUS5GsQviVThnF50guzvVH9stNy/KIleAB7eSGXZHqs16tuAJV3v4AVVZFVuxbplzfTw6mruzTbikrDNBKpvIZ37tctbn8frTiz6GjdbAR8PA0vVIfoyv+VXXXPbRGsHBdxTArsqJhfkxSB4pOveewEyawhLKTKprRO7ZspKcxuzWLRQl2+tJCYK3gw+YMefX9WMKEHDHrY83Wyj+JVNFlObjqxPGezJYI0wMNlI9XiP kwh tunnel
  
 
With localhost:9999 mapped in the CRM for those that need access.
 
With localhost:9999 mapped in the CRM for those that need access.

Versie van 28 nov 2020 om 16:29

The remote access to the KWh meter depends on a SSH tunnel on the MTA.

File in systemd at: /etc/systemd/system/kwh-tunnel.service:

   [Unit]
   Description=Tunnel to kWh meter.
   After=network.target
   
   [Service]
   ExecStart=/usr/bin/ssh -i /etc/kwh-meter-tunnel -l dirkx -p 222 -T \
        -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes \
        -L 9999:192.168.6.111:80 \
        -L 1161:127.0.0.1:1161 \
        83.163.200.191 -
   RestartSec=30
   Restart=always
   
   [Install]
   WantedBy=multi-user.target

and

   [Unit]
   Description=Local end of SNMP Tunnel to kWh meter.
   After=network.target
   [Service]
   ExecStart=/usr/bin/socat -T15 udp4-recvfrom:2161,bind=127.0.0.1,reuseaddr,fork tcp:127.0.0.1:1161
   RestartSec=30
   Restart=always
   [Install]
   WantedBy=multi-user.target

and this is received by a SSH authorized key line on the space machine:

no-pty,permitopen="192.168.6.111:80",permitopen="127.0.0.1:1161",command="/usr/local/bin/socat tcp4-listen:1161,reuseaddr,fork UDP:192.168.6.111:161" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1s6ePMM/1s1idGDDygrcGmoeWwEgKiOqBw663uN6JmXluBE4dTn2ux2Mn/ATmp5nwbAPPpSa3wp2p4WPoM0gdNZyaOEHxYjz9RyRgdsa6zUS5GsQviVThnF50guzvVH9stNy/KIleAB7eSGXZHqs16tuAJV3v4AVVZFVuxbplzfTw6mruzTbikrDNBKpvIZ37tctbn8frTiz6GjdbAR8PA0vVIfoyv+VXXXPbRGsHBdxTArsqJhfkxSB4pOveewEyawhLKTKprRO7ZspKcxuzWLRQl2+tJCYK3gw+YMefX9WMKEHDHrY83Wyj+JVNFlObjqxPGezJYI0wMNlI9XiP kwh tunnel

With localhost:9999 mapped in the CRM for those that need access.