TLS TCP Manager and Client

Huzzah!!!

Log from the client side!!! The server indeed sent the ‘unsolicited’ alert PDU using the CommandResponderEvent. I stored the event from the very first PDU request sent to the server (basically a ‘hey I’m a client pdu’) and it’s working!!

Have to figure out why the existing handlers don’t recognize the PDU, but that’s business logic; not the transport layer!!! Which is working… indeed excited I reckon as I’m repeating now! :wink:

Amazing sir! Sincere thanks for the help and your product!!!

07 Nov 2019 21:53:11,067 [org.snmp4j.transport.TLSTM:] DEBUG - Reading inappBuffer=java.nio.HeapByteBuffer[pos=0 lim=342 cap=32768]
07 Nov 2019 21:53:11,068 [org.snmp4j.transport.TLSTM:] DEBUG - Received message from 127.0.0.1/7835 with length 342: 30:82…
07 Nov 2019 21:53:11,068 [org.snmp4j.mp.MPv3:] DEBUG - SNMPv3 header decoded: msgId=1527397, msgMaxSize=32768, msgFlags=03, secModel=4
07 Nov 2019 21:53:11,068 [org.snmp4j.mp.MPv3:] DEBUG - RFC3412 §7.2.10 - Received PDU is NOT a response or internal class message → unchanged PduHandle = PduHandle[0]
07 Nov 2019 21:53:11,068 [org.snmp4j.Snmp:] DEBUG - Fire process PDU event: CommandResponderEvent[securityModel=4, securityLevel=3, maxSizeResponsePDU=32743, pduHandle=PduHandle[0], stateReference=null, pdu=TRAP[{contextEngineID=80:00:13:70:04:6d:61:6e:61:67:65:72:2d:44:4c:50:30:31:35:36:30, contextName=}, requestID=0, errorStatus=0, errorIndex=0,
VBS[1.3.6.1.2.1.1.3.0 = 0:34:59.58; 1.3.6.1.6.3.1.1.4.1.0 = 1.3.6.1.4.1.8419.20.25.80.2; 1.3.6.1.4.1.8419.20.25.80.2.1.1 = Nov 7, 2019 9:53:11 PM;
1.3.6.1.4.1.8419.20.25.80.2.1.2 = 9; 1.3.6.1.4.1.8419.20.25.80.2.1.3 = 0; 1.3.6.1.4.1.8419.20.25.80.2.1.4 = No Name; 1.3.6.1.4.1.8419.20.25.80.2.1.5 = ;
1.3.6.1.4.1.8419.20.25.80.2.1.6 = 1; 1.3.6.1.4.1.8419.20.25.80.2.1.7 = 1; 1.3.6.1.4.1.8419.20.25.80.2.1.8 = reset MAPS chassis initiated by jdmarti1]]

Thank you!! Got all that hooked in… event figured how to get the ScopedPDU I want to sent to the list of clients into the required byte (hopefully using the event’s event dispatcher to issue prepareOutgoingMessage was correct)… and alas… the logs show all sorts of ‘exciting’ data… but the expected message is not appearing… I’ll have to debug the client to see if any of the listeners or handlers are seeing the PDU and maybe ignoring it… more as I have it.

Continued appreciation for your help on this journey!

07 Nov 2019 21:27:06,690 [org.snmp4j.mp.MPv3:] DEBUG - Removed cache entry: StateReference[msgID=1116163,pduHandle=null,securityEngineID=80:00:13:70:04:6d:61:6e:61:67:65:72:2d:44:4c:50:30:31:35:36:30,securityModel=org.snmp4j.security.TSM@51f1121e,securityName=localhost,securityLevel=3,contextEngineID=80:00:13:70:04:6d:61:6e:61:67:65:72:2d:44:4c:50:30:31:35:36:30,contextName=,retryMsgIDs=null]
07 Nov 2019 21:27:06,691 [org.snmp4j.transport.TLSTM:] DEBUG - Looking up connection for destination ‘127.0.0.1/55094’ returned: SocketEntry[peerAddress=127.0.0.1/55094,socket=Socket[addr=127.0.0.1/127.0.0.1,port=55094,localport=7835],lastUse=Tue Jan 20 17:34:31 CST 1970,inNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],inAppBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],outNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],socketTimeout=null]
07 Nov 2019 21:27:06,691 [org.snmp4j.transport.TLSTM:] DEBUG - {127.0.0.1/55094=SocketEntry[peerAddress=127.0.0.1/55094,socket=Socket[addr=127.0.0.1/127.0.0.1,port=55094,localport=7835],lastUse=Tue Jan 20 17:34:31 CST 1970,inNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],inAppBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],outNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],socketTimeout=null], 127.0.0.1/55013=SocketEntry[peerAddress=127.0.0.1/55013,socket=Socket[unconnected],lastUse=Tue Jan 20 17:34:14 CST 1970,inNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],inAppBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],outNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],socketTimeout=null]}
07 Nov 2019 21:27:06,691 [org.snmp4j.transport.TLSTM:] DEBUG - Waking up selector for new message
07 Nov 2019 21:27:06,691 [org.snmp4j.transport.TLSTM:] DEBUG - Adding operation 4 for: SocketEntry[peerAddress=127.0.0.1/55094,socket=Socket[addr=127.0.0.1/127.0.0.1,port=55094,localport=7835],lastUse=Tue Jan 20 17:34:31 CST 1970,inNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],inAppBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],outNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],socketTimeout=null]
07 Nov 2019 21:27:06,691 [org.snmp4j.transport.TLSTM:] DEBUG - Key is writable
07 Nov 2019 21:27:06,691 [org.snmp4j.transport.TLSTM:] DEBUG - Sending message with length 116 to 127.0.0.1/55094: 30:72:02:01:03:30:10:02:03:11:08:03:02:03:00:80:00:04:01:03:02:01:04:04:00:30:59:04:15:80:00:13:70:04:6d:61:6e:61:67:65:72:2d:44:4c:50:30:31:35:36:30:04:00:a2:3e:02:04:7f:94:ad:45:02:01:00:02:01:ff:30:30:30:14:06:0c:2b:06:01:04:01:c1:63:14:01:02:08:00:04:04:54:52:55:45:30:18:06:0c:2b:06:01:04:01:c1:63:14:01:02:0a:00:04:08:6a:64:6d:61:72:74:69:31
07 Nov 2019 21:27:06,692 [org.snmp4j.transport.TLSTM:] DEBUG - Writing TLS outNetBuffer(PAYLOAD): java.nio.HeapByteBuffer[pos=0 lim=197 cap=32768]
07 Nov 2019 21:27:06,692 [org.snmp4j.transport.TLSTM:] DEBUG - Wrote TLS 197 bytes from outNetBuffer(PAYLOAD)
07 Nov 2019 21:27:06,692 [org.snmp4j.transport.TLSTM:] DEBUG - Payload sent completely
07 Nov 2019 21:27:06,692 [org.snmp4j.transport.TLSTM:] DEBUG - Key is writable
07 Nov 2019 21:27:08,484 [org.snmp4j.mp.MPv3:] DEBUG - Context engine ID of unconfirmed scoped PDU is empty! Setting it to local engine ID
07 Nov 2019 21:27:08,484 [org.snmp4j.transport.TLSTM:] DEBUG - Looking up connection for destination ‘127.0.0.1/55094’ returned: SocketEntry[peerAddress=127.0.0.1/55094,socket=Socket[addr=127.0.0.1/127.0.0.1,port=55094,localport=7835],lastUse=Tue Jan 20 17:34:31 CST 1970,inNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],inAppBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],outNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],socketTimeout=null]
07 Nov 2019 21:27:08,484 [org.snmp4j.transport.TLSTM:] DEBUG - {127.0.0.1/55094=SocketEntry[peerAddress=127.0.0.1/55094,socket=Socket[addr=127.0.0.1/127.0.0.1,port=55094,localport=7835],lastUse=Tue Jan 20 17:34:31 CST 1970,inNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],inAppBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],outNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],socketTimeout=null], 127.0.0.1/55013=SocketEntry[peerAddress=127.0.0.1/55013,socket=Socket[unconnected],lastUse=Tue Jan 20 17:34:14 CST 1970,inNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],inAppBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],outNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],socketTimeout=null]}
07 Nov 2019 21:27:08,484 [org.snmp4j.transport.TLSTM:] DEBUG - Waking up selector for new message
07 Nov 2019 21:27:08,484 [org.snmp4j.transport.TLSTM:] DEBUG - Adding operation 4 for: SocketEntry[peerAddress=127.0.0.1/55094,socket=Socket[addr=127.0.0.1/127.0.0.1,port=55094,localport=7835],lastUse=Tue Jan 20 17:34:31 CST 1970,inNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],inAppBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],outNetBuffer=java.nio.HeapByteBuffer[pos=0 lim=32768 cap=32768],socketTimeout=null]
07 Nov 2019 21:27:08,485 [org.snmp4j.transport.TLSTM:] DEBUG - Key is writable
07 Nov 2019 21:27:08,485 [org.snmp4j.transport.TLSTM:] DEBUG - Sending message with length 336 to 127.0.0.1/55094: 30:82:01:4c:02:01:03:30:10:02:03:0f:b6:5b:02:03:00:80:00:04:01:03:02:01:04:04:00:30:82:01:31:04:15:80:00:13:70:04:6d:61:6e:61:67:65:72:2d:44:4c:50:30:31:35:36:30:04:00:a7:82:01:14:02:01:00:02:01:00:02:01:00:30:82:01:07:30:0f:06:08:2b:06:01:02:01:01:03:00:43:03:05:8b:be:30:19:06:0a:2b:06:01:06:03:01:01:04:01:00:06:0b:2b:06:01:04:01:c1:63:14:19:50:02:30:27:06:0d:2b:06:01:04:01:c1:63:14:19:50:02:01:01:04:16:4e:6f:76:20:37:2c:20:32:30:31:39:20:39:3a:32:37:3a:30:36:20:50:4d:30:12:06:0d:2b:06:01:04:01:c1:63:14:19:50:02:01:02:02:01:09:30:12:06:0d:2b:06:01:04:01:c1:63:14:19:50:02:01:03:04:01:30:30:18:06:0d:2b:06:01:04:01:c1:63:14:19:50:02:01:04:04:07:4e:6f:20:4e:61:6d:65:30:11:06:0d:2b:06:01:04:01:c1:63:14:19:50:02:01:05:04:00:30:12:06:0d:2b:06:01:04:01:c1:63:14:19:50:02:01:06:02:01:01:30:12:06:0d:2b:06:01:04:01:c1:63:14:19:50:02:01:07:02:01:01:30:33:06:0d:2b:06:01:04:01:c1:63:14:19:50:02:01:08:04:22:72:65:73:65:74:20:53:79:73:6d:61:6e:20:69:6e:69:74:69:61:74:65:64:20:62:79:20:6a:64:6d:61:72:74:69:31
07 Nov 2019 21:27:08,485 [org.snmp4j.transport.TLSTM:] DEBUG - Writing TLS outNetBuffer(PAYLOAD): java.nio.HeapByteBuffer[pos=0 lim=421 cap=32768]
07 Nov 2019 21:27:08,485 [org.snmp4j.transport.TLSTM:] DEBUG - Wrote TLS 421 bytes from outNetBuffer(PAYLOAD)
07 Nov 2019 21:27:08,485 [org.snmp4j.transport.TLSTM:] DEBUG - Payload sent completely
07 Nov 2019 21:27:08,485 [org.snmp4j.transport.TLSTM:] DEBUG - Key is writable
07 Nov 2019 21:27:08,485 [Sysman:] INFO - 07 212706Z NOV 19 INFO: Manager - reset Sysman initiated by jdmarti1

OK, good to know that it is actually working even for a non-standard use case. As long as the data you send over the TLS connection has a valid SNMP header (i.e. PDU version and length), the reassembly of fragmented TLS messages (i.e. messages with more than 16K bytes) will work correctly.