0

How do I start a netconf session using Indy's TIdTCPClient (or, if that is not the correct library to use, please tell me what I should be using instead)?

I am attempting to write a FireMonkey application (Windows, Android, iOS) application using CppBuilder. I can connect to the device no problem but get stuck from there. I do not know how to create a session and start the subsystem.

According to RFC 6242, I need to do the following:

After the ssh-connection service is established, the SSH client will open a channel of type "session", which will result in an SSH session. Once the SSH session has been established, the NETCONF client will invoke NETCONF as an SSH subsystem called "netconf". Subsystem support is a feature of SSH version 2 (SSHv2) and is not included in SSHv1. Running NETCONF as an SSH subsystem avoids the need for the script to recognize shell prompts or skip over extraneous information, such as a system message that is sent at shell start-up.

My connection code is as follows:

    client = new TIdTCPClient(NULL);
    client->Host = host;
    client->Port = port;
    
    // Create the SSL context and assign it to the client
    ssl = new TIdSSLIOHandlerSocketOpenSSL(NULL);
    ssl->SSLOptions->Method = sslvTLSv1_2;
    ssl->OnGetPassword = OpenSSL1GetPassword;
    client->IOHandler = ssl;

    // Connect to the NETCONF server
    client->Connect();

I cannot figure out what goes next.

Brian P.
  • 206
  • 3
  • 14
  • At this time, Indy does not support anything SSH-related. NETCONF itself is just XML data, so you can easily use that over TCP, however RFC 6242 incorporates that XML data into SSH itself, which you can't do with Indy unless you implement SSH yourself (ie, by writing a `TIdSSLIOHandlerSocketBase`-derived class that uses relevant SSH APIs, like from the OpenSSH library, to encrypt/secure a TCP socket connection). SSL/TLS and SSH are completely different and unrelated things, so you can't use OpenSSL (via `TIdSSLIOHandlerSocketOpenSSL`) for this task. – Remy Lebeau Apr 11 '23 at 18:23

0 Answers0