Fritz: debug.cfg

Aus Dario's Home
Version vom 1. November 2008, 15:11 Uhr von Dario (Diskussion | Beiträge) (Die Seite wurde neu angelegt: ### ### Darios Fritzbox Config ### ### ### start telnet deamon with password of web gui ### echo "DEBUG.CFG: start telnet deamon" /usr/sbin/telnet...)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche
 ###
 ### Darios Fritzbox Config
 ###
 
 ###
 ### start telnet deamon with password of web gui
 ###
 
 echo "DEBUG.CFG: start telnet deamon"
 /usr/sbin/telnetd -l /sbin/ar7login
 
 
 ###
 ### set hostname to fritz.box
 ###
 
 echo "DEBUG.CFG: set hostname to fritz.box"
 hostname fritz.box
 
 
 # wait for USB to be mounted
 echo "DEBUG.CFG: wait 30s ..."
 sleep 10
 echo "DEBUG.CFG: wait 20s ..."
 sleep 10
 echo "DEBUG.CFG: wait 10s ..."
 sleep 5
 echo "DEBUG.CFG: wait 5s ..."
 sleep 2
 echo "DEBUG.CFG: wait 3s ..."
 sleep 1
 echo "DEBUG.CFG: wait 2s ..."
 sleep 1
 echo "DEBUG.CFG: wait 1s ..."
 sleep 1
 
 
 ###
 ### start ssh deamon
 ###
 echo "DEBUG.CFG: ************************************"
 echo "DEBUG.CFG: *** starting dropbear SSH deamon ***"
 echo "DEBUG.CFG: ************************************"
 
 cd /var/tmp
 mkdir /var/tmp/root/
 mkdir /var/tmp/root/.ssh
 
 # password () 
 # PASSWD='$1$rUr3ypnu$s8xnBdUV9T/DgTQVT6XQP.'
 # password disabled (only with authorized key)
 PASSWD='$1$rUr3ypnu$s8xnBdUV9T/xxxxxxxxxx.'
 
 # load files from usb stick
 echo "DEBUG.CFG: loading ssh-binaries from usb stick"
 for f in /var/media/ftp/*
 do
   sourcedir=${f}/fritzbox
 
 # dropbear
   thisfile="dropbear"
   targetdir=/var/tmp
   rights="+x"
   if [ -f $sourcedir/$thisfile ]
   then
     echo "DEBUG.CFG: cp $sourcedir/$thisfile to $targetdir/$thisfile"
     cp $sourcedir/$thisfile $targetdir/$thisfile
     echo "DEBUG.CFG: chmod $rights $targetdir/$thisfile"
     chmod $rights $targetdir/$thisfile
   fi
 
 # busybox
   thisfile="busybox"
   targetdir=/var/tmp
   rights="+x"
   if [ -f $sourcedir/$thisfile ]
   then
     echo "DEBUG.CFG: cp $sourcedir/$thisfile to $targetdir/$thisfile"
     cp $sourcedir/$thisfile $targetdir/$thisfile
     echo "DEBUG.CFG: chmod $rights $targetdir/$thisfile"
     chmod $rights $targetdir/$thisfile
   fi
 
 # dropbear_dss_host_key
   thisfile="dropbear_dss_host_key"
   targetdir=/var/tmp
   rights="+x"
   if [ -f $sourcedir/$thisfile ]
   then
     echo "DEBUG.CFG: cp $sourcedir/$thisfile to $targetdir/$thisfile"
     cp $sourcedir/$thisfile $targetdir/$thisfile
     echo "DEBUG.CFG: chmod $rights $targetdir/$thisfile"
     chmod $rights $targetdir/$thisfile
   fi
 
 # dropbear_rsa_host_key
   thisfile="dropbear_rsa_host_key"
   targetdir=/var/tmp
   rights="700"
   if [ -f $sourcedir/$thisfile ]
   then
     echo "DEBUG.CFG: cp $sourcedir/$thisfile to $targetdir/$thisfile"
     cp $sourcedir/$thisfile $targetdir/$thisfile
     echo "DEBUG.CFG: chmod $rights $targetdir/$thisfile"
     chmod $rights $targetdir/$thisfile
   fi
 
 # /var/tmp/root/.ssh/authorized_keys
   thisfile="authorized_keys"
   targetdir=/var/tmp/root/.ssh
   rights="700"
   if [ -f $sourcedir/$thisfile ]
   then
     echo "DEBUG.CFG: cp $sourcedir/$thisfile to $targetdir/$thisfile"
     cp $sourcedir/$thisfile $targetdir/$thisfile
     echo "DEBUG.CFG: chmod $rights $targetdir/$thisfile"
     chmod $rights $targetdir/$thisfile
   fi
 
 done
 
 # set busybox var
 echo "DEBUG.CFG: set busybox var"
 BUSYBOX="/var/tmp/busybox"
 
 # change root password
 echo "DEBUG.CFG: change ssh root password"
 ${BUSYBOX} sed -e "/root:/s#^root:[^:]*:#root:${PASSWD}:#" -i /var/tmp/shadow
 
 # set $HOME for root to /var/tmp/root/
 echo "DEBUG.CFG: set HOME for root to /var/tmp/root"
 echo "root:x:0:0:root:/var/tmp/root/:/bin/sh" > /var/tmp/passwd
 
 # set set path to SCP root
 echo "DEBUG.CFG: set path to SCP"
 echo "export PATH=$PATH:/var/tmp " > /var/tmp/root/.profile
 
 # create symlink for /var/tmp/dropbearkey and /var/tmp/scp
 echo "DEBUG.CFG: create symlink for dropbearkey and scp"
 ln -s /var/tmp/dropbear dropbearkey
 ln -s /var/tmp/dropbear scp
 
 # start dropbear
 echo "DEBUG.CFG: wait 5s ..."
 sleep 5
 echo "DEBUG.CFG: start ssh deamon on port 22"
 /var/tmp/dropbear -p 22 -r /var/tmp/dropbear_rsa_host_key -d /var/tmp/dropbear_dss_host_key
 
 
 ###
 ### delete warnings for non authorized firmware :-)
 ###
 echo "DEBUG.CFG: ******************************************************"
 echo "DEBUG.CFG: *** deleting warnings for non authorized firmware  ***"
 echo "DEBUG.CFG: ******************************************************"
 
 dst=/var/tmp/signed_firmware
 src=/usr/www/html/html/de/home
 mkdir -pm 777 $dst
 for file in home.js konfig.js; do
   if [ -f $src/$file ]; then
     sed -e 's,.*var signed =.*,var signed = "1",' $src/$file > $dst/$file
     mount -o bind $dst/$file $src/$file
   fi
 done
 
 ### end of debug.cfg