Difference between revisions of "Category:2big Network"

From NAS-Central Lacie Wiki
Jump to: navigation, search
(Persistence of user privileges)
(LaCie 2big Network: support user-space NFS)
 
(41 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{stubs}}
 
 
[[Image:2big_Network.jpg|frame|right]]
 
[[Image:2big_Network.jpg|frame|right]]
 
{| style="background:#DDDDDD; color:black"
 
{| style="background:#DDDDDD; color:black"
Line 40: Line 39:
 
Steppenwolf has an excellent HOWTO on his blog. It is in Italian unfortunately but [http://translate.google.com/translate?sl=it&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fwww.steppen-wolf.eu%2Fblog%2F2009%2F11%2F18%2Flacie-2big-network-hack-telnet-openssh-ntpd-cups-and-more Google Translate does a great job].
 
Steppenwolf has an excellent HOWTO on his blog. It is in Italian unfortunately but [http://translate.google.com/translate?sl=it&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fwww.steppen-wolf.eu%2Fblog%2F2009%2F11%2F18%2Flacie-2big-network-hack-telnet-openssh-ntpd-cups-and-more Google Translate does a great job].
  
What will follow now is a copy of his Google Translated blog post to preserve it should it ever be taken offline and to provide the NAS-Central users with as much info as possible.
+
What will follow now is a copy of his Google Translated blog post to preserve it, should it ever be taken offline, and to provide the NAS-Central users with as much info as possible.
  
'''This definately needs to be reviewed and gramatically corrected!'''
+
'''This definitely needs to be reviewed and gramatically corrected!'''
  
 
=== General Information ===
 
=== General Information ===
Line 48: Line 47:
 
The goal of this post is to add a shell ssh daemon ntpd to your nas, but before doing so it is good to understand a little machine with which we deal. The LaCie 2big Network nas taken as reference and on which was performed this procedure has the official firmware, distributed by LaCie , updated to version 2.2.3.
 
The goal of this post is to add a shell ssh daemon ntpd to your nas, but before doing so it is good to understand a little machine with which we deal. The LaCie 2big Network nas taken as reference and on which was performed this procedure has the official firmware, distributed by LaCie , updated to version 2.2.3.
  
  # cat /proc/cpuinfo
+
# cat /proc/cpuinfo
 
+
  Processor: ARM926EJ-S rev 0 (v5l)
+
  Processor       : ARM926EJ-S rev 0 (v5l)
  BogoMIPS: 266.24
+
  BogoMIPS       : 266.24
  Features: swp half thumb fastmult EDSP
+
  Features       : swp half thumb fastmult edsp
  CPU Implementer: 0x41
+
  CPU implementer : 0x41
 
  CPU architecture: 5TEJ
 
  CPU architecture: 5TEJ
  CPU variant: 0x0
+
  CPU variant     : 0x0
  CPU part: 0x926
+
  CPU part       : 0x926
  CPU revision: 0
+
  CPU revision   : 0
  Cache type: write-back
+
  Cache type     : write-back
  Cache clean: CP15 c7 ops
+
  Cache clean     : cp15 c7 ops
  Cache lockdown: format C
+
  Cache lockdown : format C
  Cache format: Harvard
+
  Cache format   : Harvard
  The size: 32768
+
  I size         : 32768
  I assoc: 1
+
  I assoc         : 1
  The line length: 32
+
  I line length   : 32
  The sets: 1024
+
  I sets         : 1024
  D size: 32768
+
  D size         : 32768
  D assoc: 1
+
  D assoc         : 1
  D line length: 32
+
  D line length   : 32
  D sets: 1024
+
  D sets         : 1024
 
   
 
   
  Hardware: Feroceon
+
  Hardware       : Feroceon
  Revision: 0000
+
  Revision       : 0000
  Serial: 0000000000000000  
+
  Serial         : 0000000000000000  
  
  # cat /proc/version
+
# cat /proc/version
 
   
 
   
  Linux version 2.6.22.7 (root @ grp-dash) (gcc version 4.2.1) # 1 Fri 9 April 2009 16:07:45 EDT
+
  Linux version 2.6.22.7 (root@grp-dash) (gcc version 4.2.1) #1 Thu Apr 9 16:07:45 CEST 2009
  
  # free
+
# free
        total used free shared buffers
+
        total   used   free   shared   buffers
  Mem:   61952 60184 1768   7384 0
+
  Mem:   61952   60184   1768   0         7384
  Swap:   128   376    60    184 0 128 376
+
  Swap:  128376  60184  0       128376
  Total: 190328 130144  
+
  Total: 190328   130144
  
  # df-h
+
# df -h
 
   
 
   
  Filesystem Size Used Available Use% Mounted on
+
  Filesystem Size   Used   Available   Use%   Mounted on
  rootfs 648.4M 20.2M 595.3M 3% /
+
  rootfs     648.4M 20.2M   595.3M       3%     /
  648.4M 20.2M 595.3M 3% udev / dev
+
  udev        648.4M 20.2M   595.3M       3%     /dev
  / Dev/md0 7.5M 5.9m 1.2M 83% / oldroot
+
  /dev/md0   7.5M   5.9M    1.2M         83%     /oldroot
  udev 10.0M 0 10.0M 0% / oldroot / dev
+
  udev       10.0M   0       10.0M       0%     /oldroot/dev
  udev 10.0M 0 10.0M 0% / oldroot / dev
+
  udev       10.0M   0       10.0M       0%     /oldroot/dev
  ninth 30.3M 30.3M 0% 0 / oldroot / dev / shm
+
  none        30.3M   0      30.3M       0%     /oldroot/dev/shm
  / Dev/md1 167.0M 111.3M 47.1M 70% / oldroot / var / original
+
  /dev/md1   167.0M 111.3M 47.1M       70%     /oldroot/var/original
  / Dev/md2 648.4M 20.2M 595.3M 3% / oldroot / snapshots
+
  /dev/md2   648.4M 20.2M   595.3M       3%     /oldroot/snapshots
  unionfs 648.4M 20.2M 595.3M 3% /
+
  unionfs     648.4M 20.2M   595.3M       3%     /
  / 1.2M 930.4G 930.4G dev/md4 0% / home  
+
  /dev/md4    930.4G  1.2M   930.4G       0%     /home
  
  # cat /proc/partitions
+
# cat /proc/partitions
 
   
 
   
  major minor # blocks name
+
  major minor #blocks name
 
   
 
   
  8 0 976762584 sda
+
  8     0 976762584 sda
  8 1 1 sda1
+
  8     1         1 sda1
  8 2 975755970 sda2
+
  8     2 975755970 sda2
  8 5 128457 sda5
+
  8     5     128457 sda5
  Sda6 8 6 8001
+
  8     6       8001 sda6
  Sda7 8 7 8001
+
  8     7       8001 sda7
  8 8 176683 sda8
+
  8     8     176683 sda8
  8 9 674698 sda9
+
  8     9     674698 sda9
  8 10 8001 sda10
+
  8   10       8001 sda10
  8 16 976762584 sdb
+
  8   16 976762584 sdb
  8 17 1 sdb1
+
  8   17         1 sdb1
  8 18 975755970 sdb2
+
  8   18 975755970 sdb2
  8 21 128457 sdb5
+
  8   21     128457 sdb5
  8 22 8001 sdb6
+
  8   22       8001 sdb6
  8 23 8001 sdb7
+
  8   23       8001 sdb7
  8 24 176683 sdb8
+
  8   24     176683 sdb8
  8 25 674698 sdb9
+
  8   25     674698 sdb9
  8 26 8001 sdb10
+
  8   26       8001 sdb10
  31 0512 mtdblock0
+
  31   0        512 mtdblock0
  7936 9 0 md0
+
  9     0       7936 md0
  9 1 176576 md1
+
  9     1     176576 md1
  9 2 674624 md2
+
  9     2     674624 md2
  9 3 128384 md3
+
  9     3     128384 md3
  9 4 975755904 MD4
+
  9     4 975755904 md4
  
  # cat /proc/mtd
+
# cat /proc/mtd
 
   
 
   
  dev: size erasesize name
+
  dev:   size   erasesize name
  mtd0: 00080000 00010000 "cfi_flash_0"  
+
  mtd0: 00080000 00010000 "cfi_flash_0"
  
In short, it is a Linux operating system with a very dated (sic) kernel compiled for ARM processor architecture, 400mhz cpu, 64mb of ram (the new models have 128 MB of RAM) and bootloader [http://www.denx.de/wiki/U-Boot uboot]. From the limited information obtained from the official site seems to have been used to build the system [http://www.scratchbox.org/ scratcbox] and starting services and daemons used initng instead of init.d The problems that arise are many: the retrieval of software already compiled for the system (unless you jump headlong into cross-compiling) compatible with the versions used by the library and the creation of nas startup script to initng. The scripts for [http://www.initng.org/ initng] found on the network must be modified slightly to make them work on the system, given that developers have not complied fully with the specifications initng to include all the *. script in the folder /etc/initng/ without performing the division in subfolders (daemon for demons, net for network services, etc..)
+
In short, it is a Linux operating system with a very dated (sic) kernel compiled for ARM processor architecture, 400mhz cpu, 64mb of ram (the new models have 128 MB of RAM) and bootloader [http://www.denx.de/wiki/U-Boot uboot]. From the limited information obtained from the official site [http://www.scratchbox.org/ scratcbox] seems to have been used to build the system and starting services and daemons uses ''initng'' instead of ''init.d''. The problems that arise are plenty: the retrieval of software already compiled for the system (unless you jump headlong into cross-compiling) compatible with the versions used by the library and the creation of nas startup scripts for ''initng''. The scripts for [http://www.initng.org/ initng] found on the internet must be modified slightly to make them work on the system, given that developers have not complied fully with the specifications initng to include all the *. script in the folder /etc/initng/ without performing the division in subfolders (daemon for demons, net for network services, etc.)
  
 
=== Hacking ===
 
=== Hacking ===
Line 142: Line 141:
 
There are several ways to "pierce" your nas, in fact, depending on the services started on the machine the safety of this object is far down the drain. A very simple way to access the system without physically removing disks is to create a new share with a particular path. (See below) You will have access to the entire system with administrator privileges since the webserver has the nas as root.
 
There are several ways to "pierce" your nas, in fact, depending on the services started on the machine the safety of this object is far down the drain. A very simple way to access the system without physically removing disks is to create a new share with a particular path. (See below) You will have access to the entire system with administrator privileges since the webserver has the nas as root.
  
2Big Network Web Browser Hacked
+
 
 +
[[File:2big_web_browser.gif|big|2Big Network Web Browser Hacked]]
 +
 
  
 
The counterpart of this hack is that the machine is rebooted, the share created by the system is changed (security mechanism?) And redirected into your root share, forcing them to have to re-apply the 'patch' whenever you feel the need to access the your Linux system. Even the removal of the new share is to be performed with extreme care. My suggestion is to remove this share once it has nas were uploaded on the telnet daemon and its startup files (see below).
 
The counterpart of this hack is that the machine is rebooted, the share created by the system is changed (security mechanism?) And redirected into your root share, forcing them to have to re-apply the 'patch' whenever you feel the need to access the your Linux system. Even the removal of the new share is to be performed with extreme care. My suggestion is to remove this share once it has nas were uploaded on the telnet daemon and its startup files (see below).
Line 153: Line 154:
 
Edit the file downloaded xml configuration changing the path of sharing "Hack" as shown:  
 
Edit the file downloaded xml configuration changing the path of sharing "Hack" as shown:  
  
  edconf.xml
+
[[File:Nas_xml.gif|big|config.xml]]
  
Keep in mind the lines of the code of your xml files can be different than shown above, in relation to the number of shares of your car, by users and groups.
+
Keep in mind the lines of the code of your xml files can be different than shown above, in relation to the number of shares of your machine, by users and groups.
  
Save your changes and upload the new configuration on the NAS (System-> Maintenance-> Download the configuration)
+
* Save your changes and upload the new configuration on the NAS (System-> Maintenance-> Download the configuration)
Use your browser and access the administration page of nas and click Browse to navigate to the new share on the web.  
+
* Use your browser and access the administration page of nas and click Browse to navigate to the new share on the web.  
  
 
The magic is performed by line ../../../../ which requires the system to create a new share from the root.
 
The magic is performed by line ../../../../ which requires the system to create a new share from the root.
Line 169: Line 170:
 
From here on, you will need this file:
 
From here on, you will need this file:
  
>> LaCie_2Big_Network_ [TELNET] [NTP] [SSH] [CUPS]. zip (6.79 Mb)
+
>> [http://www.megaupload.com/?d=00QCI873 LaCie_2Big_Network_TELNET-NTP-SSH-CUPS.zip] (6.79 Mb)
  
 
containing all the binaries and libraries, compiled for the ARM architecture, you need to install on your nas demons Telnet, NTP, OpenSSH and Cups.
 
containing all the binaries and libraries, compiled for the ARM architecture, you need to install on your nas demons Telnet, NTP, OpenSSH and Cups.
Line 183: Line 184:
  
 
The original files I have recovered from the site:
 
The original files I have recovered from the site:
 +
 +
http://downloads.buffalo.nas-central.org/LSPro_ARM9/Distributions/Genlink/Binaries/armv5tejl-softfloat-linux-gnueabi/
  
 
where there are many pre-compiled packages for the buffalo nas. Except that these packages are designed for a system that uses no inet.de initng, so I had to create my hand the scrip to start sshd, ntpd and cups (respectively /etc/initng/sshd.i , /etc/initng/ntpd.i and /etc/initng/cups.i ). I can assure you that it was not a pretty sight: the documentation is somewhat lacking and on the official forum of the project initng is overwhelmed by spam. (How I love spammers : Evil: )
 
where there are many pre-compiled packages for the buffalo nas. Except that these packages are designed for a system that uses no inet.de initng, so I had to create my hand the scrip to start sshd, ntpd and cups (respectively /etc/initng/sshd.i , /etc/initng/ntpd.i and /etc/initng/cups.i ). I can assure you that it was not a pretty sight: the documentation is somewhat lacking and on the official forum of the project initng is overwhelmed by spam. (How I love spammers : Evil: )
Line 193: Line 196:
 
Here is the contents of the file telnet.cgi:
 
Here is the contents of the file telnet.cgi:
  
  # / Bin / sh
+
#!/bin/sh
  echo "Content-type: text / plain"
+
  echo "Content-type: text/plain"
 
  echo ""
 
  echo ""
 
+
 
  # Settings for root bash shell
 
  # Settings for root bash shell
  HOME = '/ root'
+
  HOME='/root'
  PATH = '/ usr / local / bin: / bin: / sbin: / usr / bin: / usr / sbin:.:'
+
  PATH='/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:.:'
  TERM = linux
+
  TERM=linux
 
+
  PS1 = '\ u @ \ h: \ w #'
+
  PS1='\u@\h:\w# '
  PS2 = '>'
+
  PS2='> '
  PS3 = '>'
+
  PS3='> '
  PS4 = '+'
+
  PS4='+ '
 
  export PS1 PS2 PS3 PS4 PATH HOME TERM
 
  export PS1 PS2 PS3 PS4 PATH HOME TERM
 
+
  Run # telnet daemon
+
  # Run telnet daemon
  utelnetd echo-l / bin / bash
+
  echo utelnetd -l /bin/bash
  utelnetd eval-l / bin / bash  
+
  eval utelnetd -l /bin/bash
  
 
You can launch your telnet daemon from a web browser at:
 
You can launch your telnet daemon from a web browser at:
  
   http://<your.nas.ip>/cgi-bin/public/telnet.cgi  
+
   <nowiki>http://<your.nas.ip>/cgi-bin/public/telnet.cgi</nowiki>
  
 
If the page is white and not worry infinite load, run telnet client can also list your address of nas and enjoy your root console without login. (Hooray safety!)
 
If the page is white and not worry infinite load, run telnet client can also list your address of nas and enjoy your root console without login. (Hooray safety!)
Line 224: Line 227:
 
From the console, telnet performed:
 
From the console, telnet performed:
  
  # Cd / home / share / nome_cartella_della_vostra_condivisione
+
  # cd /home/share/folder_name_of_your_share
  # Tar openssh-4.7_p1-xvjf r6.tbz2-C /
+
  # tar -xvjf openssh-4.7_p1-r6.tbz2 -C /
  # Rm openssh-4.7_p1-r6.tbz2
+
  # rm openssh-4.7_p1-r6.tbz2
  # Cd / etc / initng / runlevels /
+
  # cd /etc/initng/runlevel/
  # Echo sshd>> default.runlevel
+
  # echo sshd >> default.runlevel
  # Touch / var / log / lastlog  
+
  # touch /var/log/lastlog
  
 
At first startup after installation of ssh nas will, for once, the slower, the cause is the automatic creation of files:
 
At first startup after installation of ssh nas will, for once, the slower, the cause is the automatic creation of files:
Line 238: Line 241:
 
  ssh_host_key.pub
 
  ssh_host_key.pub
 
  ssh_host_rsa_key
 
  ssh_host_rsa_key
  ssh_host_rsa_key.pub  
+
  ssh_host_rsa_key.pub
  
 
required for the operation of the ssh daemon itself (folder /etc/ssh/ ).
 
required for the operation of the ssh daemon itself (folder /etc/ssh/ ).
Line 247: Line 250:
 
   
 
   
 
  # NAME: OpenSSH
 
  # NAME: OpenSSH
  # DESCRIPTION: The standard Linux SSH servers
+
  # DESCRIPTION: The standard Linux SSH server
 
  # WWW: http://www.openssh.com/
 
  # WWW: http://www.openssh.com/
 
   
 
   
  service sshd / {generate_keys
+
  service sshd/generate_keys {
   env KEYGEN = / usr / bin / ssh-keygen;
+
   env KEYGEN=/usr/bin/ssh-keygen;
   RSA1_KEY env = / etc / ssh / ssh_host_key;
+
   env RSA1_KEY=/etc/ssh/ssh_host_key;
   RSA_KEY env = / etc / ssh / ssh_host_rsa_key;
+
   env RSA_KEY=/etc/ssh/ssh_host_rsa_key;
   DSA_KEY env = / etc / ssh / ssh_host_dsa_key;
+
   env DSA_KEY=/etc/ssh/ssh_host_dsa_key;
 
   script start = {
 
   script start = {
     [! -S $ {RSA1_KEY}] & & \
+
     [ ! -s ${RSA1_KEY} ] && \
       {} $ KEYGEN-q-t-f $ {rsa1 RSA1_KEY}-C''-N''2> & 1
+
       ${KEYGEN} -q -t rsa1 -f ${RSA1_KEY} -C '' -N '' 2>&1
      if [! -S $ {RSA_KEY}], then
+
    if [ ! -s ${RSA_KEY} ] ; then
        {} $ KEYGEN-q-t rsa-f $ {} RSA_KEY-C''-N''2> & 1
+
      ${KEYGEN} -q -t rsa -f ${RSA_KEY} -C '' -N '' 2>&1
          chmod 600 $ {} RSA_KEY
+
      chmod 600 ${RSA_KEY}
          chmod 644 $ {} RSA_KEY. pubs
+
      chmod 644 ${RSA_KEY}.pub
      fi
+
    fi
      if [! -S $ {DSA_KEY}], then
+
    if [ ! -s ${DSA_KEY} ] ; then
        {} $ KEYGEN-q-t dsa-f $ {} DSA_KEY-C''-N''2> & 1
+
      ${KEYGEN} -q -t dsa -f ${DSA_KEY} -C '' -N '' 2>&1
          chmod 600 $ {} DSA_KEY
+
      chmod 600 ${DSA_KEY}
          chmod 644 $ {} DSA_KEY. pubs
+
      chmod 644 ${DSA_KEY}.pub
      fi
+
    fi
    }
+
  }
 
  }
 
  }
 
   
 
   
  {sshd daemon
+
  daemon sshd {
   need bootmisc = virtual / net mountfs;
+
   need = bootmisc virtual/net mountfs;
   pid_file = / var / run / sshd.pid;
+
   pid_file = /var/run/sshd.pid;
   = need sshd / generate_keys;
+
   need = sshd/generate_keys;
   exec daemon = / usr / sbin / sshd-D;
+
   exec daemon = /usr/sbin/sshd -D;
 
   daemon_stops_badly;
 
   daemon_stops_badly;
 
   respawn;
 
   respawn;
  }  
+
  }
  
Another problem is the bang, even here, the file listed in the original does not work and I had to edit it by hand. Here's the new content:
+
Another problem is the pam, even here, the file listed in the original does not work and I had to edit it by hand. Here's the new content:
  
  #% PAM-1.0
+
  #%PAM-1.0
 
   
 
   
  auth required pam_unix.so
+
  auth       required     pam_unix.so
  account required pam_unix.so
+
  account     required     pam_unix.so
  password required pam_unix.so
+
  password   required     pam_unix.so
  session required pam_unix.so  
+
  session     required     pam_unix.so
  
 
Modify it to your discretion (file /etc/pam.d/sshd ).
 
Modify it to your discretion (file /etc/pam.d/sshd ).
Line 295: Line 298:
 
The problems do not end there, however. At each restart of the machine the file /etc/passwd and /etc/shadow is overwritten. In particular, each new user created through the web interface of the NAS does not have the right to log into the remote console nas. Ex:
 
The problems do not end there, however. At each restart of the machine the file /etc/passwd and /etc/shadow is overwritten. In particular, each new user created through the web interface of the NAS does not have the right to log into the remote console nas. Ex:
  
  admin: x: 500:100:: / home: / bin / false  
+
  admin:x:500:100::/home:/bin/false  
  
 
The /bin/false is our problem! To remedy the situation I created a service for initng called personal, which allows you to restore the privileges of an account:
 
The /bin/false is our problem! To remedy the situation I created a service for initng called personal, which allows you to restore the privileges of an account:
Line 301: Line 304:
 
  #!/sbin/itype
 
  #!/sbin/itype
 
  #
 
  #
  # Change the line user = "user" instead of inserting a 'user' user name you created
+
  # Cambiate la riga user="utente" inserendo a posto di 'utente' il nome dell'utente da voi creato
 
   
 
   
  {personal service
+
  service personal {
   need edconfd = / ready;
+
   need = edconfd/ready;
 
   last;
 
   last;
 
   script start = {
 
   script start = {
     user = "user"
+
     user="utente"
     PASSWD = "$ user: x: 0:0:: / root: / bin / bash"
+
     PASSWD="$user:x:0:0::/root:/bin/bash"
 
+
     if ["x` cat / etc / passwd | grep $ user `" == "x"]; then
+
     if [ "x`cat /etc/passwd | grep $user`" == "x" ]; then
       echo $ PASSWD>> / etc / passwd
+
       echo $PASSWD >> /etc/passwd
       echo "Insert user $ user done"> & 2
+
       echo "Insert user $user done" >&2
 
     else
 
     else
       LINE = "` cat / etc / passwd | grep $ user `"
+
       LINE="`cat /etc/passwd | grep $user`"
       if ["$ LINE"! = "$ PASSWD"]; then
+
       if [ "$LINE" != "$PASSWD" ]; then
         sed-i "s # $ {# LINE} $ {PASSWD} # g" / etc / passwd
+
         sed -i "s#${LINE}#${PASSWD}#g" /etc/passwd
         echo "User $ user restored"> & 2
+
         echo "User $user restored" >&2
 
       fi
 
       fi
 
     fi
 
     fi
 
     exit 0
 
     exit 0
 
   };
 
   };
  }  
+
  }
  
 
It is assumed that the user has been previously created using the web interface of nas.
 
It is assumed that the user has been previously created using the web interface of nas.
Line 334: Line 337:
 
To start automatically at boot script to copy the file nas personal.i in the folder /etc/initng/ and run:
 
To start automatically at boot script to copy the file nas personal.i in the folder /etc/initng/ and run:
  
  # cd /etc/initng/runlevels/
+
# cd /etc/initng/runlevel/
  # echo personal >> default.runlevel  
+
# echo personal >> default.runlevel
  
 
Once the script has been added you can finally get rid of your telnet daemon and its startup files from the folder /www/cgi-bin/public/ . For good luck I suggest you reboot the machine and make sure everything works as you wait for us to remove the first two rows.
 
Once the script has been added you can finally get rid of your telnet daemon and its startup files from the folder /www/cgi-bin/public/ . For good luck I suggest you reboot the machine and make sure everything works as you wait for us to remove the first two rows.
Line 344: Line 347:
 
Login as root and run the nas (remember telnet access you have is the root):
 
Login as root and run the nas (remember telnet access you have is the root):
  
  # Vi / etc / busybox.conf  
+
# vi /etc/busybox.conf
  
 
Put these lines, save the file and exit the editor
 
Put these lines, save the file and exit the editor
  
  [SUID]
+
[SUID]
 
  passwd = ssx 0.0
 
  passwd = ssx 0.0
  su = ssx root.0  
+
  su = ssx root.0
  
 
From the console, always with the root account, run these commands:
 
From the console, always with the root account, run these commands:
  
  # Chown 0.0 / etc / busybox.conf
+
# chown 0.0 /etc/busybox.conf
  # Chmod 600 / etc / busybox.conf
+
  # chmod 600 /etc/busybox.conf
  # Chown 0.0 / bin / busybox
+
  # chown 0.0 /bin/busybox
  # Chmod 4755 / bin / busybox  
+
  # chmod 4755 /bin/busybox  
  
 
The problems of and passwd are over.
 
The problems of and passwd are over.
Line 363: Line 366:
 
If you want the extended prompt of bash I recommend editing the file /etc/profile.bash change the line:
 
If you want the extended prompt of bash I recommend editing the file /etc/profile.bash change the line:
  
   PS1 = '[\ u @ \ h \ W] \ $'  
+
   PS1='[\u@\h \W]\$ '  
  
 
in
 
in
  
   PS1 = '[\ u @ \ h \ w] \ $'  
+
   PS1='[\u@\h \w]\$ '
  
 
=== Installing NTP ===
 
=== Installing NTP ===
Line 374: Line 377:
 
From the console, with the active root privileges, run:
 
From the console, with the active root privileges, run:
  
  # Cd / home / share / nome_cartella_della_vostra_condivisione
+
# cd /home/share/folder_name_of_your_share
  # Tar-xvjf 4.2.4_p4.tbz2 ntp-C /
+
  # tar -xvjf ntp-4.2.4_p4.tbz2 -C /
  # Rm-r ntp-4.2.4_p4.tbz2
+
  # rm -r ntp-4.2.4_p4.tbz2
  # Cd / etc / initng / runlevels /
+
  # cd /etc/initng/runlevel/
  Ntpd # echo>> default.runlevel  
+
  # echo ntpd >> default.runlevel
  
 
This here is the configuration file, included in the archive for initng for the ntpd daemon:
 
This here is the configuration file, included in the archive for initng for the ntpd daemon:
  
  #! / Sbin / iType
+
#!/sbin/itype
 
+
  {ntpd daemon
+
  daemon ntpd {
NTPD_PID env = / var / run / ntpd.pid;
+
  env NTPD_PID = /var/run/ntpd.pid;
need bootmisc = virtual / net;
+
  need = bootmisc virtual/net;
require_network;
+
  require_network;
exec daemon = / usr / sbin / ntpd-c / etc / ntp.conf-p $ {} NTPD_PID;
+
  exec daemon = /usr/sbin/ntpd -c /etc/ntp.conf -p ${NTPD_PID};
forks;
+
  forks;
pid_file = $ {} NTPD_PID;
+
  pid_file = ${NTPD_PID};
respawn;
+
  respawn;
 
  }  
 
  }  
  
Line 402: Line 405:
 
From the console, with the active root privileges, run:
 
From the console, with the active root privileges, run:
  
  # Cd / home / share / nome_cartella_della_vostra_condivisione
+
# cd /home/share/folder_name_of_your_share
  # Tar-cups-1.3.8-xvjf r1.tbz2-C /
+
  # tar -xvjf cups-1.3.8-r1.tbz2 -C /
  # Rm-r cups-1.3.8-r1.tbz2
+
  # rm -r cups-1.3.8-r1.tbz2
  # Cd / etc / initng / runlevels /
+
  # cd /etc/initng/runlevel/
  Cupsd # echo>> default.runlevel  
+
  # echo cupsd >> default.runlevel
  
 
Open the web interface of the NAS and click Groups and then add, and create a new group named "lpadmin" group and add the user that you created earlier to access the NAS through ssh.
 
Open the web interface of the NAS and click Groups and then add, and create a new group named "lpadmin" group and add the user that you created earlier to access the NAS through ssh.
  
  # Vi / etc / sysconfig / modules  
+
# vi /etc/sysconfig/modules
  
 
Add a line usblp , as shown and saved.
 
Add a line usblp , as shown and saved.
Line 421: Line 424:
 
Here is the configuration file, including archive, to automatically start the daemon via cups initng:
 
Here is the configuration file, including archive, to automatically start the daemon via cups initng:
  
  #! / Sbin / iType
+
#!/sbin/itype
 
+
 
  # NAME: CUPS
 
  # NAME: CUPS
 
  # DESCRIPTION: The Common Unix Printing System
 
  # DESCRIPTION: The Common Unix Printing System
 
  # WWW: http://www.cups.org
 
  # WWW: http://www.cups.org
 
+
  {daemon cupsd
+
  daemon cupsd {
= bootmisc need dbus virtual / net avahi;
+
  need = bootmisc dbus virtual/net avahi;
require_network;
+
  require_network;
exec daemon = / usr / sbin / cupsd-F-f / etc / cups / cupsd.conf;
+
  exec daemon = /usr/sbin/cupsd -F -c /etc/cups/cupsd.conf;
  }  
+
  }
  
 
You must also edit the file /etc/cups/cupsd.conf to allow remote administration of the cups, or inactive. To help you carry my configuration file . For further help on how to configure the cups I refer you to the official website www.cups.org .
 
You must also edit the file /etc/cups/cupsd.conf to allow remote administration of the cups, or inactive. To help you carry my configuration file . For further help on how to configure the cups I refer you to the official website www.cups.org .
  
Even the cups I had to edit the file by hand pam. Here's the new content:
+
Even for cups I had to edit the pam file by hand. Here's the new content:
  
  #% PAM-1.0
+
#%PAM-1.0
 
+
  auth required pam_unix.so
+
  auth       required     pam_unix.so
  account required pam_unix.so  
+
  account     required     pam_unix.so
  
 
Modify it to your discretion (file /etc/pam.d/cups ).
 
Modify it to your discretion (file /etc/pam.d/cups ).
  
Once rebooted, the cups will be running and accessible at the door of your nas 631:
+
Once rebooted, the cups will be running and is accessible at port 631 of your nas:
  
  https://indirizzo_nas:631  
+
<nowiki>https://<your.nas.ip>:631</nowiki>
  
The files cups-1.3.8-r1_(driver).tbz2 and cups-1.3.8-r1_(launguage).tbz2 , are optional and contain the drivers and the translation of the web, install them or not is your choice. You can also install only the Italian language from the archive by removing cups-1.3.8-r1_(launguage).tbz2 the language folders you do not want, the same applies to the file with the drivers.
+
The files cups-1.3.8-r1_(driver).tbz2 and cups-1.3.8-r1_(launguage).tbz2, are optional and contain the drivers and the translation of the web, install them or not is your choice. You can also install only the Italian language from the archive by removing cups-1.3.8-r1_(launguage).tbz2 the language folders you do not want, the same applies to the file with the drivers.
  
 
To print in raw form (pre-formatted output) must uncomment the following line from the file /etc/cups/mime.convs :
 
To print in raw form (pre-formatted output) must uncomment the following line from the file /etc/cups/mime.convs :
  
  application / octet-stream application / vnd.cups-raw 0 -  
+
application/octet-stream application/vnd.cups-raw 0 -
  
 
Make sure also not commented the following line of the file /etc/cups/mime.types :
 
Make sure also not commented the following line of the file /etc/cups/mime.types :
  
  application / octet-stream  
+
application/octet-stream
  
 
In linux the printer will be found at (watch at times there is no need to specify the port number):
 
In linux the printer will be found at (watch at times there is no need to specify the port number):
  
  ipp: / / indirizzo_nas: 631/printers/nome_stampante  
+
ipp://indirizzo_nas:631/printers/nome_stampante
  
 
Ex:
 
Ex:
  
  ipp: / / 192.168.1.100:631 / printers/ML-3050  
+
ipp://192.168.1.100:631/printers/ML-3050
  
 
In Windows XP click on "Add Printer" and to add a new network printer and select "printer on the Internet or on your home or business" and use the URL:
 
In Windows XP click on "Add Printer" and to add a new network printer and select "printer on the Internet or on your home or business" and use the URL:
  
  http://indirizzo_nas:631/printers/nome_stampante  
+
<nowiki>http://<your.nas.ip>:631/printers/nome_stampante</nowiki>
  
 
Select, finally, the driver for your printer.
 
Select, finally, the driver for your printer.
Line 479: Line 482:
 
=== Links ===
 
=== Links ===
  
    uboot
+
* [http://www.denx.de/wiki/U-Boot uboot]
    scratcbox
+
* [http://www.scratchbox.org/ scratcbox]
    buildroot
+
* [http://buildroot.uclibc.org/ buildroot]
    www.initng.org , preferably see http://gitorious.org/initng/ .
+
* [http://www.initng.org/ www.initng.org], preferably see [http://gitorious.org/initng/].
    Lacie NAS-Central
+
* http://downloads.buffalo.nas-central.org/LSPro_ARM9/Distributions/Genlink/Binaries/armv5tejl-softfloat-linux-gnueabi/ (Binaries compiled for ARM)
    General NAS-Central Forums
+
* [http://www.lacie.com/support/support_manifest.htm?id=10245 LaCie] (support page)
 
+
* [http://www.lacie.com/gpl/ LaCie LPG]
    (Binaries compiled for ARM)
+
* [http://www.cups.org/ www.cups.org], Common Unix Printing System.
    LaCie (support page)
+
    LaCie LPG
+
    www.cups.org , Common UNIX Printing System.  
+
  
 
=== Speculations ===
 
=== Speculations ===
Line 500: Line 500:
  
 
I thank the members of the forum "General NAS-Central Forums", which with their helpful post allowed the writing of this article and especially to pierce my nas. :-)
 
I thank the members of the forum "General NAS-Central Forums", which with their helpful post allowed the writing of this article and especially to pierce my nas. :-)
 +
 +
== Further NAS tweaking ==
 +
 +
These are 2 more Google Translated posts made by Steppenwolf on his blog.
 +
 +
=== LaCie 2big Network tweaking: filesystem defragmentation xfs_fsr ===
 +
 +
Those who have already done the hack will have noticed that the partition containing the user data is formatted with the filesystem [http://it.wikipedia.org/wiki/XFS_%28file_system%29 xfs]. This excellent filesystem has a bad habit, with the use of fragment thus deteriorating its performance.
 +
 +
To see the fragmentation status of your file system:
 +
 +
# xfs_db -c frag -r /dev/md4
 +
 +
You will see something like this:
 +
 +
actual 3144, ideal 3135, fragmentation factor 0.29%
 +
 +
We need to defragment the nas utility xfs_fsr , which is not installed on the nas.
 +
I retrieved the program from the distro package xfsdump compiled for debian lenny armtel therefore compatible with the nas. I removed all files from the package does not strictly necessary, reducing it to 14kb.
 +
 +
* Download the file [http://www.steppen-wolf.eu//blog/wp-content/xfsdump_2.2.48-1_armel.tar.gz xfsdump_2.2.48-1_armel.tar.gz]
 +
* Copy the file in your shared folder on the NAS.
 +
 +
# cd /home/share/nome_cartella_della_vostra_condivisione
 +
# tar -xvzf xfsdump_2.2.48-1_armel.tar.gz -C /
 +
# xfs_fsr -v
 +
 +
You can also go take a coffee, the first execution of the program has committed more than 4 hours to finish. :-P
 +
 +
For those who had not been informed, has recently released a firmware update ver 2.2.6 of nas.
 +
If you wonder what happened to versions 2.2.4 and 2.2.5 of 2.2.4 ... well, I can not tell much, but the firmware version 2.2.5 has been a total flop. The installation process, which consisted of two files to upload to the NAS, they planted the loading of the second file.
 +
 +
I tested the hack on this new firmware version in the following ways:
 +
 +
* nas with firmware 2.2.3 and updated to ver 2.2.6
 +
* updated to version 2.2.6 and higher
 +
 +
in both cases it was possible to pierce the nas.
 +
 +
=== LaCie 2big Network: support user-space NFS ===
 +
 +
I had previously tried to install the [http://it.wikipedia.org/wiki/Network_File_System nfs support] on my old (v1) nas of the LaCie 2big Network, but I gave up for the lack of nfsd kernel module, which allows you to enable NFS server kernelspace.
 +
 +
Recently, after a request for help from a navigator, I tackles the problem by finding a solution: nsf in user space. Ok I also turn up their nases because of the enormity of what I just said ..
 +
In fact, there are no major handicap for nfs [http://en.wikipedia.org/wiki/User_space userspace]: the development of the code has been completely abandoned (the latest version is 0.9.22 and dates back to 01/05/2009), but the most serious problem that there is no support for the file locking.
 +
 +
To install support for NFS v3 on nas need unfsd demons and portmap, nfs, the first is that the second is an ONC RPC service, running on a networked machine, which provides other services ONC RPC (Remote Procedure call). (If you're used to program knows what I'm talking about)
 +
In short unfs3 the package depends on the package portmap. For all practical purposes means that the installation is required also to have nfs portmap service running.
 +
It also means that I have written two scripts for initng to start / stop the daemons properly.
 +
 +
File ''portmap.i'':
 +
 +
# NAME: portmap
 +
# DESCRIPTION: DARPA port to RPC program number mapper
 +
# WWW:
 +
 +
# exec daemon = /sbin/portmap -d ${PORTMAP_OPTS};
 +
daemon portmap {
 +
  need = bootmisc virtual/net;
 +
  provide = virtual/portmap;
 +
  pid_file = /var/run/portmap.pid;
 +
  forks;
 +
  env PORTMAP_OPTS=;
 +
  env_file = /etc/portmap.conf;
 +
  exec daemon = /sbin/portmap;
 +
}
 +
 +
File ''unfs3.i'':
 +
 +
# NAME: unfs3
 +
# DESCRIPTION: starts user-space NFSv3 server.
 +
#        UNFS3 is a user-space implementation of the NFSv3 server specification.
 +
#        It provides a daemon for the MOUNT and NFS protocols,
 +
#        which are used by NFS clients for accessing files on the server.
 +
#        Unlike nfs-user-server, unfs3 is capable of handling files larger than 2GB,
 +
#              but there is currently no support for file locking.
 +
# WWW:
 +
 +
daemon unfs3 {
 +
  need = initial virtual/portmap virtual/net;
 +
  env PID_FILE = /var/run/unfsd.pid;
 +
  env_file = /etc/unfs3.conf;
 +
  pid_file = ${PID_FILE};
 +
  require_network;
 +
  forks;
 +
  exec daemon = /usr/sbin/unfsd -i ${PID_FILE} $DAEMON_OPTS;
 +
  daemon_stops_badly;
 +
}
 +
 +
'''Installing servers nfs3'''
 +
 +
As a general assumes that:
 +
 +
* have already made ​​the hack of your nas ( see article ),
 +
* and above all with it installed ssh tcp-wrappers libraries,
 +
* you have a root account on your NAS (all documented in the operations mentioned above)
 +
* and above all, a good command of bash and linux systems.
 +
 +
To install the nfs server, you have to download these two files:
 +
 +
* [http://www.steppen-wolf.eu/blog/wp-content/portmap_6.0-9_armel.tar.gz portmap_6.0-9_armel.tar.gz] (10.6 Kb)
 +
* [http://www.steppen-wolf.eu/blog/wp-content/unfs3_0.9.21_armel.tar.gz unfs3_0.9.21_armel.tar.gz] (38.2 Kb)
 +
 +
The packages have been downloaded the distro debian lenny and are compiled for armtel, I deleted the files from both the doc and man pages in order to recover all the space possible.
 +
I moved the portmap configuration file in the folder ''/etc'' and I renamed ''portmap.conf''.
 +
The daemon configuration file has unfsd own (not to be confused with the file ''/etc/exports'') I renamed ''unfs3.conf'' and also inserted in the folder ''/etc''.
 +
These changes were due since the NAS architecture differs from architecture of an operating system debian. The script to reflect these changes initng so if you changed the files you place to amend the startup scripts of the demons.
 +
 +
Copy the file in your shared folder on the NAS.
 +
 +
# cd /home/share/nome_cartella_della_vostra_condivisione
 +
# tar -xvzf portmap_6.0-9_armel.tar.gz -C /
 +
# tar -xvzf unfs3_0.9.21_armel.tar.gz -C /
 +
# rm portmap_6.0-9_armel.tar.gz
 +
# rm unfs3_0.9.21_armel.tar.gz
 +
# cd /etc/initng/runlevel/
 +
# echo portmap >> default.runlevel
 +
# echo unfs3 >> default.runlevel
 +
 +
Now you must configure the file exports that tells the NFS daemon which folders to share in your local network:
 +
 +
# vi /etc/exports
 +
 +
Remember that the commands for editing a file with the vi editor is the "i" to insert new text, and "ESC" + ": wq" to save and exit, "ESC" + ": q!" to force the output from the file without saving your changes.
 +
 +
The configuration file in question I leave to your own experience, if you are installing NFS on the NAS assumes that you know what you are doing. But please note that this version of NFS (unfs3) does not support NFS v4 NFS v2, it also does not support even a few tags to be configured as ''sync''.
 +
 +
I did not want to implement support for NFS v2 definitely outdated, it assumes that an NFS client, unless otherwise specified, the protocol that should be used to share a folder locally exported from a remote machine, and NFS v3. Finally NFS v2 does not support files larger than 2GB.
 +
 +
Once your exports file you can reboot the machine or if you prefer to manually start the daemons with the command:
 +
 +
# ngc -u portmap
 +
# ngc -u unfs3
 +
 +
For more information on ngc, type:
 +
 +
# ngc -h
 +
 +
And to think that this nas not use it even more ...
 +
 +
'''Upgrade.'''
 +
 +
I modified the script again ''unfs3.i'' putting the line ''require_network'' immediately due to the opening of the demon unfsd by initng (even before the network interface lan was active). The demon unfsd did not publish the socket address of local network preventing access remotely.
 +
 +
Clause ''require_network'' imposes initng to wait while the network interface of the LAN is active before starting the server unfsd: problem solved.
 +
 +
'''Rsync'''
 +
 +
Startup script for rsync. (The program is already included in nas)
 +
File rsyncd.i :
 +
 +
#!/sbin/itype
 +
 +
# Short-Description: fast remote file copy program daemon
 +
# Description: rsync is a program that allows files to be copied to and
 +
# from remote machines in much the same way as rcp.
 +
# This provides rsyncd daemon functionality.
 +
 +
daemon rsyncd {
 +
  need = bootmisc virtual/net;
 +
  require_network;
 +
  env RSYNC_CONFIG_FILE=/etc/rsyncd.conf;
 +
  env_file = ${RSYNC_CONFIG_FILE};
 +
  exec daemon = /usr/bin/rsync --daemon --no-detach --config ${RSYNC_CONFIG_FILE};
 +
  daemon_stops_badly;
 +
}
 +
 +
For more information on rsync to see in the comments of this article.
  
 
== Reviews ==
 
== Reviews ==
Line 507: Line 675:
 
# http://www.linuxdevices.com/news/NS2898756158.html
 
# http://www.linuxdevices.com/news/NS2898756158.html
 
# http://www.steppen-wolf.eu/blog/2009/11/18/lacie-2big-network-hack-telnet-openssh-ntpd-cups-and-more
 
# http://www.steppen-wolf.eu/blog/2009/11/18/lacie-2big-network-hack-telnet-openssh-ntpd-cups-and-more
 +
# http://www.steppen-wolf.eu/blog/2010/04/14/lacie-2big-network-tweaking-deframmentazione-filesystem-con-xfs_fsr/
 +
# http://www.steppen-wolf.eu/blog/2010/10/22/lacie-2big-network-supporto-nfs/
  
 
== Internal Images ==
 
== Internal Images ==
 
[[Image:Lacie 2big boardl.jpg|thumb|left]]
 
[[Image:Lacie 2big boardl.jpg|thumb|left]]

Latest revision as of 21:07, 11 January 2012

2big Network.jpg
2big Network
CPU 400 MHz Marvell Orion 88F6182
RAM 64 MB DDR2
Flash ROM 512 KB
Other
NIC
USB 2 Ports
internal HDD 2 * Hitachi DeskStar HDP725050GLA360
IDE Controller
Drive Capacity 2 * 512/768/1024 MB
Fan no fan, thermally-controlled blower

Steppenwolf's Hacking HOWTO

Steppenwolf has an excellent HOWTO on his blog. It is in Italian unfortunately but Google Translate does a great job.

What will follow now is a copy of his Google Translated blog post to preserve it, should it ever be taken offline, and to provide the NAS-Central users with as much info as possible.

This definitely needs to be reviewed and gramatically corrected!

General Information

The goal of this post is to add a shell ssh daemon ntpd to your nas, but before doing so it is good to understand a little machine with which we deal. The LaCie 2big Network nas taken as reference and on which was performed this procedure has the official firmware, distributed by LaCie , updated to version 2.2.3.

# cat /proc/cpuinfo

Processor       : ARM926EJ-S rev 0 (v5l)
BogoMIPS        : 266.24
Features        : swp half thumb fastmult edsp
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 0
Cache type      : write-back
Cache clean     : cp15 c7 ops
Cache lockdown  : format C
Cache format    : Harvard
I size          : 32768
I assoc         : 1
I line length   : 32
I sets          : 1024
D size          : 32768
D assoc         : 1
D line length   : 32
D sets          : 1024

Hardware        : Feroceon
Revision        : 0000
Serial          : 0000000000000000 
# cat /proc/version

Linux version 2.6.22.7 (root@grp-dash) (gcc version 4.2.1) #1 Thu Apr 9 16:07:45 CEST 2009
# free
        total    used    free    shared    buffers
Mem:    61952    60184   1768    0         7384
Swap:   128376   60184   0       128376
Total:  190328   130144
# df -h

Filesystem  Size    Used    Available    Use%    Mounted on
rootfs      648.4M  20.2M   595.3M       3%      /
udev        648.4M  20.2M   595.3M       3%      /dev
/dev/md0    7.5M    5.9M    1.2M         83%     /oldroot
udev        10.0M   0       10.0M        0%      /oldroot/dev
udev        10.0M   0       10.0M        0%      /oldroot/dev
none        30.3M   0       30.3M        0%      /oldroot/dev/shm
/dev/md1    167.0M  111.3M  47.1M        70%     /oldroot/var/original
/dev/md2    648.4M  20.2M   595.3M       3%      /oldroot/snapshots
unionfs     648.4M  20.2M   595.3M       3%      /
/dev/md4    930.4G  1.2M    930.4G       0%      /home
# cat /proc/partitions

major minor  #blocks  name

8     0  976762584 sda
8     1          1 sda1
8     2  975755970 sda2
8     5     128457 sda5
8     6       8001 sda6
8     7       8001 sda7
8     8     176683 sda8
8     9     674698 sda9
8    10       8001 sda10
8    16  976762584 sdb
8    17          1 sdb1
8    18  975755970 sdb2
8    21     128457 sdb5
8    22       8001 sdb6
8    23       8001 sdb7
8    24     176683 sdb8
8    25     674698 sdb9
8    26       8001 sdb10
31    0        512 mtdblock0
9     0       7936 md0
9     1     176576 md1
9     2     674624 md2
9     3     128384 md3
9     4  975755904 md4
# cat /proc/mtd

dev:    size   erasesize  name
mtd0: 00080000 00010000 "cfi_flash_0"

In short, it is a Linux operating system with a very dated (sic) kernel compiled for ARM processor architecture, 400mhz cpu, 64mb of ram (the new models have 128 MB of RAM) and bootloader uboot. From the limited information obtained from the official site scratcbox seems to have been used to build the system and starting services and daemons uses initng instead of init.d. The problems that arise are plenty: the retrieval of software already compiled for the system (unless you jump headlong into cross-compiling) compatible with the versions used by the library and the creation of nas startup scripts for initng. The scripts for initng found on the internet must be modified slightly to make them work on the system, given that developers have not complied fully with the specifications initng to include all the *. script in the folder /etc/initng/ without performing the division in subfolders (daemon for demons, net for network services, etc.)

Hacking

Disclaimer: I do not assume any responsibility if, following the changes made, your system stops working properly. I remind you also that any software or hardware changes to the system will void the warranty by the manufacturer.

Access to the system is crucial to add to our nas a bash script that executes commands at will (webshell) or, preferably, an ad hoc script to start the telnet service and have a root console remote. There are several ways to "pierce" your nas, in fact, depending on the services started on the machine the safety of this object is far down the drain. A very simple way to access the system without physically removing disks is to create a new share with a particular path. (See below) You will have access to the entire system with administrator privileges since the webserver has the nas as root.


2Big Network Web Browser Hacked


The counterpart of this hack is that the machine is rebooted, the share created by the system is changed (security mechanism?) And redirected into your root share, forcing them to have to re-apply the 'patch' whenever you feel the need to access the your Linux system. Even the removal of the new share is to be performed with extreme care. My suggestion is to remove this share once it has nas were uploaded on the telnet daemon and its startup files (see below).

Hacking through the creation of a new share

Create a new share on your NAS called "Hack". The path of the share is not important what is important is that you enable at least sharing http. Save the xml configuration of your NAS disk (System-> Maintenance-> Save Configuration) Make a backup copy of the file you just saved (Fatelo! you will need it later to put things in order). Edit the file downloaded xml configuration changing the path of sharing "Hack" as shown:

config.xml

Keep in mind the lines of the code of your xml files can be different than shown above, in relation to the number of shares of your machine, by users and groups.

  • Save your changes and upload the new configuration on the NAS (System-> Maintenance-> Download the configuration)
  • Use your browser and access the administration page of nas and click Browse to navigate to the new share on the web.

The magic is performed by line ../../../../ which requires the system to create a new share from the root. If you try to unshare "hacks" do harm to your system, it also will remove together with shared files in it (so the operating system of the NAS). A painless way to make the removal of the load sharing is the backup configuration previously done nas (edconf.xml) and only after unshare 'hack' normally through the web interface.

Once you have access to the filesystem, for more with root rights (!), You can upload all the files you want.

Binaries compiled for ARM architecture, and configuration files for pam and initng

From here on, you will need this file:

>> LaCie_2Big_Network_TELNET-NTP-SSH-CUPS.zip (6.79 Mb)

containing all the binaries and libraries, compiled for the ARM architecture, you need to install on your nas demons Telnet, NTP, OpenSSH and Cups. The archive contains the following files:

  • cups-1.3.8-r1.tbz2 (1.89 Mb), containing all files of the print service. is included in the archive library also libpaper ( libpaper-1.1.23.tbz2 ) required by the cups and not found in nas.
  • cups-1.3.8-r1_(driver).tbz2 (3.74Mb), containing all ppd in the deployment of ubuntu 9.10. This file, of course, is not on the website where I recovered the compiled binaries for the nas.
  • cups-1.3.8-r1_(language).tbz2 (419KB), containing the translation in all major languages, including Italian, html pages cups. This file is not on the website where I recovered the compiled binaries for the nas.
  • ntp-4.2.4_p4.tbz2 (247KB), containing the binaries and configuration files for the NTP daemon
  • openssh-4.7_p1-r6.tbz2 (490Kb), containing the binaries and configuration files for the ssh daemon. The archive also contains the libraries tcp-wrappers ( tcp-wrappers-7.6-r8.tbz2 ) required by the daemon is not present in nas.
  • usbutils-0.73.tbz2 (86.2 Mb). This file is not necessary to install nas it is required to run cups, however, can help by installing the executable lsusb .
  • utelnetd.tbz2 (5.7Kb), containing the demon utelnetd and a file to run (see next paragraph for more info)

The original files I have recovered from the site:

http://downloads.buffalo.nas-central.org/LSPro_ARM9/Distributions/Genlink/Binaries/armv5tejl-softfloat-linux-gnueabi/

where there are many pre-compiled packages for the buffalo nas. Except that these packages are designed for a system that uses no inet.de initng, so I had to create my hand the scrip to start sshd, ntpd and cups (respectively /etc/initng/sshd.i , /etc/initng/ntpd.i and /etc/initng/cups.i ). I can assure you that it was not a pretty sight: the documentation is somewhat lacking and on the official forum of the project initng is overwhelmed by spam. (How I love spammers : Evil: )

I wanted to leave separate packages, avoiding to make a single archive, so that you have the greatest choice of what to install. From the files I removed the man page and docs.

Add telnet to NAS

The archive utelnetd.tbz2 contains two files, the telnet daemon and a file to launch it and configure the bash on your system. Copy the two files in the folder /www/cgi-bin/public/ previously created through the sharing. Here is the contents of the file telnet.cgi:

#!/bin/sh
echo "Content-type: text/plain"
echo ""

# Settings for root bash shell
HOME='/root'
PATH='/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:.:'
TERM=linux

PS1='\u@\h:\w# '
PS2='> '
PS3='> '
PS4='+ '
export PS1 PS2 PS3 PS4 PATH HOME TERM

# Run telnet daemon
echo utelnetd -l /bin/bash
eval utelnetd -l /bin/bash

You can launch your telnet daemon from a web browser at:

 http://<your.nas.ip>/cgi-bin/public/telnet.cgi

If the page is white and not worry infinite load, run telnet client can also list your address of nas and enjoy your root console without login. (Hooray safety!) Once you have a console at all the effects you can even think about making a step forward with installing openssh security.

Installing OpenSSH

Copy the file openssh-4.7_p1-r6[modificato].tbz2 in your shared folder on the NAS. From the console, telnet performed:

# cd /home/share/folder_name_of_your_share
# tar -xvjf openssh-4.7_p1-r6.tbz2 -C /
# rm openssh-4.7_p1-r6.tbz2
# cd /etc/initng/runlevel/
# echo sshd >> default.runlevel
# touch /var/log/lastlog

At first startup after installation of ssh nas will, for once, the slower, the cause is the automatic creation of files:

ssh_host_dsa_key
ssh_host_dsa_key.pub
ssh_host_key
ssh_host_key.pub
ssh_host_rsa_key
ssh_host_rsa_key.pub

required for the operation of the ssh daemon itself (folder /etc/ssh/ ).

Here is the configuration file ( sshd.i ), included in the archive for initng for the sshd daemon:

#!/sbin/itype

# NAME: OpenSSH
# DESCRIPTION: The standard Linux SSH server
# WWW: http://www.openssh.com/

service sshd/generate_keys {
  env KEYGEN=/usr/bin/ssh-keygen;
  env RSA1_KEY=/etc/ssh/ssh_host_key;
  env RSA_KEY=/etc/ssh/ssh_host_rsa_key;
  env DSA_KEY=/etc/ssh/ssh_host_dsa_key;
  script start = {
    [ ! -s ${RSA1_KEY} ] && \
      ${KEYGEN} -q -t rsa1 -f ${RSA1_KEY} -C  -N  2>&1
    if [ ! -s ${RSA_KEY} ] ; then
      ${KEYGEN} -q -t rsa -f ${RSA_KEY} -C  -N  2>&1
      chmod 600 ${RSA_KEY}
      chmod 644 ${RSA_KEY}.pub
    fi
    if [ ! -s ${DSA_KEY} ] ; then
      ${KEYGEN} -q -t dsa -f ${DSA_KEY} -C  -N  2>&1
      chmod 600 ${DSA_KEY}
      chmod 644 ${DSA_KEY}.pub
    fi
  }
}

daemon sshd {
  need = bootmisc virtual/net mountfs;
  pid_file = /var/run/sshd.pid;
  need = sshd/generate_keys;
  exec daemon = /usr/sbin/sshd -D;
  daemon_stops_badly;
  respawn;
}

Another problem is the pam, even here, the file listed in the original does not work and I had to edit it by hand. Here's the new content:

#%PAM-1.0

auth        required     pam_unix.so
account     required     pam_unix.so
password    required     pam_unix.so
session     required     pam_unix.so

Modify it to your discretion (file /etc/pam.d/sshd ).

Persistence of user privileges

The problems do not end there, however. At each restart of the machine the file /etc/passwd and /etc/shadow is overwritten. In particular, each new user created through the web interface of the NAS does not have the right to log into the remote console nas. Ex:

admin:x:500:100::/home:/bin/false 

The /bin/false is our problem! To remedy the situation I created a service for initng called personal, which allows you to restore the privileges of an account:

#!/sbin/itype
#
# Cambiate la riga user="utente" inserendo a posto di 'utente' il nome dell'utente da voi creato

service personal {
  need = edconfd/ready;
  last;
  script start = {
    user="utente"
    PASSWD="$user:x:0:0::/root:/bin/bash"

    if [ "x`cat /etc/passwd | grep $user`" == "x" ]; then
      echo $PASSWD >> /etc/passwd
      echo "Insert user $user done" >&2
    else
      LINE="`cat /etc/passwd | grep $user`"
      if [ "$LINE" != "$PASSWD" ]; then
        sed -i "s#${LINE}#${PASSWD}#g" /etc/passwd
        echo "User $user restored" >&2
      fi
    fi
    exit 0
  };
}

It is assumed that the user has been previously created using the web interface of nas.

The only change required is to change the string user="utente" , instead of entering the user name of the user you created. The script involves changing the privileges of the user (which will become an alter ego of the root) and the ability to remotely log into the ssh shell. The file is not present in any archive, but you can download it here:

  • personal.i (first version)
  • personal2.i (version for savvy)

To start automatically at boot script to copy the file nas personal.i in the folder /etc/initng/ and run:

# cd /etc/initng/runlevel/
# echo personal >> default.runlevel

Once the script has been added you can finally get rid of your telnet daemon and its startup files from the folder /www/cgi-bin/public/ . For good luck I suggest you reboot the machine and make sure everything works as you wait for us to remove the first two rows.

Problems with passwd and up and customizing of the bash promtp

When developers have completed the system of LaCie have left out, deliberately I think, something ... Login as root and run the nas (remember telnet access you have is the root):

# vi /etc/busybox.conf

Put these lines, save the file and exit the editor

[SUID]
passwd = ssx 0.0
su = ssx root.0

From the console, always with the root account, run these commands:

# chown 0.0 /etc/busybox.conf
# chmod 600 /etc/busybox.conf
# chown 0.0 /bin/busybox
# chmod 4755 /bin/busybox 

The problems of and passwd are over.

If you want the extended prompt of bash I recommend editing the file /etc/profile.bash change the line:

 PS1='[\u@\h \W]\$ ' 

in

 PS1='[\u@\h \w]\$ '

Installing NTP

Copy the file ntp-4.2.4_p4.tbz2 (247KB) in your shared folder on the NAS. From the console, with the active root privileges, run:

# cd /home/share/folder_name_of_your_share
# tar -xvjf ntp-4.2.4_p4.tbz2 -C /
# rm -r ntp-4.2.4_p4.tbz2
# cd /etc/initng/runlevel/
# echo ntpd >> default.runlevel

This here is the configuration file, included in the archive for initng for the ntpd daemon:

#!/sbin/itype

daemon ntpd {
  env NTPD_PID = /var/run/ntpd.pid;
  need = bootmisc virtual/net;
  require_network;
  exec daemon = /usr/sbin/ntpd -c /etc/ntp.conf -p ${NTPD_PID};
  forks;
  pid_file = ${NTPD_PID};
  respawn;
} 

Do not forget to properly configure your time zone. You can do it from the web page configuration "system" of your nas. Finally reboot the NAS.

Installing CUPS (print server)

Copy the file cups-1.3.8-r1.tbz2 (1.89Mb) in your shared folder on the NAS.

From the console, with the active root privileges, run:

# cd /home/share/folder_name_of_your_share
# tar -xvjf cups-1.3.8-r1.tbz2 -C /
# rm -r cups-1.3.8-r1.tbz2
# cd /etc/initng/runlevel/
# echo cupsd >> default.runlevel

Open the web interface of the NAS and click Groups and then add, and create a new group named "lpadmin" group and add the user that you created earlier to access the NAS through ssh.

# vi /etc/sysconfig/modules

Add a line usblp , as shown and saved.

File /etc/sysconfig/modules

The last step requires the system to load automatically when the module that supports printing to USB port. Remember that the commands for editing a file with the vi editor is the "i" to insert new text, and "ESC" + ": wq" to save and exit.

Here is the configuration file, including archive, to automatically start the daemon via cups initng:

#!/sbin/itype

# NAME: CUPS
# DESCRIPTION: The Common Unix Printing System
# WWW: http://www.cups.org

daemon cupsd {
  need = bootmisc dbus virtual/net avahi;
  require_network;
  exec daemon = /usr/sbin/cupsd -F -c /etc/cups/cupsd.conf;
}

You must also edit the file /etc/cups/cupsd.conf to allow remote administration of the cups, or inactive. To help you carry my configuration file . For further help on how to configure the cups I refer you to the official website www.cups.org .

Even for cups I had to edit the pam file by hand. Here's the new content:

#%PAM-1.0

auth        required     pam_unix.so
account     required     pam_unix.so

Modify it to your discretion (file /etc/pam.d/cups ).

Once rebooted, the cups will be running and is accessible at port 631 of your nas:

https://<your.nas.ip>:631

The files cups-1.3.8-r1_(driver).tbz2 and cups-1.3.8-r1_(launguage).tbz2, are optional and contain the drivers and the translation of the web, install them or not is your choice. You can also install only the Italian language from the archive by removing cups-1.3.8-r1_(launguage).tbz2 the language folders you do not want, the same applies to the file with the drivers.

To print in raw form (pre-formatted output) must uncomment the following line from the file /etc/cups/mime.convs :

application/octet-stream application/vnd.cups-raw 0 -

Make sure also not commented the following line of the file /etc/cups/mime.types :

application/octet-stream

In linux the printer will be found at (watch at times there is no need to specify the port number):

ipp://indirizzo_nas:631/printers/nome_stampante

Ex:

ipp://192.168.1.100:631/printers/ML-3050

In Windows XP click on "Add Printer" and to add a new network printer and select "printer on the Internet or on your home or business" and use the URL:

http://<your.nas.ip>:631/printers/nome_stampante

Select, finally, the driver for your printer. A small clarification, the samba of NAS has not been compiled with support for the cups. ( libcups.so.2 )

Restoration

You can restore the previous state of the NAS file system changes by updating the firmware, even with the same version installed on the NAS, in my case 2.2.3, using the utility from LaCie same provision. However you can not do this if the NAS is no longer visible on the network, because the utility does not perform the upgrade process if you do not see the above nas.

Links

Speculations

A very interesting idea that came to mind is to change the raid of nas. In particular, use external hard drives, usb docking ports, as part of the raid using raid 5, or add an external HD to use as spares in case of failure. I have not done any testing on this, mainly for lack of hd, but if someone had the same idea and my feeling is there let me know something. :-)

Upgrading the kernel (?!?)

Thanks

I thank the members of the forum "General NAS-Central Forums", which with their helpful post allowed the writing of this article and especially to pierce my nas. :-)

Further NAS tweaking

These are 2 more Google Translated posts made by Steppenwolf on his blog.

LaCie 2big Network tweaking: filesystem defragmentation xfs_fsr

Those who have already done the hack will have noticed that the partition containing the user data is formatted with the filesystem xfs. This excellent filesystem has a bad habit, with the use of fragment thus deteriorating its performance.

To see the fragmentation status of your file system:

# xfs_db -c frag -r /dev/md4

You will see something like this:

actual 3144, ideal 3135, fragmentation factor 0.29%

We need to defragment the nas utility xfs_fsr , which is not installed on the nas. I retrieved the program from the distro package xfsdump compiled for debian lenny armtel therefore compatible with the nas. I removed all files from the package does not strictly necessary, reducing it to 14kb.

# cd /home/share/nome_cartella_della_vostra_condivisione
# tar -xvzf xfsdump_2.2.48-1_armel.tar.gz -C /
# xfs_fsr -v

You can also go take a coffee, the first execution of the program has committed more than 4 hours to finish. :-P

For those who had not been informed, has recently released a firmware update ver 2.2.6 of nas. If you wonder what happened to versions 2.2.4 and 2.2.5 of 2.2.4 ... well, I can not tell much, but the firmware version 2.2.5 has been a total flop. The installation process, which consisted of two files to upload to the NAS, they planted the loading of the second file.

I tested the hack on this new firmware version in the following ways:

  • nas with firmware 2.2.3 and updated to ver 2.2.6
  • updated to version 2.2.6 and higher

in both cases it was possible to pierce the nas.

LaCie 2big Network: support user-space NFS

I had previously tried to install the nfs support on my old (v1) nas of the LaCie 2big Network, but I gave up for the lack of nfsd kernel module, which allows you to enable NFS server kernelspace.

Recently, after a request for help from a navigator, I tackles the problem by finding a solution: nsf in user space. Ok I also turn up their nases because of the enormity of what I just said .. In fact, there are no major handicap for nfs userspace: the development of the code has been completely abandoned (the latest version is 0.9.22 and dates back to 01/05/2009), but the most serious problem that there is no support for the file locking.

To install support for NFS v3 on nas need unfsd demons and portmap, nfs, the first is that the second is an ONC RPC service, running on a networked machine, which provides other services ONC RPC (Remote Procedure call). (If you're used to program knows what I'm talking about) In short unfs3 the package depends on the package portmap. For all practical purposes means that the installation is required also to have nfs portmap service running. It also means that I have written two scripts for initng to start / stop the daemons properly.

File portmap.i:

# NAME: portmap
# DESCRIPTION: DARPA port to RPC program number mapper
# WWW: 

# exec daemon = /sbin/portmap -d ${PORTMAP_OPTS};
daemon portmap {
  need = bootmisc virtual/net;
  provide = virtual/portmap;
  pid_file = /var/run/portmap.pid;
  forks;
  env PORTMAP_OPTS=;
  env_file = /etc/portmap.conf;
  exec daemon = /sbin/portmap;
}

File unfs3.i:

# NAME: unfs3
# DESCRIPTION: starts user-space NFSv3 server.
#         UNFS3 is a user-space implementation of the NFSv3 server specification.
#         It provides a daemon for the MOUNT and NFS protocols,
#         which are used by NFS clients for accessing files on the server.
#         Unlike nfs-user-server, unfs3 is capable of handling files larger than 2GB,
#              but there is currently no support for file locking.
# WWW:

daemon unfs3 {
  need = initial virtual/portmap virtual/net;
  env PID_FILE = /var/run/unfsd.pid;
  env_file = /etc/unfs3.conf;
  pid_file = ${PID_FILE};
  require_network;
  forks;
  exec daemon = /usr/sbin/unfsd -i ${PID_FILE} $DAEMON_OPTS;
  daemon_stops_badly;
}

Installing servers nfs3

As a general assumes that:

  • have already made ​​the hack of your nas ( see article ),
  • and above all with it installed ssh tcp-wrappers libraries,
  • you have a root account on your NAS (all documented in the operations mentioned above)
  • and above all, a good command of bash and linux systems.

To install the nfs server, you have to download these two files:

The packages have been downloaded the distro debian lenny and are compiled for armtel, I deleted the files from both the doc and man pages in order to recover all the space possible. I moved the portmap configuration file in the folder /etc and I renamed portmap.conf. The daemon configuration file has unfsd own (not to be confused with the file /etc/exports) I renamed unfs3.conf and also inserted in the folder /etc. These changes were due since the NAS architecture differs from architecture of an operating system debian. The script to reflect these changes initng so if you changed the files you place to amend the startup scripts of the demons.

Copy the file in your shared folder on the NAS.

# cd /home/share/nome_cartella_della_vostra_condivisione
# tar -xvzf portmap_6.0-9_armel.tar.gz -C /
# tar -xvzf unfs3_0.9.21_armel.tar.gz -C /
# rm portmap_6.0-9_armel.tar.gz
# rm unfs3_0.9.21_armel.tar.gz
# cd /etc/initng/runlevel/
# echo portmap >> default.runlevel
# echo unfs3 >> default.runlevel

Now you must configure the file exports that tells the NFS daemon which folders to share in your local network:

# vi /etc/exports

Remember that the commands for editing a file with the vi editor is the "i" to insert new text, and "ESC" + ": wq" to save and exit, "ESC" + ": q!" to force the output from the file without saving your changes.

The configuration file in question I leave to your own experience, if you are installing NFS on the NAS assumes that you know what you are doing. But please note that this version of NFS (unfs3) does not support NFS v4 NFS v2, it also does not support even a few tags to be configured as sync.

I did not want to implement support for NFS v2 definitely outdated, it assumes that an NFS client, unless otherwise specified, the protocol that should be used to share a folder locally exported from a remote machine, and NFS v3. Finally NFS v2 does not support files larger than 2GB.

Once your exports file you can reboot the machine or if you prefer to manually start the daemons with the command:

# ngc -u portmap
# ngc -u unfs3

For more information on ngc, type:

# ngc -h

And to think that this nas not use it even more ...

Upgrade.

I modified the script again unfs3.i putting the line require_network immediately due to the opening of the demon unfsd by initng (even before the network interface lan was active). The demon unfsd did not publish the socket address of local network preventing access remotely.

Clause require_network imposes initng to wait while the network interface of the LAN is active before starting the server unfsd: problem solved.

Rsync

Startup script for rsync. (The program is already included in nas) File rsyncd.i :

#!/sbin/itype

# Short-Description: fast remote file copy program daemon
# Description: rsync is a program that allows files to be copied to and
# from remote machines in much the same way as rcp.
# This provides rsyncd daemon functionality.

daemon rsyncd {
  need = bootmisc virtual/net;
  require_network;
  env RSYNC_CONFIG_FILE=/etc/rsyncd.conf;
  env_file = ${RSYNC_CONFIG_FILE};
  exec daemon = /usr/bin/rsync --daemon --no-detach --config ${RSYNC_CONFIG_FILE};
  daemon_stops_badly;
}

For more information on rsync to see in the comments of this article.

Reviews

  1. http://www.smallnetbuilder.com/content/view/30379/75/

Links

  1. http://www.linuxdevices.com/news/NS2898756158.html
  2. http://www.steppen-wolf.eu/blog/2009/11/18/lacie-2big-network-hack-telnet-openssh-ntpd-cups-and-more
  3. http://www.steppen-wolf.eu/blog/2010/04/14/lacie-2big-network-tweaking-deframmentazione-filesystem-con-xfs_fsr/
  4. http://www.steppen-wolf.eu/blog/2010/10/22/lacie-2big-network-supporto-nfs/

Internal Images

Lacie 2big boardl.jpg

This category currently contains no pages or media.