DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#26 2007-04-26 15:28:51

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Updated fun_plug

haihai wrote:

Lighttpd has php support?

No.

Offline

 

#27 2007-05-15 03:42:04

AJ
New member
Registered: 2007-05-15
Posts: 4

Re: Updated fun_plug

Hi

A great forum which (with a lot of trial an error) has provided all the answers...

My setup with version 1.03 firmware, now includes the latest fun_plug "funplug-0.2" by fonz (Thanks fonz) with a webserver and SSH. And all appears to be working.

I have two questions:

# I can log into SSH using any of the users setup via the GUI but not as root. I've tried "passwd root" (in each folder with a passwd file) to successfully change my password, yet the password is never accepted via SSH.
NB. I use Telnet to run "passwd root"

As you may have gathered I've never been near Linux before, though I'm fairly comfortable with DOS



# I've noted all the warning's about 'Bricking' the DNS-323 so thought I'd ask before trying...

Is it possible to edit the following file to point to the index page used by lighttpd - and therefore avoid having to map ports?

/mnt/web_page/goweb.htm

<script>
location.replace("http://111.111.111.111/web/login.asp")
</script>/mnt/web_page #



Thanks again for all the help this forum has provided.

AJ

Offline

 

#28 2007-05-15 03:59:59

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Updated fun_plug

AJ wrote:

# I can log into SSH using any of the users setup via the GUI but not as root. I've tried "passwd root" (in each folder with a passwd file) to successfully change my password, yet the password is never accepted via SSH.

It's because root has no entry in /etc/shadow. To create that entry, do the following (in telnet). Be careful to enter first the command exactly as shown:

Code:

echo "root::0:0:99999:7:::" >>/etc/shadow
passwd

AJ wrote:

Is it possible to edit the following file to point to the index page used by lighttpd - and therefore avoid having to map ports?

Don't know. I wouldn't.

Offline

 

#29 2007-05-16 00:39:03

AJ
New member
Registered: 2007-05-15
Posts: 4

Re: Updated fun_plug

Thanks fonz - The change appeared to have worked until I rebooted (via the GUI). Prior to the reboot I was able to login as root via SSH and all appeared okay.
NB. I made no other changes in the GUI - just used it to reboot.

Is that a user error (I shouldn't be using the GUI) or something else I've done wrong?

Offline

 

#30 2007-05-16 01:00:10

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Updated fun_plug

AJ wrote:

Thanks fonz - The change appeared to have worked until I rebooted (via the GUI). Prior to the reboot I was able to login as root via SSH and all appeared okay.

It seems, the "root" line is removed from /etc/shadow on reboot. I guess that's another safety measure like the chmod orgy reported by radiusweb. someguy reported that he can change root password with an earlier busybox binary, however, i don't know if that changes passwd or shadow and if it survives reboots.

a work-around that probably works would be to store the "root" line from shadow in a separate file (e.g. in /mnt/HD_a2/fun_plug.d/etc/shadow.root) and then make the fun_plug script append this to /etc/shadow on boot.it's not ideal, though.

Offline

 

#31 2007-05-16 12:50:19

AJ
New member
Registered: 2007-05-15
Posts: 4

Re: Updated fun_plug

I tried again using  BusyBox v1.2.1 with the same result. The root entry is removed from /etc/shadow on reboot.

However, I may have found a solution. I used the GUI to add another user after the root entry then rebooted. I'm sure it didn't work at first but somehow, the root password seems to be maintained.

As I can't reproduce, though it does appear to be working (at present) I'm still interested in your suggestion to append the root password to shadow using fun_plug. Do I need to create a file with the encrypted password (copied from /etc/shadow) or can I just append this info via the fun_plug script?

I'm new to Linux - can you help with the script to append data to the /etc/shadow file via fun_plug.

Thanks for your help.

Offline

 

#32 2007-05-17 00:15:16

WildSioux
Member
Registered: 2007-03-05
Posts: 71

Re: Updated fun_plug

Ethereal_Dragon wrote:

Thanks for the updated fun_plug fonz!!! I currently have upgraded my DNS-323 to Firmware 1.03, and formatted the HDD's and they are back in a RAID1 array. Before I put all the files back, I want to work on the 323 a little bit... My telnet is working fine.

What I am trying to do now is get this lightppd thing working, and I have NO IDEA how to proceed.... From what I am reading on the wiki, and what you have in the fun_plug you provided, the setup's are different... I should mention that I know ABSOLUTLY NOTHING about linux and such, so I don't know what the hell I am doing, just trying to do my best from following the steps in the wiki, or the installation readme.

Can you give me a little insight with how to proceed?? Perhaps a tip with how to go about getting the lighttpd working, or a good reference I can use to learn.... I generally pick up on things fairly quickly when it is 'hands on'.

Also, any idea on how I can improve the FTP module, so that anonymous users don't have read access at root? I would also like to be able to have an FTP log, containing times, IP Addresses, files up/downloaded, and any other pertint info I may have overlooked.

Thanks in advance!!
-Zach

I am in the same spot as you are (were).  I want to install this lighttpd but know nothing about Linux.  I see that you were able to install it. 

So you just take that sample file, remove "sample" and copy it to the root of the DNS 323?  Then reboot?  It seems too easy.  But I don't have telnet access.  Anyone recommend a program to download to do this?  I have no idea where to even begin on this.

Offline

 

#33 2007-05-17 00:30:32

AJ
New member
Registered: 2007-05-15
Posts: 4

Re: Updated fun_plug

I also had no previous experience of Linux, but found most of the answers in various posts on this forum.

I recommend you follow the Beginners FAQ to setup Telnet and get more familiar with the unit, then upgrade to the latest versions of the fun_plug etc.
Start here... http://dns323.kood.org/information:beginner_s_faq

I'm not a programmer, so I also needed Google to help me with basic FTP and Linux commands, plus a lot of patience!

Offline

 

#34 2007-05-17 02:19:09

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Updated fun_plug

See following post by mykroft for the short version :-)

WildSioux wrote:

So you just take that sample file, remove "sample" and copy it to the root of the DNS 323?  Then reboot?  It seems too easy.  But I don't have telnet access.  Anyone recommend a program to download to do this?  I have no idea where to even begin on this.

There still seems to be some confusion. "fun_plug" is the name of a shell script (http://en.wikipedia.org/wiki/Shell_script). D-Link's firmware runs this shell script, if it exists, after you turn on your device. There is no "default" or "standard" fun_plug, you can create your own or use one created by others. People create fun_plug scripts to start programs, most notably a telnet server, but also e.g. the lighttpd web server, an NFS server, or SSH/SFTP. The programs you want to run must be installed in addition to the fun_plug script.

Now there are different ways to organize fun_plug script and programs. The beginners faq on the wiki (and many other wiki pages) follow an approach where program files are copied to a directory "lnx_bin/" (on the first volume), with some additional scripts in the root directory (of vol 1). Several ready-to-use programs and guides to compile your own programs are available. Still, you have to create (or copy&paste) your own fun_plug script.

The funplug package discussed in this thread basically works the same, but organizes things a little different. First, next to the "fun_plug" script, there's a "fun_plug.d/" directory (and no "lnx_bin/") with four subdirectories: "bin/" for program files, "etc/" for config files, "log/" for log files, and "start/" for scripts that start programs. The package is a collection of programs that I compiled for the DNS-323 along with a fun_plug script to start them automatically. A telnet server is also included. The current package is "funplug-0.2.tar.gz" and can be downloaded from my website. Install instruction are also on the website. (The lighttpd.conf-sample file is also part of this package and installed to fun_plug.d/etc/). There should be no need to modify the included fun_plug script.

If you're going to try a fun_plug, no matter what approach you follow, I strongly recommend you read the man(ual) pages of the commands  and the documentation of the programs that you want to use. Concerning the shell, the wikipedia article has some links to introductions, man pages are available at www.linuxmanpages.com.

Have fun.

Last edited by fonz (2007-05-17 02:58:15)

Offline

 

#35 2007-05-17 02:44:20

mykroft
Member
Registered: 2007-05-12
Posts: 83

Re: Updated fun_plug

Wild....

follow the link in the 1st post of this thread.  Grab the fun_plug file(s), and look at the readme file.  You ftp 2 files to your box, set the permissions on the fun_plug file to 777 and reboot - it does the rest by install the fun_plug files and auto activating telnet.....

Myk

Offline

 

#36 2007-05-17 16:17:56

leper
Member
From: sweden
Registered: 2007-05-17
Posts: 25
Website

Re: Updated fun_plug

Hi, I'm using your updated fun_plug (funplug-0.2.tar.gz) and it seems to work, well, mostly. I'm pretty sure that I'm the one doing something wrong, but I was hoping that maybe someone in here can help me out. I'm using firmware 1.03 (NAS202B_DLINKEu_DNS323.1.03b41(1.03.0330.2007)), and it works as it should, before installing the fun_plug. So, there is nothing wrong with my equpiment.

I have two problems:

#1 After installing a script for controlling the fanspeed (the one I found here), I can no longer disconnect from the telnet client, and connect again, unless rebooting the device. I can still access the device over the network (via the file explorer, or ftp), but telnet refuses to establish a connection. If I load the script on boot, I obviously cannot connect at all.
#2 After installing the fun_plug, my discs no longer spin down/enter sleep mode. If I remove the fun_plug, reboot, then they will enter sleep mode again.

How can I fix this? I really don't need the telnet connection (if that's what's breaking it), if I can use the fun_plug to automatically load the new fancontrolscript, since that is the only thing that I'm interested in changing (at least at this time). Any input is appreciated.

This is the script I am using as a fancontroller, it's slightly altered, but on the whole the same that FIB posted (see link above).

Code:

#!/bin/sh
#
# Kill the old fan controller
kill -9 `pidof fancontrol`
echo "Fancontrol killed. Installing fan_ctrl.sh"
#echo `pidof fancontrol`
#
update_interval=100
T1=105
T2=140
RPM1=1800
RPM2=4000
#
while [ 1 ]
do
  T=`temperature g 0`
  T=${T##*=}
  # Calibrate
  #T=`expr $T - 5`
  # Show temperature in  Celcius
  #echo "Calculating and setting fanspeed ..."
  newRPM=`expr \( \( $T2 \< $T \) \* $RPM2 \) \| \( \( $RPM1 + \( $RPM2 - $RPM1 \) \* \( $T - $T1 \) \/ \( $T2 - $T1 \) \) \& \( $T \>= $T1 \) \)`   
  fanspeed w $newRPM
  #echo `date` "Fahrenheit" $T "Celcius" `expr \( \( $T - 32 \) \* 10 + 9 \) \/ 18` "fanspeed w" $newRPM > /tmp/fan.txt
  #echo "CURRENT:" $T"F" `expr \( \( $T - 32 \) \* 10 + 9 \) \/ 18`"C -- fanspeed:" $newRPM "(written to /tmp/fan.txt)."
  # wait for next cycle
  sleep $update_interval
done

Offline

 

#37 2007-05-17 16:57:32

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Updated fun_plug

leper wrote:

#1 After installing a script for controlling the fanspeed (the one I found here), I can no longer disconnect from the telnet client, and connect again, unless rebooting the device. I can still access the device over the network (via the file explorer, or ftp), but telnet refuses to establish a connection. If I load the script on boot, I obviously cannot connect at all.

Your script must disconnect from the terminal. Start your script using:

Code:

/path/to/your/script >/dev/null 2>/dev/null </dev/null &

or have a look at: http://en.wikipedia.org/wiki/Nohup

Offline

 

#38 2007-05-17 20:00:48

WildSioux
Member
Registered: 2007-03-05
Posts: 71

Re: Updated fun_plug

mykroft wrote:

Wild....

follow the link in the 1st post of this thread.  Grab the fun_plug file(s), and look at the readme file.  You ftp 2 files to your box, set the permissions on the fun_plug file to 777 and reboot - it does the rest by install the fun_plug files and auto activating telnet.....

Myk

Thanks Myk, I downloaded the fun_plug file and read the readme file.  I downloaded an ftp program (SmartFTP Client) and have been trying to copy the 2 files but it fails to copy to the root of the first volume.  Do I even need the ftp program?  Can I just copy the files using windows explorer?

Offline

 

#39 2007-05-17 20:09:28

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Updated fun_plug

WildSioux wrote:

Can I just copy the files using windows explorer?

Hm... have you actually read the README.txt file? It says "Unpack funplug-0.2.tar.gz" (e.g. WinZip). It contains "fun_plug" and "fun_plug.tar". These are the two files that you have to copy to your device. Windows explorer should work.

Offline

 

#40 2007-05-17 20:18:22

WildSioux
Member
Registered: 2007-03-05
Posts: 71

Re: Updated fun_plug

fonz wrote:

WildSioux wrote:

Can I just copy the files using windows explorer?

Hm... have you actually read the README.txt file? It says "Unpack funplug-0.2.tar.gz" (e.g. WinZip). It contains "fun_plug" and "fun_plug.tar". These are the two files that you have to copy to your device. Windows explorer should work.

Yes, I unpacked the "funplug-0.2.tar.gz" file.  I then tried to copy the "fun_plug" and "fun_plug.tar" files by using the ftp client but it won't do it.  I can copy them by using the windows explorer just fine.  But I noticed you said to "ftp" them which is why I downloaded the ftp client.

Since I can copy using explorer, after copying do I just restart the box then?  Thanks

Offline

 

#41 2007-05-17 20:57:03

leper
Member
From: sweden
Registered: 2007-05-17
Posts: 25
Website

Re: Updated fun_plug

fonz wrote:

Your script must disconnect from the terminal. Start your script using:

Code:

/path/to/your/script >/dev/null 2>/dev/null </dev/null &

or have a look at: http://en.wikipedia.org/wiki/Nohup

Thank you very much, that solved the problem of telnet.

Now, on problem #2, I was a bit misinformed, it would seem. It was actually the script that prevented the discs from spinning down. I still don't know what causes it, but as long as I use fancontrol (standard) the discs enter sleep mode as expected, but with my script, they don't. I have commented out all references to echo's and writing to the disc, so that should not be a problem. Maybe I'm missing something?

Offline

 

#42 2007-05-17 21:46:03

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Updated fun_plug

leper wrote:

Now, on problem #2, I was a bit misinformed, it would seem. It was actually the script that prevented the discs from spinning down.

Add this to the start of your script:

Code:

PATH=/usr/bin:/bin:/usr/sbin:/sbin

It should then use "sleep" and "expr" from the the ramdisk (D-Link versions) instead of those installed on disk (funplug versions).

Offline

 

#43 2007-05-17 23:19:40

leper
Member
From: sweden
Registered: 2007-05-17
Posts: 25
Website

Re: Updated fun_plug

fonz wrote:

leper wrote:

Now, on problem #2, I was a bit misinformed, it would seem. It was actually the script that prevented the discs from spinning down.

Add this to the start of your script:

Code:

PATH=/usr/bin:/bin:/usr/sbin:/sbin

It should then use "sleep" and "expr" from the the ramdisk (D-Link versions) instead of those installed on disk (funplug versions).

Not only did you create an excellent way for me to install a fun_plug, but you managed to solve my problems with scripting as well. Thank you very much fonz. Now the 323 is working just as I need it to (and it is quite a lot less noisy, at least at light/medium load, thanks to FIB's fan script and your own help).

Offline

 

#44 2007-05-18 02:01:27

WildSioux
Member
Registered: 2007-03-05
Posts: 71

Re: Updated fun_plug

fonz...I copied the 2 files over to the root of Volume_1, and rebooted but nothing happened.  It said it would start a "telnet" automatically.  I am obviously not doing something right here.  Also, when I try to telnet to the machine by using Putty, it won't connect.

Offline

 

#45 2007-05-18 02:04:18

mykroft
Member
Registered: 2007-05-12
Posts: 83

Re: Updated fun_plug

WildSioux wrote:

fonz wrote:

WildSioux wrote:

Can I just copy the files using windows explorer?

Hm... have you actually read the README.txt file? It says "Unpack funplug-0.2.tar.gz" (e.g. WinZip). It contains "fun_plug" and "fun_plug.tar". These are the two files that you have to copy to your device. Windows explorer should work.

Yes, I unpacked the "funplug-0.2.tar.gz" file.  I then tried to copy the "fun_plug" and "fun_plug.tar" files by using the ftp client but it won't do it.  I can copy them by using the windows explorer just fine.  But I noticed you said to "ftp" them which is why I downloaded the ftp client.

Since I can copy using explorer, after copying do I just restart the box then?  Thanks

Yes you can use explorer to copy them over, but you need a ftp program to make the fun_plug file executable so te dns box can run it upon boot up.

I use flashfxp mself.... 

thinking more about it - go ahead and just try explorer, i think the box applies a umask for file permissions and might possibility set them to 755 or 777 I am not sure tho cause I am at work at the moment....

Last edited by mykroft (2007-05-18 02:15:36)

Offline

 

#46 2007-05-18 03:41:29

WildSioux
Member
Registered: 2007-03-05
Posts: 71

Re: Updated fun_plug

mykroft wrote:

Yes you can use explorer to copy them over, but you need a ftp program to make the fun_plug file executable so te dns box can run it upon boot up.

I use flashfxp mself.... 

thinking more about it - go ahead and just try explorer, i think the box applies a umask for file permissions and might possibility set them to 755 or 777 I am not sure tho cause I am at work at the moment....

Ah ha, I see now.  I am at work now so I haven't tried it to verify.  But I was looking at the little "how to" guide of the Smart FTP program I downloaded.  And it has a little tutorial of doing things.  I noticed one that was "CHMOD."  This is where you change the read/write/execute properties of the file.  Yes, I did get the SmartFTP program to connect to the box and I can copy using that now (had to change the setting in the D-Link FTP Server to "Read and Write" permissions.

Now to my next question, I know I am supposed to set the checkbox to "Execute" on the "fun_plug" file.  But what about the "fun_plug.tar" directory/files?

I am learning and will get this up and running tomorrow!

Offline

 

#47 2007-05-18 08:34:54

mykroft
Member
Registered: 2007-05-12
Posts: 83

Re: Updated fun_plug

WildSioux wrote:

mykroft wrote:

Yes you can use explorer to copy them over, but you need a ftp program to make the fun_plug file executable so te dns box can run it upon boot up.

I use flashfxp mself.... 

thinking more about it - go ahead and just try explorer, i think the box applies a umask for file permissions and might possibility set them to 755 or 777 I am not sure tho cause I am at work at the moment....

Ah ha, I see now.  I am at work now so I haven't tried it to verify.  But I was looking at the little "how to" guide of the Smart FTP program I downloaded.  And it has a little tutorial of doing things.  I noticed one that was "CHMOD."  This is where you change the read/write/execute properties of the file.  Yes, I did get the SmartFTP program to connect to the box and I can copy using that now (had to change the setting in the D-Link FTP Server to "Read and Write" permissions.

Now to my next question, I know I am supposed to set the checkbox to "Execute" on the "fun_plug" file.  But what about the "fun_plug.tar" directory/files?

I am learning and will get this up and running tomorrow!

All you need is execute on the fun_plug file, the other is just a archive file that the fun_plug file will untar, so once you have execute on the fun_plug file, reboot - the fun_plug file will see there is a fun_plug.tar file there to process it, it will extract it out and then delete the source file and then should be able to telnet to the DNS box.  It does not ask for a username/pass so DO NOT map this thru your router to telnet from the outside in.  If you want to do something like that you will need something along the lines of SSH etc.

Hope this helps
Myk

Offline

 

#48 2007-05-18 10:18:57

mykroft
Member
Registered: 2007-05-12
Posts: 83

Re: Updated fun_plug

actually i did some digging to find out what some of the other utils were that come in this fun_plug archive.....

dropbear is a ssh server - so there ya go smile

turning off telnet now - since the ssh server asks for a login/pass smile

Myk

Offline

 

#49 2007-05-18 14:43:35

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Updated fun_plug

WildSioux wrote:

Also, when I try to telnet to the machine by using Putty, it won't connect.

putty is an SSH client. afaik, you have to explicitly select telnet mode. if you're using windows, select "start/run", run "cmd", then type "telnet <ip>".

Offline

 

#50 2007-05-18 19:18:45

WildSioux
Member
Registered: 2007-03-05
Posts: 71

Re: Updated fun_plug

I have managed to save the 2 files mentioned above to my DNS323.  Rebooted it, and can telnet into it now by using Putty.

This is the message I get when trying to run the lighttpd script.

/ # sh /mnt/HD_a2/fun_plug.d/start/lighttpd.sh
Starting lighttpd...
2007-05-18 10:09:36: (configfile.c.879) opening configfile  /mnt/HD_a2/fun_plug.d/etc/lighttpd.conf failed: No such file or directory

I tried making a file "lighttpd.conf" with a unix text editor with this code as per the lighttpd.conf-sample file.

Code:

#
# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $
#
server.modules              = (
                                "mod_access",
#### accesslog module
accesslog.filename          = "/mnt/HD_a2/www/logs/access.log"

But I can't save it to the .../etc/ folder.  Whenever I try it says access denied.  Any ideas?  I am surprised I have made it this far.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB