Tuesday, December 30, 2008

PCI MZK-NAS01SG / MZK-NAS02SG modding

This NAS comes with Linux OS and BT download / iTunes / UPnP DLNA AV Server and can be modified using the Dlink - DNS323 funplug packages

Objective of modding
(a) Add ssh server
(b) Add lighttpd (port 80), php & mysql
(c) change the web admin http page to port 81

Steps

(1) Upgrade NAS firmware 1.1.2

(2) Setup the BT Downloader and FTP / Samba server via the web admin of the NAS

(3) Use telnet to gain access
telnet 192.168.1.100 1192
ID: root
PASSWORD: password

(4) install funplug

cd /DataFolder
mkdir ffp
cd ffp
wget http://www.inreto.de/dns323/fun-plug/0.5/fun_plug.tgz
tar zxvf funplug.tgz
ln -sf /DataFolder/ffp /
export PATH=/ffp/bin:/ffp/sbin/:$PATH

(5) download funplug packages

cd /DataFolder/ffp
rsync -av inreto.de::dns323/fun-plug/0.5/packages .


(6) start ssh server

chmod 111 /ffp/var/lib/sshd
sh /ffp/start/sshd.sh start


(7) Install lighttpd, php and mysql

cd /DataFolder/ffp
mkdir -p packages
wget http://81.216.140.39/dns-323/mysql_and_php/mysql-5.1.28-rc-1.tgz
wget http://81.216.140.39/dns-323/mysql_and_php/php-5.2.6-mysql51-1.tgz
funpkg -i mysql-5.1.28-rc-1.tgz
funpkg -i php-5.2.6-mysql51-1.tgz
chmod u+x /ffp/start/mysqld.sh
/ffp/start/mysqld.sh restart
/ffp/bin/mysqladmin -u root password 'new-password'
ln -s /ffp/var/mysql.sock /tmp/mysql.sock
cp /DataFolder/ffp/etc/examples/lighttpd.conf-with-php /DataFolder/ffp/etc/lighttpd.conf
cp /DataFolder/ffp/etc/examples/my.cnf /DataFolder/ffp/etc/my.cnf
vi /DataFolder/ffp/etc/lighttpd.conf
mkdir -p /DataFolder/ffp/etc/www/logs
mkdir -p /DataFolder/www/tmp
echo '<?php phpinfo(); ?>' > /DataFolder/www/index.php


when editing lighttpd.conf change these


server.document-root = "/DataFolder/www/"
server.upload-dirs = ( "/DataFolder/www/tmp" )
server.errorlog = "/DataFolder/ffp/etc/www/logs/error.log"
accesslog.filename = "/DataFolder/ffp/etc/www/logs/access.log"
server.port = 80


(8) Modify btdog (so that the modding will be effective even after NAS reboot)

mv /DataFolder/.bittorrent/bin/btdog /DataFolder/.bittorrent/bin/btdog_bak
vi /etc/protocols


and add this line to /etc/profile


export PATH=/ffp/bin:/ffp/sbin/:$PATH



cp /etc/profile /DataFolder/.bittorrent/bin/profile.bak
vi /DataFolder/.bittorrent/bin/btdog


the content of btdog is

btdog: Select all


#ledset 4=USB1 6=USB2 7=Power 17=HDD1 18=HDD2, 0=on 1=off
#/bin/ledset 4 1
#/bin/ledset 6 1
#/bin/ledset 7 1
#/bin/ledset 17 1
#/bin/ledset 18 1
ln -s /DataFolder/ffp/ /ffp
export PATH=/ffp/bin:/ffp/sbin/:/usr/bin:/bin:/usr/sbin:/sbin
killall webs nashttpd
cp /DataFolder/.bittorrent/bin/profile.bak /etc/profile
/DataFolder/ffp/sbin/lighttpd -f /DataFolder/ffp/etc/lighttpd.conf&
chmod 600 /DataFolder/ffp/etc/ssh/ssh_host_rsa_key /DataFolder/ffp/etc/ssh/ssh_host_dsa_key /DataFolder/ffp/etc/ssh/ssh_host_key
chmod 600 -R /DataFolder/ffp/var/lib/sshd
chmod 111 /DataFolder/ffp/var/lib/sshd
sh /DataFolder/ffp/start/sshd.sh start
cp /DataFolder/ffp/etc/my.cnf /etc/my.cnf
chmod 0644 /etc/my.cnf
chmod +x /DataFolder/ffp/start/mysqld.sh
sh /DataFolder/ffp/start/mysqld.sh start&
webs&
ln -sf /DataFolder/ffp/var/mysql.sock /tmp/mysql.sock
/DataFolder/.bittorrent/bin/btdog_bak /DataFolder/.bittorrent/bin/bt -daemon-loop --default-settings-file /DataFolder/.bittorrent/bin/btsettings.txt



change btdog to be executable

chmod +x /DataFolder/.bittorrent/bin/btdog



(9) reboot NAS and test lighttpd, php, mysql, ssh and other servers

and enjoy installing some more packages from fun-plug see here






7 comments:

Shannon said...

Hi! I'm really glad to see some activity on the MZK-NAS02SG finally. I have been having some trouble with the setup though.
I have not been able to get funplug to start up on boot, but when I do, I'm not able to get anything else running after I do get funplug started. Is there more information on this setup elsewhere that you have come across, or more info you could impart?

catweasle said...

Many thanks javacom. I got the ssh server and web server to work on my MZK-NAS01SG. But it seems that the required firmward (version 1.1.2) is still quite buggy. The print server does no longer work after upgrading to version 1.1.2, and the web-configuration interface for this device is close to useless (print server configuration tab has disappeared, the web download and bitorrent tab are either showing garbage or are having no effect). But the worst is that the access of shared folders on the NAS becomes VERY slow from a Windows XP client (it just sits there doing nothing for 30 second or so before it allows you to see and access the files on the NAS). Does anyone know how to get the print server working with firmware 1.1.2, and how to fix the speed issues with accessing shared folders on the NAS? Is there a plan for a newer firmware versions which fixes these bugs (while still leaving the telnet port open)?

Anonymous said...

any idea if this works on a Planex NAS-01G?

Giorgio said...

Dear Javacom, maybe You're my last tentative to recover my Planex MZK-NAS01G! During a FW upgrade I had a blackout, so now the NAS is corrupted. I did the factory reset, but nothing happen! I can see the Planex by network on IP 192.168.1.254 and also I can connect it by Telnet at port 1192. After this I'm not able to do anything! Could You kindly provide me a procedure to flash FW and for recovering my NAS? Many Many Thanks in advance for Your Help. GC.

Anonymous said...

Hi,

I have a little problem. When I modifi the lighttpd.conf, how can I get out of this screen and save the changes.

Regards

DaCypressMan

Oleg said...

Had the same issue. I could not access the box after an upgrade and reset to factory settings (pressed Copy + Release for 5 seconds).

Reading of the pdf manual was helpful.

The factory settings of the firmware 1.3.6TW are now http://192.168.1.100 with wiser "admin" and password "0000".

Dunnot know the telnet port yet.

Леонид Седой said...

Hi there!
I'm owner EDIMAX NAS-2505 with MZK-NAS02SG lastest f/w 1.4.2. When I try install funplug, on stage (6) I've got this error:
---QUOTE
/ffp/bin/ssh-keygen: can't load library 'libcrypto.so.0.9.8'
/ffp/bin/ssh-keygen: can't load library 'libcrypto.so.0.9.8'
/ffp/bin/ssh-keygen: can't load library 'libcrypto.so.0.9.8'
Starting /ffp/sbin/sshd
/ffp/sbin/sshd: can't load library 'libwrap.so.0'
---UNQUOTE

Any comments?

Thank you!