×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Indi Web Manager Shut down button for Pi

  • Posts: 34
  • Thank you received: 3
Hello All!

I´m talking about a remote session with Windows KStars and an INDI-Server running on a Pi.

When the astro-session is finished, it would be the easy to shut down the Pi by a Button that is integrated in the INDI Web Manager.
Up to now I then start VNC, log in into Ubunto Desktop and start the shutdown-sequence from there. A bit laboratious, isn´t it ?

Because I´m new to INDI, perhaps someone has a better way for me.

CS
Reiner
4 years 2 months ago #47759

Please Log in or Create an account to join the conversation.

  • Posts: 554
  • Thank you received: 138
You already have it. I added this to indiweb a few weeks ago. Actually two buttons, Reboot and PowerOff. I did this so I could close down a headless Pi Zero.

However I thinnk there may be problems, the system seems reluctant to run these from a remote system. It's a bit strange because someties it works and sometimes not.
I need to investigate a bit more, or perhaps someone has an idea.
4 years 2 months ago #47765

Please Log in or Create an account to join the conversation.

  • Posts: 34
  • Thank you received: 3
Mmmh,

I use the astroberry and yesterday I did an update and upgrade. But there I can´t find such Buttons
4 years 2 months ago #47772

Please Log in or Create an account to join the conversation.

  • Posts: 983
  • Thank you received: 375
Two things to note:
1) INDI Web Manager is not updated with regular apt updates, to update it you have to run: sudo pip3 install --upgrade indiweb
2) I was not aware of the latest change in INDI Web Manager, but have just looked at the code and reboot/poweroff functionality is there. There are no buttons, but you can trigger action by API call, namely:
- http://localhost:8624/api/system/reboot
- http://localhost:8624/api/system/poweroff

You should replace localhost with astroberry.local if you run these commands remotely.

BTW. I believe these calls constitute a security risk, because there is no API authorization, so anyone that has access to your system over network can shut it down or reboot :-/
4 years 2 months ago #47785

Please Log in or Create an account to join the conversation.

  • Posts: 34
  • Thank you received: 3
Hi Radek,

I tried that:
Sorry, the requested URL 'http://192.168.2.155:8624/api/system/poweroff' caused an error:
Not found: '/api/system/poweroff'

The Indi Web Manager seams to be up to date:

astroberry@astroberry:~ $ sudo pip3 install --upgrade indiweb
[sudo] Passwort für astroberry:
Looking in indexes: pypi.org/simple, www.piwheels.org/simple
Requirement already up-to-date: indiweb in /usr/local/lib/python3.7/dist-packages (0.1.6)
Requirement already satisfied, skipping upgrade: psutil in /usr/lib/python3/dist-packages (from indiweb) (5.5.1)
Requirement already satisfied, skipping upgrade: requests in /usr/lib/python3/dist-packages (from indiweb) (2.21.0)
Requirement already satisfied, skipping upgrade: bottle in /usr/lib/python3/dist-packages (from indiweb) (0.12.15)
astroberry@astroberry:~ $

CS
Reiner
4 years 2 months ago #47787

Please Log in or Create an account to join the conversation.

  • Posts: 983
  • Thank you received: 375
As the matter of fact I also got this error. @ChrisRowland can you comment on this?
4 years 2 months ago #47789

Please Log in or Create an account to join the conversation.

  • Posts: 554
  • Thank you received: 138
Not sure because the error you get seems to say that the command is not present. This is what you can expect to get if the previous version of Indiweb which doesn't have this command is being used.

However as I said above I've had problems getting reboot and poweroff to work because of security. I would expect this to give a different error but you never know.

The corresponding web interface .tpl and .js files have a couple of buttons implemented. If you aren't seeing this then perhaps there's a snag with what's installed.

The whole security business seems more complex than I thought, you may find that running locally will be fine but sending the commands to another system fails with security issues. I also found that the behaviour was different using the command that Radorek describes and the web interface.

The whole security issue with remote access seems strange. If you are local then reboot and poweroff just run from a normal user account. If you are connecting remotely using VNC the same applies. But with ssh, running as apparently the same user, they fail because of security and you need sudo reboot plus a password.

I'll try to look at this some more and find ways round these issues. I'd prefer not to run the system with no security at all although if, like me the remote system is a Pi Zero running indiserver and a telescope driver there's minimal implications.

If anyone wants to help feel free. That's the point of open source software.
4 years 2 months ago #47810

Please Log in or Create an account to join the conversation.

  • Posts: 407
  • Thank you received: 74
Dont know if it could be incorporated into Indi Web interface but you can using SSH without a password to shutdown/reboot a remote PI without compromising security

Read this www.raspberrypi.org/documentation/remote.../ssh/passwordless.md

BUT user is running client on Windows which means you will have to install SSH client (e.g. PUTTY) - and no PUTTY is not a virus its been around for years :-) Although I believe MS have OpenSSH as an option now days - never used their version.

Putty just issues a command via CLI - so REBOOT SHUTDOWN no problem and this can be incorporated into a PUTTY profile for the required RPI so once set up you can just create a simple Windows job to call Putty with the profile. Works 99.99999% of the time

As I say not sure if that could be incorporated into a browser back end.

Might help.
RPI3 Ubuntu 16.04 / AMD desktop Kstars under Ubuntu 16.04 Mounts :azeq6 ,SWAZGoTo

RPI3 Fedora testing out on AMD desktop Fedpra 28 - running kstars 2.9.4 , Indilib 1.7.4 ?????
4 years 2 months ago #47811

Please Log in or Create an account to join the conversation.

  • Posts: 983
  • Thank you received: 375
So it seems that pip does not install the latest INDI Web Manager.
4 years 2 months ago #47824

Please Log in or Create an account to join the conversation.

  • Posts: 554
  • Thank you received: 138
I posted a fairly lengthy message which seems to have vanished.
In brief:
Stash's suggestion works for getting SSH to start without needing a password but the reboot and poweroff commands still need sudo support.
sudo visudo can be used to add an exception for the reboot and poweroff commands.
This gives the ability to reboot or poweroff from a .bat or .sh script, maybe as part of the Ekos close down.
I think Indiweb needs sudo adding to the commands to make them work but I wonder if that's needed. I thought it would be an easier way to implement power off and now I'm not so sure.

I've no idea why pip doesn't install this, my code has been pushed to indiwebmanager and that's all I can do.

I don't see a security issue with this, it requires a number of deliberate steps to implement and if you don't want it then don't do them.
4 years 2 months ago #47829

Please Log in or Create an account to join the conversation.

  • Posts: 34
  • Thank you received: 3
In parallel I´ve took a look on indigo, wich also is based on indi (as I understand)
Here I have the function reboot and shutdown in the server area. And it works perfect.
So this shoud be possible
4 years 2 months ago #47835

Please Log in or Create an account to join the conversation.

  • Posts: 407
  • Thank you received: 74

Well there is - after some testing and trying to find my old RPI Zero SD card (overwritten) you can - well with Windows Putty - have a Putty profile that contains the command to issue - e.g. sudo reboot or sudo shutdown -h now and it logs in with Private keys and issues the command AND does not ask for a password. It then does command in the putty profile.

NOTE THIS IS VERY VERY VERY OPEN TO HACKERS ETC ETC AND YOU DO IT AT YOUR RISK - hell what's a bit of risk. OK a lot as you/anyone can do anything - you did say you didn't care about security LOL. SO PLEASE OTHER USERS DO NOT TELL ME THE OBVIOUS SECURITY PROBLEMS.

Key is alter the sudoers file ( I use an extra file in /etc/sudoers.d which contains astroberry ALL=(ALL:ALL) NOPASSWD: ALL

No idea if you can create a backend script or a bit of Javascript to enable stop/reboot via Web HTML etc but from Windows you just create a command line for putty o start with a set profile name - \path\name\to\putty.exe -load "mysession" where mysession is the saved profile name.

I tested this on a RPI zero(W) running headless and connecting to my local WiFi. Still allows Astroberry/Indi Web etc and even NOVNC (no desktop just black screen in centre obviously)
RPI3 Ubuntu 16.04 / AMD desktop Kstars under Ubuntu 16.04 Mounts :azeq6 ,SWAZGoTo

RPI3 Fedora testing out on AMD desktop Fedpra 28 - running kstars 2.9.4 , Indilib 1.7.4 ?????
4 years 2 months ago #47961

Please Log in or Create an account to join the conversation.

Time to create page: 1.003 seconds