1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Thibor 15c - changing dropbear startup options

Discussion in 'HyperWRT Firmware' started by spirytusick, Jul 3, 2008.

  1. spirytusick

    spirytusick Guest

    Hello,

    I've been tinkering for the last two days and cannot seem to find the way to alter dropbear startging options. I would like to add -a switch to dropbear commandline arguments. No clues from studying filesystem and the nvram does not seem to have those options. Do I have to recompile the firmware ?

    Thanks in advance,

    Spirytusick
     
  2. mstombs

    mstombs Network Guru Member

    Why not start an extra copy from the command line on non default port?

    By the way Tomato has the latest dropbear compiled with nearly all config options enabled, but you'd still need to start from command line with custom options.
     
  3. dervih

    dervih Networkin' Nut Member

    [Tomato] dropbear -a ( GatewayPorts yes )

    I managed to run dropbear daemon with -a switch. ( not ideally )

    > JFFS must be anabled. mkdir /jffs/etc

    > First I copied directory: cp -a /etc/dropbear /jffs/etc/ ( I will explain it )
    > Second I added the command to Init Scripts:

    ( sleep 60 ; cp -a /jffs/etc/* /etc ; dropbear -a -K 86400 -p 22 ) &

    > Third I disabled option Enable at Startup in Admin Access / SSH Daemon.

    If the option is disabled then Tomato does not create /etc/dropbear/
    that is required by dropbear daemon. Therefore it must be copied.
    "sleep 60" is necessary since Tomato creates /etc files also after calling Init Scripts.

    I also added extra users to /etc/passwd, /etc/shadow, /etc/group and folowed by copied these files to /jffs/etc/ (the /etc files are still overwritten by Tomato on startup and conig change).
    But I always copy them to /etc from /jffs/etc at startup and in this way my extra users seem to be permanently added.

    There is one problem. Sometimes dropbear daemon is killed by Tomato in case the configuration is changed (soft restart?). Because option "Enable at Startup" is disabled dropbear daemon is not restarted automatically and Init Scripts are not called. The problem can be handled by runnig dropbear watchdog from Init Scripts that periodically checks if dropbear daemon is running and starts it when not.
    For instance:

    ( while true ; do ssh-watchdog.sh ; sleep 60 ; done ) &

    ssh-watchdog.sh:

    count=$( ps -w | grep dropbear | grep -v grep | wc -l )
    if [ $count -eq 0 ]; then
    dropbear -a -K 86400 -p 22
    fi;
     

Share This Page