Help with templates

I am trying to write a template that will change PMP450 login passwords. 

Below is a test template that I belive should set the "admin" account's password to "password", but it doesn't seem to work. When I try to push the template out to an SM, half the time it comes back with "config import failed".  If I keep trying, it sometimes comes back with "UpdateComplete", but the actual password in the radio was not changed.

What I am doing wrong?

{
        "authenticationConfig": {
            "accounts": [
                {
                    "userName": "admin",
                    "level": 3,
                    "readOnly": false,
                    "passwordEncrypted": "ba9122c25780be0f289120c382646277"
                }
            ]
        },
	"cfgFileString": "Canopy configuration file",
	"cfgFileVersion": "1.0"
}

Try the below template.  I placed authenticationConfig within "userParameters".

{
	"userParameters": {
		"authenticationConfig": {
			"accounts": [{
				"userName": "admin",
				"level": 3,
				"readOnly": false,
				"passwordEncrypted": "ba9122c25780be0f289120c382646277"
			}]
		}
	},
	"cfgFileString": "Canopy configuration file",
	"cfgFileVersion": "1.0"
}

That worked perfectly.  Thank you!

1 Like

You're welcome.  Glad it worked.

For PMP templates, configuration always goes within "userParameters".  It's easy to distrupt the structure when creating a template though, especially if it goes a couple levels in.

Tools like https://jsonlint.com/ can help a little with this.  You can use the expansion triangles on the left-hand side next to the line numbers to expand/collapse levels to get a better idea of what the nesting structure actually is.

Whats the chance of getting a device verification tool. I just found out half my template wasnt applying because i didnt have a component, it didnt fail or error. Will turning on debugging in logs of a device show this?

Hi ,

The extra components will be discarded ideally by the devices itself while applying the templates. CnMaestro checks for the JSON validity of the template and if any errors are there cnmaestro will fail the template push to the device and will show the errors returned by the device in the config push job.

Thanks,
KR.

Hi maxwire,

Yes, turning on debug logs in the device will show additional information in the Device Agent logs which may prove useful. The cnMaestro job details should also show any error that would fail the configuration update.

However, for components in the JSON template not recognized by the device (maybe due to a misspelling or incorrect placement) errors will not be triggered as noted by KR.

Would be nice to have a tool, we drop our JSON into it and it spits out what config changes it would result in. in my case I had missed putting in “smRadioConfig”: { so nothing in that section was actually applying. It wasnt until I tried changing the CC to a variable that I realized it wasnt actually applying. the option was there in the template application because its a variable, but it didnt actually submit it to the radio

1 Like

That is a very interesting idea. I recommend posting this to the Ideas section and mention both cnMaestro and PMP since this would be useful in cnMaestro and in the device itself.

1 Like

Can you help me with a code to change admin user password to 123456789 and also activate installer account with password 123456 and readonly account with password 0987654 - all for ePMP

Thanks

I got it this and this should work but there is a line under each account missing & needed to enable or disable the account…Please help

{
“device_props”: {
“authenticationConfig”: {
“accounts”: [{
“userName”: “admin”,
“passwordEncrypted”: “123456789”
}, {
“userName”: “installer”,
“passwordEncrypted”: “123456”
}, {
“userName”: “readonly”,
“passwordEncrypted”: “0987654”
}]
}
}

}

Hi @Fobasanjo,

The format for ePMP is different than the PMP template used earlier in this thread. Try something like the below.

You will need to set the desired passwords in a test ePMP device and export the configuration in order to get the hashed passwords for use in a template.

I got this JSON by exporting configuration from an ePMP device. In cnMaestro this is on the device Configuration tab > View Configuration. In the device web UI this is Tools > Backup / Restore > Backup Configuration > Download. Remove configuration settings you don’t want in the template.

{
	"device_props": {
		"cambiumSysAccountsTable": [
		  {
			"cambiumSysAccountsName":	"admin",
			"cambiumSysAccountsHash":	"$1$Q4yAUtfC$E0acJjgS3LxPdxVTghsYh.",
			"cambiumSysAccountsUID":	"1000",
			"cambiumSysAccountsGID":	"4",
			"cambiumSysAccountsDir":	"\/tmp",
			"cambiumSysAccountsShell":	"\/usr\/bin\/clish"
		  },
		  {
			"cambiumSysAccountsName":	"installer",
			"cambiumSysAccountsHash":	"$1$yHIXrXnB$tr\/Na771wSO4\/dv8yCvmU\/",
			"cambiumSysAccountsUID":	"2000",
			"cambiumSysAccountsGID":	"100",
			"cambiumSysAccountsDir":	"\/tmp",
			"cambiumSysAccountsShell":	"\/bin\/false"
		  },
		  {
			"cambiumSysAccountsName":	"home",
			"cambiumSysAccountsHash":	"$1$\/Bv9wvkq$5lBZqqsoAJj4uYOhb7pOS0",
			"cambiumSysAccountsUID":	"3000",
			"cambiumSysAccountsGID":	"100",
			"cambiumSysAccountsDir":	"\/tmp",
			"cambiumSysAccountsShell":	"\/bin\/false"
		  },
		  {
			"cambiumSysAccountsName":	"readonly",
			"cambiumSysAccountsHash":	"$1$zn4\/PlCl$1qP9PGmPChDwkDAgp5Qgw0",
			"cambiumSysAccountsUID":	"4000",
			"cambiumSysAccountsGID":	"100",
			"cambiumSysAccountsDir":	"\/tmp",
			"cambiumSysAccountsShell":	"\/bin\/false"
		  },
		  {
			"cambiumSysAccountsName":	"dashboard",
			"cambiumSysAccountsHash":	"$1$Y9oz6eRg$ysokBk9VZCGo4AN6WQgVF0",
			"cambiumSysAccountsUID":	"5000",
			"cambiumSysAccountsGID":	"100",
			"cambiumSysAccountsDir":	"\/tmp",
			"cambiumSysAccountsShell":	"\/bin\/false"
		  }
		]
	}
}

1 Like