STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

11
INSTRUCTIONS PROVIDED BY HACKSEAGATESATELLITE.COM STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE Note : Command Lines are in red. Congratulations on following all 3 steps. This is the final step you need to do to get rid of the old interface and have just the directory listings of the hard drive. No DLNA indexing and having to wait for your media to appear. There are 5 files required. Download the files from http://hackseagatesatellite.com/BASIC/Step4.zip Get the files into the packages folder you created in Step 1. CONNECT VIA SSH TO YOUR GOFLEX SATELLITE Connect via SSH session to “192.168.0.1”. Password is “goflex” ssh 192.168.0.1 –l root DISABLE THE UNREQUIRED SERVICES Navigate to /etc/rc5.d folder cd /etc/rc5.d/ ls There are few files to watch out for : a) run_scanner b) run_swap_scan_minidlna c) satellite_resume d) start_minidlna e) server_startup

Transcript of STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

Page 1: STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

INSTRUCTIONS  PROVIDED  BY  HACKSEAGATESATELLITE.COM  

STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE Note : Command Lines are in red. Congratulations on following all 3 steps. This is the final step you need to do to get rid of the old interface and have just the directory listings of the hard drive. No DLNA indexing and having to wait for your media to appear. There are 5 files required. Download the files from http://hackseagatesatellite.com/BASIC/Step4.zip Get the files into the packages folder you created in Step 1. CONNECT VIA SSH TO YOUR GOFLEX SATELLITE Connect via SSH session to “192.168.0.1”. Password is “goflex” ssh 192.168.0.1 –l root DISABLE THE UNREQUIRED SERVICES Navigate to /etc/rc5.d folder cd /etc/rc5.d/ ls There are few files to watch out for :

a) run_scanner b) run_swap_scan_minidlna c) satellite_resume d) start_minidlna e) server_startup

Page 2: STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

INSTRUCTIONS  PROVIDED  BY  HACKSEAGATESATELLITE.COM  

 MODIFY RUN_SWAP_SCAN_MINIDLNA Using your choice of editor, edit run_swap_scan_minidlna . In our example, we use vi vi run_swap_scan_minidlna At Row 10, comment out “/etc/rc5.d/start/minidlna &”. It should look like this “# /etc/rc5.d/start/minidlna &”

MODIFY SATELLITE_RESUME Using your choice of editor, edit satellite_resume . In our example, we use vi vi satellite_resume Comment out “killall arm-lighttpd” At Row 4, add “sleep 3”

Page 3: STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

INSTRUCTIONS  PROVIDED  BY  HACKSEAGATESATELLITE.COM  

comment out “/etc/rc5.d/start_minidlna &” It should look something like this.

MODIFY SERVER_STARTUP Using your choice of editor, edit server_startup . In our example, we use vi vi server_startup Add a new line on Row 2. This is for light-check. “/satellite_app/webservers/lighttpd/sbin/light-check.sh &” Comment out the line 3 and 4 that reads “/satellite_app/webservers/lighttpd/sbin/arm-lighttpd –f……….”

Page 4: STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

INSTRUCTIONS  PROVIDED  BY  HACKSEAGATESATELLITE.COM  

MODIFY START_MINIDLNA Using your choice of editor, edit start_minidlna . In our example, we use vi vi start_minidlna Somewhere down row 70, you will need to comment out “/satellite_app/minidlna/sbin/minidlna –f /satellite_app/minidlna/etc/minidlna.conf –R”

HTTPD PROBLEM Because LIGHTTPD will quit when your Seagate GoFlex Satellite goes to suspend mode, we will have scripts running to check and make sure it is always running should it quit. 2 scripts are required. light-check.sh LIGHTTPD.sh Check the end of the documentation on the format of the scripts. The scripts are also part of the Step4.zip. You may choose to use them.

Page 5: STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

INSTRUCTIONS  PROVIDED  BY  HACKSEAGATESATELLITE.COM  

CREATE THE 2 REQUIRED SCRIPTS Go to satellite_app/webservers/lighttpd/sbin folder. Create lighttpd.sh and light-check.sh scripts. You can copy the contents from the back of this documentation. In this example, we use vi. vi lighttpd.sh vi light-check.sh Change the permission set for both files to 755 chmod 755 light-check.sh chmod 755 lighttpd.sh Check to make sure that the files has been created :

CHECK SCRIPT EFFECTIVENESS Now it’s time to test if the light-check script is working. Run PS and look out for the lighttpd process. In the example here, the process ID is 1471. Kill it. kill 1471

Run the light-check script. ./light-check.sh You should get some feedback from the script

Page 6: STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

INSTRUCTIONS  PROVIDED  BY  HACKSEAGATESATELLITE.COM  

Reboot the unit. (Hold the Power Button till it cuts off power and turn on again) Login and run PS to confirm that your scripts are running. You should see both the scripts in the Process as well as the arm-lighttpd as indicated :

MODIFY LIGHTTPD.CONF [WARNING! THIS IS QUITE COMPLEX] You may also take what we have done and replace the file accordingly. The filename is lighttpd.conf. It is one of the 5 files your download in Step4.zip. Navigate to /satellite_app/webservers/lighttpd/etc/lighttpd folder Backup the original lighttpd.conf file. cp lighttpd.conf lighttpd.conf.bak Modify the lighttpd.conf file using your choice of editor. In our example, vi. vi lighttpd.conf Comment out “server.bind = 192.168.0.1” in line 98. Once you comment this out, access to the satellite is strictly via IP address. Comment out “server.name =www.goflexsatellite.com” in line 99

Navigate to the shown section and remove everything behind and add in the following as shown. You can check it out at the back of this documentation.

Page 7: STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

INSTRUCTIONS  PROVIDED  BY  HACKSEAGATESATELLITE.COM  

UPLOAD THE MODULES AND MIME CONF FILES Copy the modules.conf into /satellite_app/webservers/lighttpd/etc/lighttpd Copy mime.conf into /satellite_app/webservers/lighttpd/etc/lighttpd/conf.d directory Remember to back up the original files first cp mime.conf mimeconf.bak cp modules.conf modules.conf.bak *TIP : You can use your favorite SFTP Client to dump the files in. If you have not setup SFTP, please refer to Step 2 of our Documentations. KILL HTTPD Kill httpd and let it restart by itself. In our example here, the process ID is 1481

ENABLE DIRECTORY LISTINGS Go /satellite_app/webservers/lighttpd/etc/lighttpd/conf.d and modify dirlisting.conf. Modify the line “dir-listing.activate = “disable” . Change it to “enable”

Page 8: STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

INSTRUCTIONS  PROVIDED  BY  HACKSEAGATESATELLITE.COM  

CONGRATULATIONS. YOU HAVE GOTTEN LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE! TEST IT BY ACCESSING VIA THE IP ADDRESS. Sample of light-check.sh #!/bin/sh # check that i am the only one running if ps www | grep -v grep | grep "lighttpd.sh" > /dev/null; then echo "There is more than one of myself!"; echo "Exiting"; exit else echo "Nothing running!" /satellite_app/webservers/lighttpd/sbin/lighttpd.sh fi

Page 9: STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

INSTRUCTIONS  PROVIDED  BY  HACKSEAGATESATELLITE.COM  

   Sample of lighttpd.sh #!/bin/sh daemon=true checktime=30 # Starting daemon like process while $daemon; do # checking for PID of lighttpd if [ -e /satellite_app/webservers/lighttpd/var/run/lighttpd.pid ]; then PID=`cat /satellite_app/webservers/lighttpd/var/run/lighttpd.pid`; echo "Checking lighttpd on $PID"; if [[ `ps | grep $PID | grep -v grep | wc -l` != 1 ]]; then # PID don't exist, start lighttpd. Assume lighttpd not started echo "Process does not exist"; echo "lighttpd starting" /satellite_app/webservers/lighttpd/sbin/arm-lighttpd -f /satellite_app/webservers/lighttpd/etc/lighttpd/lighttpd.conf else # Assume PID existing will match to lighthttpd echo "Process exist"; fi else echo "lighttpd not running."; echo "lighttpd starting" /satellite_app/webservers/lighttpd/sbin/arm-lighttpd -f /satellite_app/webservers/lighttpd/etc/lighttpd/lighttpd.conf fi # sleep before next check /bin/sleep $checktime done

Page 10: STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

INSTRUCTIONS  PROVIDED  BY  HACKSEAGATESATELLITE.COM  

Final Ending for lighttpd.conf ##    SSL  Support  ##  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐    ##  ##  To  enable  SSL  for  the  whole  server  you  have  to  provide  a  valid  ##  certificate  and  have  to  enable  the  SSL  engine.::  ##  ##      ssl.engine  =  "enable"  ##      ssl.pemfile  =  "/path/to/server.pem"  ##  ##  The  HTTPS  protocol  does  not  allow  you  to  use  name-­‐based  virtual  ##  hosting  with  SSL.  If  you  want  to  run  multiple  SSL  servers  with  ##  one  lighttpd  instance  you  must  use  IP-­‐based  virtual  hosting:  ::  ##  ##      $SERVER["socket"]  ==  "10.0.0.1:443"  {  ##          ssl.engine                                    =  "enable"  ##          ssl.pemfile                                  =  "/etc/ssl/private/www.example.com.pem"  ##          server.name                                  =  "www.example.com"  ##  ##          server.document-­‐root                =  "/srv/www/vhosts/example.com/www/"  ##      }  ##    ##  If  you  have  a  .crt  and  a  .key  file,  cat  them  together  into  a  ##  single  PEM  file:  ##  $  cat  /etc/ssl/private/lighttpd.key  /etc/ssl/certs/lighttpd.crt  \  ##      >  /etc/ssl/private/lighttpd.pem  ##  #ssl.pemfile  =  "/etc/ssl/private/lighttpd.pem"    ##  ##  optionally  pass  the  CA  certificate  here.  ##  ##  #ssl.ca-­‐file  =  ""    ##  #######################################################################    #######################################################################  ##  ##  custom  includes  like  vhosts.  ##  #include  "conf.d/config.conf"  #include_shell  "cat  /etc/lighttpd/vhosts.d/*.conf"  ##  

Page 11: STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

INSTRUCTIONS  PROVIDED  BY  HACKSEAGATESATELLITE.COM  

#######################################################################  #  If  the  hostname  is  'www.example1.com'...    mem-­‐cache.enable  =  "enable"       #  ++  Mahendra  Liya  14-­‐Feb  2011  mem-­‐cache.max-­‐memory  =  20       #  Size  in  MB  mem-­‐cache.max-­‐file-­‐size  =  1024     #  Size  in  KB  mem-­‐cache.expire-­‐time  =  1440     #  equals  1  day  mem-­‐cache.filetypes  =  ("image/png",  "application/x-­‐javascript",  "text/css",  "text/html",  "text/javascript")  #  Cache  javascript,  css,  html  file  in  memory