Mosquitto working

Some rework had to be done
Brett sent me answers on what to do about SSL 1.x.x, and the problem I had with one of the sample programs: SSL 1.0.x has been staticly linked into the shareable image, so linking against that file (libmqttv3c$shr.exe) instead of the object library (libmqttv3c.olb) would solve the problem.
He also added a somewhat reworked version of paho_c_pub.c, I had to do some re-editing to solve issues that were the result of retrieving this source from the message and store it in my (WIN10) workstation, and moving is (ASCII) to the VMS box. But once these were addressed, the program starts and runs.

Next issue was to figure out how to pass a message from the VMS box to the application on my mobile….
First do it the easy way:

  • On my mobile (in MQTT Dashboard) define a connection giving it a easy name enter login nredentials as connecting to the server (since I am using Brett’s additional module for authentication), and let it listen to any subject (“+” so I don’t have to bother on that to begin with. Start the connection on mobile, it will start listening.
  • On the server start paho_c_pub, any topic will now do; Enter the connection on the mobile as clientid;

  • So there the commands and results are:
    $ pub :== $DKA0:[MQTT.PAHO.EXAMPLES]PAHO_C_PUB.EXE
    $ pub test --clientid (Name on Mobile) --username (username) --password (password)
    Using topic test
    Connecting

    Connected
    redo

    Any test that is now entered, will show up in MQTT Dashboard in this client, under topic “test”

    Backlink has to be done – will be (I guess) paho_c_sub.c; Same setup for subject, it will show all that is sent – together with subject – until cancelled – it will listen to any topic (due to wildcard “+”):

    $ sub :== $DKA0:[MQTT.PAHO.EXAMPLES]PAHO_C_SUB.EXE
    $ sub + --clientid (Name on Mobile) --username (username) --password (password)
    Subscribing to topic + with client (clientid) at QoS 2
    test redo
    Oktest redo
    Oktest redo
    Oktest Done

    These messages show up in the subcsscription area in MQTTDashboard as well – obvious, since I’m listening to any subject 🙂
    I also added –delimiter \n to add delimiter beyond, but that does not work the way I anticipated. But is newline is included in the message it will show up in output:

    $ sub + --clientid (Name on Mobile) --username (username) --password (password) --delimiter \n
    topic is +
    Subscribing to topic + with client htc at QoS 2
    test Done \test Done
    \test With crlf

    But that is possibly a matter of understanding on how to read the documentation, it might well be the way it should work.

    If sub is started without clientid,

    sub + --username (username) --password (password)
    topic is +
    Subscribing to topic + with client stdout-subscriber-async at QoS 2

    messages from my mobile are not accepted. Which is fine for what I’m planning to use it for.

    Now the first hurdles have been taken: Connection works both ways and I have a fair impression on how the use it both ways. Next is creating API-calls (that Brett already started to do) and use these.

    Paho re-installed

    Paho reinstalled
    I have overlooked a few things: I installed the previous version (that process removes what’s on the system…) and checked the contents of the object libraries in that version; but what is in the latest version was already saved – and the new lobrraies contain the same routines.
    Re-installed the latest version of Paho (1.2) and rebuilt the samples using the supplied procedure – which may be different from the 1.o version.
    Now all but two images can be compiles; the programs that run in an SSL environment compile but link fails.

    $ link/threads paho_cs_pub.obj,paho$root:[lib]libmqttv3cs.olb/lib,sys$input/opt
    sys$library:ssl1$libssl_shr32.exe/share
    sys$library:ssl1$libcrypto_shr32.exe/share

    stating that sys$library:ssl1$libssl_shr32.exe/share cannot be found.
    Of course not: I have no support contract with HPE an d so I cannot update my system anymore…

    So I used the old files instead, which gives me undefines symbols:

    $ link/threads paho_cs_sub.obj,paho$root:[lib]libmqttv3cs.olb/lib,sys$input/opt
    sys$library:ssl$libssl_shr32.exe/share
    sys$library:ssl$libcrypto_shr32.exe/share
    %LINK-W-NUDFSYMS, 2 undefined symbols:
    %LINK-I-UDFSYM,         CRYPTO_THREADID_SET_CALLBACK
    %LINK-I-UDFSYM,         CRYPTO_THREADID_SET_NUMERIC
    %LINK-W-USEUNDEF, undefined symbol CRYPTO_THREADID_SET_NUMERIC referenced
            in psect $LINK$ offset %X000007E0
            in module SSLSocket file PAHO$ROOT:[lib]libmqttv3cs.olb;1 %LINK-W-USEUNDEF, undefined symbol CRYPTO_THREADID_SET_CALLBACK referenced
            in psect $LINK$ offset %X00000890
            in module SSLSocket file PAHO$ROOT:[lib]libmqttv3cs.olb;1

    This is not a big issue – as long as the programs that do not require encrypted communication can be build. And that is Ok.

    So I started the publication program:

    $ sho symb pub
    PUB = "$DISK$DAPHNE084:[MQTT.PAHO.EXAMPLES]PAHO_C_PUB.EXE"
    $ pub test --clientid ExampleClientPub
    Using topic test
    Connecting
    Failed to start connect, return code -13
    $

    It might be that I need to add credentials:

    $ pub test --clientid ExampleClientPub --username (username) --password (password)

    but that gives the same result

    Checked the log (after I enabled logging of connections) it shows a warning – which may point the cause:

    $ type dka0:[mqtt.mosquitto.logs]MOSQUITTO.LOG
    $ Set NoOn
    $ VERIFY = F$VERIFY(F$TRNLNM("SYLOGIN_VERIFY"))
    $
    $ mosquitto :== $mosquitto$root:[bin]mosquitto.exe
    $ mosquitto "-c" mosquitto$root:[conf]mosquitto.conf
    1533837960: mosquitto version 1.4.14 (build date 29-MAR-2018 02:52:02.10) starting
    1533837960: Config loaded from mosquitto$root:[conf]mosquitto.conf.
    1533837960: Opening ipv4 listen socket on port 1883.
    1533837960: Opening ipv4 listen socket on port 1883.
    1533837960: Warning: protocol wrong type for socket

    I did some more investigation – the subscriber program does connect – but wont’t show a result when a message is posted from the mobile phone (using MQTT Dashboard):

    $ sho sym sub
    SUB = "$DISK$DAPHNE084:[MQTT.PAHO.EXAMPLES]PAHO_C_SUB.EXE"
    $ sub ExampleClientsub --username (username) --password (password)


    and it will wait until cancelled)

    log shows it all: Connection failures and successes:

    1533841611: New connection from 82.161.236.244 on port 1883.
    1533841611: New client connected from 82.161.236.244 as ExampleClientPub1533841611246 (c1, k60, u'Willem ').
    1533841630: New connection from 82.161.236.244 on port 1883.
    1533841630: New client connected from 82.161.236.244 as ExampleClientSub1533841630615 (c1, k60, u'Willem ').
    1533841655: New connection from 127.0.0.1 on port 1883.
    1533841655: New client connected from 127.0.0.1 as stdout-subscriber-async (c1, k10, u'willem').
    1533841708: Client stdout-subscriber-async disconnected.
    1533841713: New connection from 127.0.0.1 on port 1883.
    1533841713: New client connected from 127.0.0.1 as stdout-subscriber-async (c1, k10, u'willem').
    1533841749: Client stdout-subscriber-async disconnected.
    1533841888: Client ExampleClientPub1533841611246 has exceeded timeout, disconnecting.
    1533841888: Socket error on client ExampleClientPub1533841611246, disconnecting.
    1533841892: Client ExampleClientSub1533841630615 has exceeded timeout, disconnecting.
    1533841892: Socket error on client ExampleClientSub1533841630615, disconnecting.
    1533841948: New connection from 127.0.0.1 on port 1883.
    1533841948: New client connected from 127.0.0.1 as stdout-subscriber-async (c1, k10, u'willem').
    1533841956: Client stdout-subscriber-async disconnected.
    1533841962: New connection from 127.0.0.1 on port 1883.
    1533841962: New client connected from 127.0.0.1 as stdout-subscriber-async (c1, k10, u'willem').
    1533841966: Client stdout-subscriber-async disconnected.

    (connectios on address 82.161.236.244 are from my mobile, 127.0.0.1 is from my VMS development system)

    and in TCPIP I see both connections when starting the reader (sub):

    TCPIP> sho dev

                                Port                       Remote
    Device_socket  Type    Local  Remote  Service           Host

    …
      bg581       STREAM    1883       0                   *
      bg678       STREAM   49159    1883                   127.0.0.1
      bg679       STREAM    1883   49159                   127.0.0.1
    …

    I tried to compile and link the publisher program – but the problem is within the MQTT library which has no debug information, nor do I have the Mosquitto code with the package, so some assistance of Brett Cameron is required.

    Mosquitto/Paho

    Project update
    a few months ago, I got new PCSI-files for Mosquitto and Paho-C, to update the environment. Copied the old examples since the new code-set requires another project to be installed and I haven’t done so yet. But building the samples doen’t work as expected, since there has been a change in the object library:

    $ link/threads paho_c_pub.obj,paho$root:[lib]libmqttv3c.olb/lib
    %LINK-W-NUDFSYMS, 6 undefined symbols:
    %LINK-I-UDFSYM, MQTTAsync_connect
    %LINK-I-UDFSYM, MQTTAsync_createWithOptions
    %LINK-I-UDFSYM, MQTTAsync_destroy
    %LINK-I-UDFSYM, MQTTAsync_disconnect
    %LINK-I-UDFSYM, MQTTAsync_send
    %LINK-I-UDFSYM, MQTTAsync_setCallbacks
    %LINK-W-USEUNDEF, undefined symbol MQTTAsync_connect referenced
    in psect $LINK$ offset %X00000060
    in module paho_c_pub file PAHO$ROOT:[000000.examples]paho_c_pub.OBJ;2
    %LINK-W-USEUNDEF, undefined symbol MQTTAsync_send referenced
    in psect $LINK$ offset %X000001C0
    in module paho_c_pub file PAHO$ROOT:[000000.examples]paho_c_pub.OBJ;2
    %LINK-W-USEUNDEF, undefined symbol MQTTAsync_disconnect referenced
    in psect $LINK$ offset %X000001E0
    in module paho_c_pub file PAHO$ROOT:[000000.examples]paho_c_pub.OBJ;2
    %LINK-W-USEUNDEF, undefined symbol MQTTAsync_destroy referenced
    in psect $LINK$ offset %X000001F0
    in module paho_c_pub file PAHO$ROOT:[000000.examples]paho_c_pub.OBJ;2
    %LINK-W-USEUNDEF, undefined symbol MQTTAsync_setCallbacks referenced
    in psect $LINK$ offset %X00000250
    in module paho_c_pub file PAHO$ROOT:[000000.examples]paho_c_pub.OBJ;2
    %LINK-W-USEUNDEF, undefined symbol MQTTAsync_createWithOptions referenced
    in psect $LINK$ offset %X000002C0
    in module paho_c_pub file PAHO$ROOT:[000000.examples]paho_c_pub.OBJ;2


    That is: on most on them. Some were fine.

    It turned out that where the older version had one object library, the new one has four:
    $ dir .olb

    Directory PAHO$ROOT:[lib]

    libmqttv3a.olb;1 libmqttv3as.olb;1 libmqttv3c.olb;1 libmqttv3cs.olb;1

    Total of 4 files.
    $ lib/list libmqttv3a.olb, libmqttv3as.olb
    %DCL-W-NOLIST, list of parameter values not allowed - check use of comma (,)
    \LIBMQTTV3A.OLB,LIBMQTTV3AS\
    $ lib/list libmqttv3a.olb
    Directory of ALPHA OBJECT library PAHO$ROOT:[lib]libmqttv3a.olb;1 on 5-AUG-2018 20:23:23
    Creation date: 29-MAR-2018 03:33:21 Creator: Librarian A09-32
    Revision date: 29-MAR-2018 03:33:21 Library format: 3.0
    Number of modules: 18 Max. key length: 128
    Other entries: 251 Preallocated index blocks: 213
    Recoverable deleted blocks: 0 Total index blocks used: 24
    Max. Number history records: 20 Library history records: 1

    Clients
    Heap
    LinkedList
    Log
    MQTTAsync
    MQTTPacket
    MQTTPacketOut
    MQTTPersistence
    MQTTPersistenceDefault
    MQTTProtocolClient
    MQTTProtocolOut
    Messages
    Socket
    SocketBuffer
    StackTrace
    Thread
    Tree
    utf-8
    $ lib/list libmqttv3as.olb
    Directory of ALPHA OBJECT library PAHO$ROOT:[lib]libmqttv3as.olb;1 on 5-AUG-2018 20:23:28
    Creation date: 29-MAR-2018 03:35:05 Creator: Librarian A09-32
    Revision date: 29-MAR-2018 03:35:05 Library format: 3.0
    Number of modules: 19 Max. key length: 128
    Other entries: 277 Preallocated index blocks: 213
    Recoverable deleted blocks: 0 Total index blocks used: 27
    Max. Number history records: 20 Library history records: 1

    Clients
    Heap
    LinkedList
    Log
    MQTTAsync
    MQTTPacket
    MQTTPacketOut
    MQTTPersistence
    MQTTPersistenceDefault
    MQTTProtocolClient
    MQTTProtocolOut
    Messages
    SSLSocket
    Socket
    SocketBuffer
    StackTrace
    Thread
    Tree
    utf-8
    $ lib/list libmqttv3c.olb
    Directory of ALPHA OBJECT library PAHO$ROOT:[lib]libmqttv3c.olb;1 on 5-AUG-2018 20:23:49
    Creation date: 29-MAR-2018 03:32:52 Creator: Librarian A09-32
    Revision date: 29-MAR-2018 03:32:52 Library format: 3.0
    Number of modules: 18 Max. key length: 128
    Other entries: 245 Preallocated index blocks: 213
    Recoverable deleted blocks: 0 Total index blocks used: 25
    Max. Number history records: 20 Library history records: 1

    Clients
    Heap
    LinkedList
    Log
    MQTTClient
    MQTTPacket
    MQTTPacketOut
    MQTTPersistence
    MQTTPersistenceDefault
    MQTTProtocolClient
    MQTTProtocolOut
    Messages
    Socket
    SocketBuffer
    StackTrace
    Thread
    Tree
    utf-8
    $ lib/list libmqttv3cs.olb
    Directory of ALPHA OBJECT library PAHO$ROOT:[lib]libmqttv3cs.olb;1 on 5-AUG-2018 20:23:53
    Creation date: 29-MAR-2018 03:34:12 Creator: Librarian A09-32
    Revision date: 29-MAR-2018 03:34:12 Library format: 3.0
    Number of modules: 19 Max. key length: 128
    Other entries: 271 Preallocated index blocks: 213
    Recoverable deleted blocks: 0 Total index blocks used: 29
    Max. Number history records: 20 Library history records: 1

    Clients
    Heap
    LinkedList
    Log
    MQTTClient
    MQTTPacket
    MQTTPacketOut
    MQTTPersistence
    MQTTPersistenceDefault
    MQTTProtocolClient
    MQTTProtocolOut
    Messages
    SSLSocket
    Socket
    SocketBuffer
    StackTrace
    Thread
    Tree
    utf-8
    $

    So I need to find out which library is to be used. But I won’t get any further without changing code, or install RabbitMQ (which holds MQTT as well). I may have to consult Brett for advise.

    On the other hand: the image in the Mosquitto package works fine, as well as the sample executables that come with the paho package. (the server is started with OpenVMS, via systartup_vms.com. But that was already set up when the original PCSI-files wore run to install them)

    03-Aug-2018

    Maintenance and updates
    Know since last post, there is a new version of WordPress, that I installed prior to this entry. No issues, as to be expected (so far).
    Last maintenance job had no surprises:

    PMAS statistics for July
    Total messages    :   2375 = 100.0 o/o
    DNS Blacklisted   :      0 =    .0 o/o (Files:  0)
    Relay attempts    :    485 =  20.4 o/o (Files: 31)
    Accepted by PMAS  :   1890 =  79.5 o/o (Files: 31)
      Handled by explicit rule
             Rejected :   1469 =  77.7 o/o (processed),  61.8 o/o (all)
             Accepted :     91 =   4.8 o/o (processed),   3.8 o/o (all)
      Handled by content
            Discarded :    189 =  10.0 o/o (processed),   7.9 o/o (all)
         Quarantained :    126 =   6.6 o/o (processed),   5.3 o/o (all)
            Delivered :     15 =    .7 o/o (processed),    .6 o/o (all)

    Just two days of over 150 relay attempts – from addresses owned by Hostwinds.com (USA) – as ususal trying a random choice of “users” in the grootersnet.nl domain, sending to 1029mandaditos@gmail.com:

  • 6-JUL-2018 07:25:43.45 – 6-JUL-2018 07:31:34.10 from 23.254.167.136 (182 attampts)
  • 23-JUL-2018 21:15:57.79 – 23-JUL-2018 21:22:00.25 from 142.11.195.132 (185 attempts)
  • There has been another one this time:

  • 28-JUL-2018 05:22:48.21 – 28-JUL-2018 13:37:31.45 from 95.216.32.207 (75 attempts)
  • Again, using non-existing users in my domain,. but this one seems to think this is a business site, The ‘users’ attemptes were possible departments and (presubaly privileged) users (some several times in a row), all trying to reach pastarleastan@gmail.com:
    webmaster, postmaster, admin, backup, canon, contact, copier, mail, marketing, test1, test2, info, office, prueba, reception, root, sales, scanner, service, support, teste, vendas, warehouse and Xerox

    There is some controiversy on this address when observing it via Robtex.com:

    95.216.32.207
    whois
    D2 Internet Investment Ukraine ETTH broadband
    route
    95.216.0.0/16
    bgp
    AS24940
    asname
    HETZNER-AS
    descr
    Dummy description for 95.216.0.0/16AS43659
    location
    Ukraine
    ptr
    static.207.32.216.95.clients.your-server.de
    a
    95.216.32.207

    Could it be a hacked DNS server in Ukraine??

    Certificates updated
    All certificates *except still for www.grootersnet.nl) have been updates successfully – twice: on 2-Aug-2018 I got the mails for the sites, and on 3-aug-2018 again. I didn’t expect the second ones to appear, since the day before the certificates have been renewed already, and should have been moved to thir location;
    FULLCHAIN_GENEALOGY_GROOTERSNET_NL.PEM;5
    2-AUG-2018 00:20:15.24
    FULLCHAIN_HOMEDESK_GROOTERSNET_NL.PEM;5
    2-AUG-2018 00:20:32.67
    FULLCHAIN_WEBMAIL_GROOTERSNET_NL.PEM;6
    2-AUG-2018 00:20:55.50

    But these do not exist in the location where they are created – there are the ones created a day later:
    FULLCHAIN_GENEALOGY_GROOTERSNET_NL.PEM;5
    3-AUG-2018 00:20:15.41
    FULLCHAIN_HOMEDESK_GROOTERSNET_NL.PEM;5
    3-AUG-2018 00:20:30.39
    FULLCHAIN_WEBMAIL_GROOTERSNET_NL.PEM;6
    3-AUG-2018 00:20:45.02

    Well, that may be the reason for the second run: if no files reside in there, they will be (re)created. However, these files have not been copied to the final destination …
    Well, it works so this is not a high priority issue. Just check WCME_LOAD: script to see if files are copied and after that, removed. That stap is not needed…

    Bringing nodejs to VMS?

    At work, colleagues are creating a web application using nodejs (https://nodejs.org) and I thought it a good idea to have this on VmS as well. After all, what OS is more suited for storing and accessing sensitive data the OpenVMS? However, you’ll need the tooling that is available on aother platforms as well. There is webserver (Apache, WASD (preferred), PHP, MariaDB … so why not node.js?
    At first glance, there are a “few” challenges, because node.js has dependencies – quite a lot – that need to be ported as well. One of whci is Google’s a javascript engine V8. (Being part of Chrome browser – why not port Chrome to VMS (just a thought)).

    I’ll see how this enfolds. No real plans – yet.

    Speaking of which: I mentioned I got new versions of Mosquitto and paho, but I ran into some issues with the libraries: Some functionality seems to be missing – in particular the asynchronous sending and receiving. But I hope to tackle that soon.