Reply

Re: Command line shutdown since 6.9.3

Xatosch
Apprentice

Command line shutdown since 6.9.3

Hi....

today I have updated from 6.9.2. to 6.9.3 and now I can't shutdown the device via a powershell script, I have get the message:

Invoke-RestMethod : 
403 Forbidden
Forbidden
You don't have permission to access /dbbroker
on this server.
Apache/2.2.34 (Debian) Server at sirius Port 443
In C:\Users\pixan\Documents\Computer\Scripts\sirius_off.ps1:36 Zeichen:1
+ Invoke-RestMethod -Credential $Credential -Headers $Headers -Uri $Uri ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

anyone a solution for this...

 

the script

$Hostname = "sirius"
$Username = "admin"
$Password = ConvertTo-SecureString "TopSecret" -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential($Username, $Password)
$Headers = @{ "Content-Type" = "application/x-www-form-urlencoded"; "X-Requested-With" = "XMLHttpRequest" }
$Xml = '<?xml version="1.0" encoding="UTF-8"?><xs:nml xmlns:xs="http://www.netgear.com/protocol/transaction/NMLSchema-0.9" xmlns="urn:netgear:nas:readynasd" src="dpv_1368497621000" dst="nas"><xs:transaction id="njl_id_1278"><xs:custom id="njl_id_1277" name="Halt" resource-id="Shutdown" resource-type="System"><Shutdown halt="true" fsck="false"/></xs:custom></xs:transaction></xs:nml>'
$Uri = "https://$Hostname/dbbroker"

Add-Type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    public class TrustAllCertsPolicy : ICertificatePolicy {
        public bool CheckValidationResult(
            ServicePoint srvPoint, X509Certificate certificate,
            WebRequest request, int certificateProblem) {
            return true;
        }
    }
"@

[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

Invoke-RestMethod -Credential $Credential -Headers $Headers -Uri $Uri -Method Post -Body $Xml

Write-Host "done"
Model: RN51661D|ReadyNAS 516 6-Bay
Message 1 of 7
Aemstel
Tutor

Re: Command line shutdown since 6.9.3

I have the exact same issue since installing 6.9.3. Permission denied on /dbbroker. I am also experiencing connection issues now with NAS Utils app for android, which worked fine before. I really need to be able to shutdown the NAS remotely, so I tried installing firmware 6.9.2 again, but I can't. It throws an unexpected error when I try that.

 

edit:

When I visited the admin page again to shut it down, I got the firmware install dialog after all. So I went ahead with it. 6.9.2 installed ok. I can now also once again remotely shutdown the NAS from the commandline. So it's definately a 6.9.3 issue. I will stay with 6.9.2 until this (hopefully) gets fixed.

Model: RN104|ReadyNAS 100 Series
Message 2 of 7
Xatosch
Apprentice

Re: Command line shutdown since 6.9.3

Going back to 6.9.2 was a very good idea Cat Tongue

Message 3 of 7
mdgm-ntgr
NETGEAR Employee Retired

Re: Command line shutdown since 6.9.3

This sounds like it might be related to a security change in 6.9.3.

Message 4 of 7
Aemstel
Tutor

Re: Command line shutdown since 6.9.3

I am using a Windows 10 PC. I had created a batch file on it, which I can run remotely using my phone. It is a similar script as the one posted by Xatosch. Got it from here: https://community.netgear.com/t5/Using-your-ReadyNAS/Remote-shutdown-on-OS-6/td-p/846137. This, as mentioned, no longer works in 6.9.3.

 

Indeed, the cause of it not working any longer might very well be a security fix. If so, do you perhaps know of another way to shut the NAS down with a batch file? Or does anyone else?

 

 

 

 

Model: RN104|ReadyNAS 100 Series
Message 5 of 7
mdgm-ntgr
NETGEAR Employee Retired

Re: Command line shutdown since 6.9.3

Your script will need to become a bit longer. See Curl does not work any more since upgrade to 6.9.3 on RN316

Message 6 of 7
Aemstel
Tutor

Re: Command line shutdown since 6.9.3

Thank you mdgm!

Message 7 of 7
Top Contributors
Discussion stats
  • 6 replies
  • 1661 views
  • 1 kudo
  • 3 in conversation
Announcements