maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   ssh-status AKA "SSH Status and Switcher" (https://talk.maemo.org/showthread.php?t=91472)

int_ua 2013-09-27 07:43

ssh-status AKA "SSH Status and Switcher"
 
https://gitorious.org/n900-ssh-statu...ssh-status-tmp
http://maemo.org/downloads/product/Maemo5/ssh-status/
http://maemo.org/packages/view/ssh-status/
https://garage.maemo.org/projects/ssh-status/

To prevent sshd from starting comment/remove "start on ..." line from /etc/event.d/sshd


It's almost perfect as it is in 0.1-9 but I wanted to add just one more line to the stopping code:
Code:

killall sshd
Which should kill any active connection also. Any objections?

I've contacted Andrei and he said he wouldn't mind me uploading a new version.

mr_pingu 2013-09-27 08:17

Re: ssh-status AKA "SSH Status and Switcher"
 
Yes please :)

peterleinchen 2013-09-27 08:40

Re: ssh-status AKA "SSH Status and Switcher"
 
@int_ua
If you are already on it, would you mind to insert a config (e.g. simple and easy check for presence of file [enable: touch ssh_on_reboot]) to have ssh aauto started after reboot?
Since some version, it was disabled. I made me a workaround (I cannot remember right now ;)) to have ssh on automatically after boot.

Regarding your question:
this would kill also outgoing self-established connections? Then against it.
Or just the listening daemon (with all incoming connections)? Then agreed.
But I could also imagine there are use cases to stop the daemon to disable further incoming connections, but keep the already existing alive.
So better wait for more input.

int_ua 2013-09-28 05:58

Re: ssh-status AKA "SSH Status and Switcher"
 
Quote:

Originally Posted by peterleinchen (Post 1377157)
check for presence of file [enable: touch ssh_on_reboot]) to have ssh aauto started after reboot?
Since some version, it was disabled. I made me a workaround (I cannot remember right now ;)) to have ssh on automatically after boot.

Yes I'll try. Please add your workaround here for anyone else till I get to it.
Quote:

Originally Posted by peterleinchen (Post 1377157)
there are use cases to stop the daemon to disable further incoming connections, but keep the already existing alive.

That's a very good point... Looks like it needs a separate button.

peterleinchen 2013-09-28 19:04

Re: ssh-status AKA "SSH Status and Switcher"
 
Sorry for late reply, but I needed to check a few things and tried to remember, what I had done.
I remember to have checked some sources, but to no avail (two? years ago?). And found that a simple one-liner '/sbin/initctl start sshd' in one of my customization init scripts did the trick. One negative downside is that sshd status ui does show 'status off' after reboot, but actually it's status is on (something I could/can live with).


Code:

description "starting my own mounts and swaps"

author "peterleinchen"

#start on MOUNTS_OK
start on started ke-recv
stop on starting shutdown

console output
env logFile=/dev/null
#env logFile=/home/user/.out_mystart


pre-start script

if [ -f $logFile.3 ]
then
  rm $logFile.3
fi
  if [ -f $logFile.2 ]
  then
    mv $logFile.2 $logFile.3
  fi
    if [ -f $logFile.1 ]
    then
      mv $logFile.1 $logFile.2
    fi
      if [ -f $logFile ]
      then
        mv $logFile $logFile.1
      fi

echo prestart `date` >> $logFile

# mmc(s) should be mounted after ke-recv has started, but currently
# started notification seems to be emitted before it's actually ready.
# this is a temporary workaround, we should fix this in ke-recv or c-r
# properly.
# peterleinchen:
#        sleep 4
# under heavy startup conditions (lots of daemons installed)
# our N900 (ke-recv daemon) may/will need more than 4s, so I used 30s
##        sleep 30
# but now I will check for eMMC and/or SD to be mounted
        sleep 4
       
end script


script

echo start `date` >> $logFile

  # start up ssh server
echo start up SSH server >> $logFile
  initctl start sshd
 
end script


nokiabot 2013-09-29 15:35

Re: ssh-status AKA "SSH Status and Switcher"
 
keep going:)

int_ua 2013-10-01 03:00

Re: ssh-status AKA "SSH Status and Switcher"
 
Quote:

Originally Posted by peterleinchen (Post 1377157)
to have ssh aauto started after reboot?
Since some version, it was disabled.

Actually, why wouldn't it start?
http://talk.maemo.org/showpost.php?p...6&postcount=12
Now I think it's not the task for this package after all, it's just status and switcher.

peterleinchen 2013-10-01 14:21

Re: ssh-status AKA "SSH Status and Switcher"
 
@int_ua
Dumb me checked the debian control file just after removing/rebooting (sshd DID start) and/but after reinstalling/reboot (did NOT start) to check once again:
Quote:

Maemo-Upgrade-Description: NEW: SSH service switch OFF on start up
Maemo-Upgrade-Description-Ru_ru: Новое: SSH сервис выключается при запуске
And it is like described. So you need to check once more to get it. I did not see anything in the deb package to prevent sshd get started, so it must be included in the sources.

int_ua 2013-10-02 07:15

Re: ssh-status AKA "SSH Status and Switcher"
 
Quote:

Originally Posted by peterleinchen (Post 1378028)
check once again

Indeed, thanks, it's in the C code, plain
Code:

system("sudo /usr/sbin/ssh-status.sh stop")
I'll move it to the postinst script since all the previous users may be still wanting this functionality.

Currently I'm having troubles working with SDK being unable to work with sudo even after replacing it with fakeroot.
http://maemo.org/community/maemo-dev...ysklogd_fails/

Update:
But sshd just ignores whole /etc/init.d/ssh on the start making /etc/ssh/sshd_not_to_be_run pointless. See /etc/event.d/sshd

Update 2: I've sent a mail to the maintainer

int_ua 2013-10-05 06:24

Re: ssh-status AKA "SSH Status and Switcher"
 
Update: there are some files that weren't added to git, working on it.

FTBFS.
I've started with removing the code that stops sshd and fixing openssh-server that inores /etc/ssh/sshd_not_to_be_run but it failed to build with
Quote:

make: *** No rule to make target `configure', needed by `config.status'. Stop.
and it's from debian/rules while I didn't change them yet. Feel free to point what's wrong there:
https://garage.maemo.org/builder/fre...-status_0.2-0/
Code: https://gitorious.org/n900-ssh-statu...ssh-status-tmp
Command that I've used (on N900):
Code:

$ dpkg-buildpackage -sa -S -d -I.git -rsudo


All times are GMT. The time now is 22:51.

vBulletin® Version 3.8.8