Join the Conversation

To sign in, use your existing MySonicWall account. To create a free MySonicWall account click "Register".

Auth API and Non-Config Mode in Gen7/NSv 270

Hello, I am working on some Python code to help with several migrations from NSa Appliances to NSv 270.

I have noticed that when connecting to the NSv, I will often get placed in "Non Config Mode" regardless of method of login (Digest vs. Basic) and the only way to resolve it, is to log in to the MGMT UI first, then connect from the same machine to the API using the script.

Non-Config example output:

{
  "status": {
    "success": true,
    "info": [
      {
        "level": "info",
        "code": "E_OK",
        "auth_code": "API_AUTH_CAN_PREEMPT",
        "config_mode": "No",
        "read_only": "No",
        "privilege": "FULL_ADMIN",
        "curr_config_type": "NONE",
        "curr_config_ip": "0.0.0.0",
        "model": "NSv 270",
        "is_fw_managed_by_gms_actively": false,
        "auto_ffw_upgrading": false,
        "auto_upgrade_vers": "",
        "inactivity_timer": 15,
        "message": "User login in non-configuration mode."
      }
    ]
  }
}

Config mode example output:

{
  "status": {
    "success": true,
    "info": [
      {
        "level": "info",
        "code": "E_OK",
        "auth_code": "API_AUTH_SUCCESS",
        "config_mode": "Yes",
        "read_only": "No",
        "privilege": "FULL_ADMIN",
        "model": "NSv 270",
        "is_fw_managed_by_gms_actively": false,
        "auto_ffw_upgrading": false,
        "auto_upgrade_vers": "",
        "inactivity_timer": 15,
        "message": "Success."
      }
    ]
  }
}

Is there a way to automatically preempt and switch to config mode once I get connected?

For the record I am using Python3 with my own API client to connect: https://github.com/hbonath/sonicapi

I do not have this issue with Gen6 devices.

Category: Developer Hub
Reply

Best Answer

  • CORRECT ANSWER
    JaimeJaime SonicWall Employee
    Accepted Answer

    Hi @hbonath,

    There are a couple of options.

    1. You can send {"override": True} in your POST to /auth. This will log you in with config mode.
    2. You can extract the message to identify if you were logged in with config mode or non-config mode and send a POST to /config-mode to switch to config mode.

    HTH.

    Jaime

Answers

  • hbonathhbonath Newbie ✭

    Thank you @Jaime for the quick and extremely helpful response!

    Right as you posted this I found the reference to `/config-mode` in the API Spec file: https://sonicos-api.sonicwall.com/sonicos_files/default/sonicos_openapi.yml and I have added that method to my API client.

    I probably should update my auth method to allow the override to be set as well, seeing as how this appears to be brand new and didn't appear to be an issue in Gen6.

  • JaimeJaime SonicWall Employee

    Just FYI, the override is also available on Gen6 and doesn't hurt to include it. I usually make it a point to add the override in my scripts.

Sign In or Register to comment.