Secure Authentication and Cold Restart

197 views
Skip to first unread message

obinna Igbe

unread,
Jul 14, 2015, 5:34:47 PM7/14/15
to automat...@googlegroups.com
Hi all,

I am new to this branch of opendnp3. I will like to find out if :

  1. this branch supports secure authentication i.e one could enable this in the library. 
  2. one can send specific commands directly i.e on demand and not based on schedule.
  3. If the demo code responds to commands like cold restart.

Thanks in anticipation of your response.

Regards,
Obinna Igbe

J Adam Crain

unread,
Jul 14, 2015, 6:02:20 PM7/14/15
to automat...@googlegroups.com, obii...@gmail.com
1)

Not yet. It is under active development in the 'secauth' branch. Release is anticipated in Q3.

Be advised that I personally feel this is a standard that should be strongly avoided due to inherent architectural defects:


2)

One can perform a large number of operations on demand, but not arbitrary operations, e.g.:


3)

The demos ignore these commands, but the callback interface on the outstation allows you to override these methods in your own implementation:

obinna Igbe

unread,
Jul 15, 2015, 9:59:08 AM7/15/15
to automat...@googlegroups.com, obii...@gmail.com
Thanks Adam,

Just to be clear, for your answer to 3), you mean I can change: 

virtual RestartMode ColdRestartSupport() const override final { return RestartMode::UNSUPPORTED; } in line 86 of OutstaionApplication.h to say

virtual RestartMode ColdRestartSupport() const override final { return RestartMode::SUPPORTED_DELAY_FINE; }

in other to enable cold restart in my implementation i.e to make my outstation to perform a restart when it receives such code from the master?

J Adam Crain

unread,
Jul 15, 2015, 10:18:03 AM7/15/15
to automat...@googlegroups.com, obii...@gmail.com
You need to do that and also implement the shutdown/restart behavior by also overriding this method:


The code will not shutdown the process for you, it merely provides the hooks for you to receive the notifications. The proper procedure for shutting down a whole process or even rebooting a device is something only the integration of the library can define.

obinna Igbe

unread,
Sep 6, 2015, 9:30:54 PM9/6/15
to automatak-dnp3, obii...@gmail.com
Hi Adam,

I tried enabling the cold restart in the current outstation demo.

with no modification to your code, If I compile both demomain.cpp (that of outstation and that of master), I get the error on the master when I try the case "r" that:

ms(1441586138276) WARN    tcpclient - Task was explicitly rejected via response with error IIN bit(s): cold restart


so I did the override of the ColdRestartSupport as you suggested in the previous comments in this thread. This is how i did it. 


     
 
class myoutstation : public IOutstationApplication
{
public:
RestartMode ColdRestartSupport() const
{
return RestartMode::SUPPORTED_DELAY_FINE;
}

#static IOutstationApplication& Instance();
uint16_t ColdRestart()
{
return 65535;
}


};


2) I created an instance of this myoutstation called it "myoutstation1".

     
auto pOutstation = pChannel->AddOutstation("outstation", SuccessCommandHandler::Instance(), myoutstation1, stackConfig);

and now the response I get on the master output screen is:
ms(1441586765597) WARN    tcpclient - Received unexpected response object headers for task: cold restart

I guess this means that first, the cold restart have been enabled, but returning the wrong thing or something like that.

Note: I used your new function 
pMaster->PerformFunction("cold restart", FunctionCode::COLD_RESTART, {});


I want to be able to send the cold restart function and get a good response even though I don't implement the full shut down procedure. i.e., I want to get something on the master screen (a print out) that tells me what time the outstation would be shutting down or at least an indication that the command was successful instead of a  warning. How can I achieve this? thanks

J Adam Crain

unread,
Sep 8, 2015, 12:40:45 PM9/8/15
to automatak-dnp3, obii...@gmail.com
Hi Obinna,

You're right. When I recommened this path, I forgot that the response to Cold/Warm restart contains a time object that tells the master how long the restart will take to complete.

I added a custom task just for restart:


The callback allows you receive the actual time returned from the outstation:


-Adam

obinna Igbe

unread,
Sep 8, 2015, 7:04:07 PM9/8/15
to automatak-dnp3, obii...@gmail.com
Hi Adam thanks for the swift reply.

1 more  question.

This is how I plan on implementing this. Am totally new to C++ and this branch, ( but I guess I have survived uptill now ; thanks for your help):

1) I will create a new class called "mycallback" which inherits from the RestartOperationResult class. Then add the line inside it as shown below:


class mycallback : public RestartOperationResult
{
public:
 
   openpal::TimeDuration restartTime;
   
  restartTime=TimeDuration::Seconds(2)

};


2) Take an instance of the class I called mycallback using :
mycallback callbck

3) create a task in the master using:

        auto restart = pMaster->Restart(COLD, callbck.restartTime);

4. Then finally use restart.Demand();  to invoke it similar to what you did in the master's DemoMain.cpp

Is my steps ok? I feel I have done -->this in red wrongly or the class above--> Restart(COLD, callbck.restartTime). Remember I want to receive actual time from the outstation. Don't I have to do something at the outstation end? As in, don't I have to set the restart time from the outstation end and not from the master? Thanks and forgive my little knowledge in C++, I code in Python.

Adam Crain

unread,
Sep 8, 2015, 10:05:18 PM9/8/15
to automatak-dnp3, obii...@gmail.com
Hi Obinna,

I've updated the master demo app to use the new Restart Task:


The callback you pass in (in this case called 'print') is a c++11 lamda expression. It's just a block of code that gets executed when the task completes (success or failure).

In this case it just prints summary information about the result.

-Adam
Reply all
Reply to author
Forward
0 new messages