HTTP Shutdown command

Status
Not open for further replies.

tmacka88

Patron
Joined
Jul 5, 2011
Messages
268
Ok so im using a universal remote "iRule" with iPad and I am to make a shutdown command button so I can turn off my NAS through this remote by pushing a button.

I know that you can shutdown freenas through the browser by typing IP http://192.168.2.141/system/shutdown/ but with a password on the system I have done this

so im an trying to put the above into a HTTP command to shutdown with password/user name.

I have tryed this

admin:my_password/system/shutdown/

http://admin:my_password@192.168.2.141/system/shutdown/

but nothing seems to work. The gateway is setup to the ip above so i dont think i need the IP in the command.


any ideas

thanks
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
You won't be able to do it this way because when you login it's passed from a from and stored as a session in the FreeNAS database. I know there's a solution, but my brain is a bit foggy at the moment and it's not coming to me. Maybe William, one of the developers, will read this and offer a suggestion.
 

tmacka88

Patron
Joined
Jul 5, 2011
Messages
268
would be good to find a way that I can do this though.
 

William Grzybowski

Wizard
iXsystems
Joined
May 27, 2011
Messages
1,754
It is impossible unless you implement some client library using cURL or something alike...

In 8.2 or 8.3 we will make an API available in JSON-RPC for such things, but you will still need a script/program.

Login through http://user:pass@ which is the so called Http Auth Basic is not enabled in freenas and probably never will due to security reasons...
 

tmacka88

Patron
Joined
Jul 5, 2011
Messages
268
How about with 8.2 plugins. Is there a plugin that would do the job.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Plugins wouldn't really help much either because they're isolated inside the plugin jail with restricted privileges. What you could do IF your iRule supports SSH, would be to set up ssh keys and have the button send a shutdown command over ssh. If you really weren't worried about security, you could just allow root logins over ssh (without a password) and send the command that way. Probably for testing it would be easier to do the root login method until you get things working, then switch over to ssh keys. I just did a quick search and it looks like the iRule has the ability to use ssh, so that would be the way I'd go.

The command would look something like "ssh root@ip-address shutdown -p now"
 
Status
Not open for further replies.
Top