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

#1 2007-04-13 23:21:06

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

Updated fun_plug

Hi,

I updated my fun_plug (www.inreto.de/dns323/fun-plug). The interesting changes are:
- updated busybox to 1.5.0
- added dropbear SSH
- added lighttpd HTTP server
- added rsync
(portmap and unfs3 versions are still up-to-date)

The binaries in this fun-plug are dynamically linked. My earlier fun-plugs were all static binaries. I used the toolchain from the 1.02 release, and hope the dynamic linking won't cause problems on 1.03. Sample config files for lighttpd, rsyncd and inetd are included. I also made some small changes to dropbear that allow use of the busybox 1.5 shell _without_ tinkering with /etc/passwd and /etc/shells.

Have fun.

Last edited by fonz (2007-04-14 01:20:55)

Offline

 

#2 2007-04-14 05:06:09

someguy
Member
Registered: 2007-01-17
Posts: 47

Re: Updated fun_plug

fonz, this is great so far, and I'm using firmware v1.03. I haven't tested much: I've started messing around with it - one thing I've noticed - ps no longer seems to have the -w option, and output >80 chars wide seems truncated for me/inaccessible.. don't know if this is a function of busybox or of the shell. cool work, thanks!

-- updated:
passwd in your update does not work for me:

I can do this:

Code:

 # passwd root
Changing password for root
New password:
Retype password:
Password for root changed by root

but a cat on the passwd file and on the shadow file shows no password update.

I've now reverted to your 2007.04.06, and passwd works fine again (w/ fw 1.03).

Last edited by someguy (2007-04-14 06:50:40)

Offline

 

#3 2007-04-14 14:15:24

catohagen
Member
Registered: 2007-02-22
Posts: 22

Re: Updated fun_plug

great work smile just updated to 1.03 and installed this

I used your webrc control panel alot, is it possible to implement this into your funplug ?

catohagen

Offline

 

#4 2007-04-14 16:21:03

woody
Member
Registered: 2007-03-05
Posts: 31

Re: Updated fun_plug

fonz, thanks for the great work.  I'm trying to rsync from linux box to dns323.  I enabled rsync and inetd on dns323 and issued this from fileserver

Code:

rsync -avn --exclude "lost+found" /mnt/userdata/woody/ testuser@dns323_1:vol1/userdata/woody
ssh: connect to host dns323_1 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(359)

why is it trying to connect on port 22?  Shouldn't it be 873?  Do I need to add something to /etc/services?

Thanks
Woody

Last edited by woody (2007-04-14 16:21:57)

Offline

 

#5 2007-04-14 17:11:34

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

Re: Updated fun_plug

someguy wrote:

passwd in your update does not work for me:

Code:

 # passwd root

but a cat on the passwd file and on the shadow file shows no password update.

I just tried this myself and it looks like I can change passwords for all users except root. root is different here in that root doesn't have a shadow entry, and it seems passwd won't add it to shadow. It's strange that you say it works with busybox 1.4.1.

Another difference seems to be the encryption of the passwords. It seems the shipped passwd (1.02) creates crypt'ed entries, whereas busybox 1.5 creates md5.

Offline

 

#6 2007-04-14 17:24:25

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

Re: Updated fun_plug

woody wrote:

Code:

rsync -avn --exclude "lost+found" /mnt/userdata/woody/ testuser@dns323_1:vol1/userdata/woody

ssh: connect to host dns323_1 port 22: Connection refused
why is it trying to connect on port 22?  Shouldn't it be 873?

I guess, you need two ":" between "dns323_1" and "vol1" , i.e.:

Code:

rsync -avn --exclude "lost+found" /mnt/userdata/woody/ testuser@dns323_1::vol1/userdata/woody

From the rsync man page (http://rsync.samba.org/ftp/rsync/rsync.html):

There  are  two  different ways for rsync to contact a remote system: using a remote-shell program as the transport (such as ssh or rsh) or contacting an rsync daemon directly via TCP.  The remote-
       shell transport is used whenever the source or destination path contains a single colon (:) separator after a host specification.  Contacting an rsync daemon directly happens  when  the  source  or
       destination  path  contains  a double colon (::) separator after a host specification, OR when an rsync:// URL is specified (see also the "USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION"
       section for an exception to this latter rule).

Offline

 

#7 2007-04-14 19:12:15

woody
Member
Registered: 2007-03-05
Posts: 31

Re: Updated fun_plug

thanks, I noticed some examples using ":" and some using "::" but none spelled out the significance.  I tried it again but get permission errors:

Code:

 rsync -av --exclude "lost+found" /mnt/userdata/woody/test/ test@192.168.1.154::vol1/userdata/woody/test
building file list ... done
rsync: failed to set times on "/userdata/woody/test/." (in vol1): Operation not permitted (1)
test.txt
rsync: mkstemp "/userdata/woody/test/.test.txt.142PZO" (in vol1) failed: Permission denied (13)
rsync: failed to set times on "/userdata/woody/test/." (in vol1): Operation not permitted (1)

It doesn't seem to matter if I run as normal user or sudo on client.  Tried both root and normals user in rsync command.

rsyncd.conf looks like

Code:

uid = nobody
gid = users
strict modes = false

[vol1]
    path = /mnt/HD_a2
    read only = no

[vol2]
    path = /mnt/HD_b2

What am I missing?

Thanks
woody

Offline

 

#8 2007-04-14 20:30:35

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

Re: Updated fun_plug

woody wrote:

Code:

uid = nobody
gid = users
strict modes = false

What am I missing?

Either the destination directory on your DNS must be writeable by nobody (which is usually not the case), or it must be group-writeable for group users (which is usually also not the case). The normal Linux rights managment rules apply here.

rsync has als its own user database. I'm not an rsync expert, but you could try the following:
- change uid, gid in rsyncd.conf to root and root.
- add a "secrets file" option with value /mnt/HD_a2/fun_plug.d/etc/rsyncd.secrets (see http://rsync.samba.org/ftp/rsync/rsyncd.conf.html)
- add "auth users = *" or "auth users = test" option (to make rsync use the secrets file)
- create the secrets file and add "test:password" to it

Note that rsync user need not necessarily be linux users. Don't forget to restart the rsync server (killall rsync; sh /mnt/..../start/rsyncd.sh)

Offline

 

#9 2007-04-14 21:56:40

woody
Member
Registered: 2007-03-05
Posts: 31

Re: Updated fun_plug

fonz, thanks again.  I changed uid and gid to root and that fixed the permission problem, but now I'm getting a new problem for large files that already exist on destination (dns323), for instance my Outlook pst (1 gb)

Code:

WARNING: offline.pst failed verification -- update discarded (will try again).

when I tried my mp3 I got quite a few errors like (<.1%):

Code:

ERROR: Eric Clapton/Journeyman/12-Before You Accuse Me.mp3 failed verification -- update discarded.

I upgraded rsync on my linux box 2.6.9 so it would match dns323, but that didn't help.

Has anyone gotten this to work on dns323?

Thanks
woody

Offline

 

#10 2007-04-14 22:57:44

woody
Member
Registered: 2007-03-05
Posts: 31

Re: Updated fun_plug

Until I can get rsyncd working, I thought I'd try NFS.

I put this in /mnt/HD_a2/fun_plug.d/etc/exports:

Code:

/mnt/HD_a2/userdata *(rw,sync,no_root_squash)
/mnt/HD_a2/mp3 *(rw,sync,no_root_squash)
/mnt/HD_a2/backup *(rw,sync,no_root_squash)
/mnt/HD_a2/ogg *(rw,sync,no_root_squash)

and started unfsd

Code:

/ # sh /mnt/HD_a2/fun_plug.d/start/unfsd.sh
Starting portmap...
Starting unfsd...

tried to mount

Code:

 sudo mount -t nfs 192.168.1.154:/mnt/HD_a2/userdata /mnt/dns323_userdata/
Password:
mount: 192.168.1.154:/mnt/HD_a2/userdata failed, reason given by server: Permission denied

Offline

 

#11 2007-04-14 23:20:53

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

Re: Updated fun_plug

woody wrote:

Code:

/mnt/HD_a2/userdata *(rw,sync,no_root_squash)
/mnt/HD_a2/mp3 *(rw,sync,no_root_squash)
/mnt/HD_a2/backup *(rw,sync,no_root_squash)
/mnt/HD_a2/ogg *(rw,sync,no_root_squash)

"*" is not a valid client specification (at least not for unfs3). Change it to "192.168.0.0/16". I'm using unfs3 for quite some time now on my 323 and whenever it stopped working, it was because I got the config wrong.

BTW: start/unfsd.sh will create a default exports file if it is missing. You should try this one before creating your own (just remove your exports, killall unfsd and restart). It will export /mnt/HD_a2 and /mnt/HD_b2 (this will again fail, if you don't have a second volume - unfs3 won't start if one of the exports doesn't exist...).

Concerning your rsync problem, I did a few tests myself. I changed the config like you did (root/root plus secrets file). I transferred several GB, and repeated that (so that files already exist) - no such errors, all went fine. I ran rsync with -c (to do thorough checksumming) and without. Searching for the error message, I found this: http://lists.samba.org/archive/rsync/20 … 14176.html

Offline

 

#12 2007-04-14 23:39:47

woody
Member
Registered: 2007-03-05
Posts: 31

Re: Updated fun_plug

I removed my exports and restarted nfsd.  It made this exports file

Code:

/ 192.168.1.0/24(rw,no_root_squash)
/mnt/HD_a2 192.168.1.0/24(rw,no_root_squash)
/mnt/HD_b2 192.168.1.0/24(rw,no_root_squash)

I'm not sure what the "/24" means.  I want to export to at least 192.168.1.153 or better yet my whole network 192.168.1

How do I do that?

Thanks
woody

Offline

 

#13 2007-04-14 23:50:25

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

Re: Updated fun_plug

woody wrote:

Code:

/ 192.168.1.0/24(rw,no_root_squash)
/mnt/HD_a2 192.168.1.0/24(rw,no_root_squash)
/mnt/HD_b2 192.168.1.0/24(rw,no_root_squash)

I'm not sure what the "/24" means.  I want to export to at least 192.168.1.153 or better yet my whole network 192.168.1

Remember that an IP address has 32 bits, i.e. 4 bytes.
/24 tells unfs how many bits of the IP address must match - 24 bits or the first three bytes in this case.

Examples:

Exporting to 192.168.1.153/32 will export to the host 192.168.1.153 only (all 32 bits must match).
Exporting to 192.168.1.0/24 will export to all hosts on the network 192.168.1.x.
Exporting to 192.168.0.0/16 will export to hosts on the network 192.168.x.y.

Offline

 

#14 2007-04-15 04:01:10

woody
Member
Registered: 2007-03-05
Posts: 31

Re: Updated fun_plug

Thanks for the background.  Tried to mount again from server, and when I rsync I get:

Code:

$ /usr/local/bin/rsync -av --exclude "lost+found" /mnt/userdata/woody/settings/outlook/ /mnt/dns323_userdata/woody/settings/outlook
building file list ... done
offline.pst
rsync: mkstemp "/mnt/dns323_userdata/woody/settings/outlook/.offline.pst.BIQupK" failed: Permission denied (13)

sent 1172403339 bytes  received 42 bytes  21511988.64 bytes/sec
total size is 4851857711  speedup is 4.14
rsync error: some files could not be transferred (code 23) at main.c(977) [sender=2.6.9]

I tried deleting a file on dns323 from server and got permission denied.  It seems like it's mounted rw:

Code:

$mount
192.168.1.154:/mnt/HD_a2/userdata on /mnt/dns323_userdata type nfs (rw,addr=192.168.1.154)

I thought it might be the permissions on themount point.  It was root:root and 755, so I changed it to 777 and tried rsync again.  Same problem.  I can't even delete an existing file on dns323 over nfs.

What a pain!

Offline

 

#15 2007-04-15 14:17:05

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

Re: Updated fun_plug

woody, basic knowledge about how Linux and NFS work is  necessary to get things running.
1. if you have permission problems, try stuff as root first
2. read the nfs howto at http://nfs.sourceforge.net/nfs-howto/, especially section 7.4
3. to access files as user, you should add this to your client's fstab:
  192.168.1.154:/mnt/HD_a2  /mnt/dns323_userdata      nfs  defaults,noauto,user,exec,rw,rsize=16384,wsize=16384  0  0
then mount as user, and make sure, uids match on 323 and nfs client and permissions are correctly set on the 323.
If you have problems understanding the permission thing, read the linux introduction at www.tldp.org:
http://www.tldp.org/LDP/intro-linux/htm … 03_04.html

Last edited by fonz (2007-04-15 14:35:19)

Offline

 

#16 2007-04-16 13:31:43

woody
Member
Registered: 2007-03-05
Posts: 31

Re: Updated fun_plug

The uid don't match.  Can I just change them in passwd and smbpasswd on dns323? Will my changes survive a reboot?

thanks
woody

Last edited by woody (2007-04-16 13:42:43)

Offline

 

#17 2007-04-16 14:19:06

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

Re: Updated fun_plug

woody wrote:

The uid don't match.  Can I just change them in passwd and smbpasswd on dns323? Will my changes survive a reboot?

Yes, I had to do this, too. The 323 added new users starting with uid 500, but my host started at 1000.  I manually edited the /etc/passwd file on the 323 to make my UID 1000 (also changed my home directory):
tp:x:1000:502:users:/mnt/HD_a2/home/tp:/bin/sh

However, BE VERY CAREFUL not to fuck up the passwd file. I don't know what happens then.
Also remeber, that after you changed your UID, file permissions still use the old UID - you have to (as root) chown all the files (e.g. chown -R tp.users), too.

Alternatively, you can change your UID on the NFS client. Same procedure.

Not sure about smbpasswd. Maybe invoking "smbpasswd user" will update the UID, so you don't need to do this manually.

Last edited by fonz (2007-04-16 14:19:39)

Offline

 

#18 2007-04-24 09:23:20

strav
New member
Registered: 2007-04-24
Posts: 2

Re: Updated fun_plug

I've been trying to connect to fonz's site for a couple of days now with no success.  Am I the only one having issues with this? 

Does anyone have a copy of his latest fun_plug setup that they can throw up on rapidshare (or whatever)?

Thanks!

Offline

 

#19 2007-04-24 09:33:06

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

Re: Updated fun_plug

strav wrote:

I've been trying to connect to fonz's site for a couple of days now with no success.  Am I the only one having issues with this?

No, you're not. The server's down, and I dont know when that f**ing hoster solves the problem.

Offline

 

#20 2007-04-24 11:39:39

strav
New member
Registered: 2007-04-24
Posts: 2

Re: Updated fun_plug

Ah - ok.  I'll just keep checking in then....

Offline

 

#21 2007-04-25 22:17:11

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

Re: Updated fun_plug

fonz wrote:

The server's down.

Problem solved, should work as usual.

Offline

 

#22 2007-04-26 09:54:46

Ethereal_Dragon
Member
From: USA
Registered: 2007-02-05
Posts: 55

Re: Updated fun_plug

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


Gaming Rig: ASUS Z87-PRO (V EDITION), Intel Core i5-4590 Haswell, HyperX FURY 8GB DDR3 1866,
XFX Radeon HD 4870, SILVERSTONE DA700, Samsung 840 500Gig SSD MZ-7TD500BW, 3x WD20EARS 2 TB Green,
ASUS DRW-2014L1T (DVD), LG WH14NS40 (Blu Ray), Dell 2709W, Sony SDM-HS95P, Windows 10 Pro
The NAS Box: D-Link DNS-323, 0.1RC3 Alt-F firmware, 2x 7200.14 ST3000DM001 3TB EXT4 - NO RAID - 6 TB

Offline

 

#23 2007-04-26 10:50:09

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

Re: Updated fun_plug

Ethereal_Dragon wrote:

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'.

Ok, here's a quick howto:

- lighttpd config file is "lighttpd.conf" in fun_plug.d/etc/. There's an example config file "lighttpd.conf-sample". Rename it, remove the "-sample" part. Open it and see what's in there (Use a UNIX-line-break-capable editor if you make changes).
- Documentation is here: http://trac.lighttpd.net/trac/wiki/Docs

- The sample config contains:
   server.document-root        = "/mnt/HD_a2/www/pages/"
  This is the directory where web pages go. If that directory does not exist, create it (also create /mnt/HD_a2/www/logs/ then).
  Copy a web page to that directory.

- Start lighttpd: "sh /mnt/HD_a2/fun_plug.d/start/lighttpd.sh"
  If all is fine, it will accept connections on port 8080 ("server.port" option).

Offline

 

#24 2007-04-26 11:51:29

Ethereal_Dragon
Member
From: USA
Registered: 2007-02-05
Posts: 55

Re: Updated fun_plug

Fonz, I can't thank you enough!!! I got the webserver working... I am understanding the linux commands ALOT better now.... is this lighttpd server pretty secure, or is there anything I need to worry about??


Gaming Rig: ASUS Z87-PRO (V EDITION), Intel Core i5-4590 Haswell, HyperX FURY 8GB DDR3 1866,
XFX Radeon HD 4870, SILVERSTONE DA700, Samsung 840 500Gig SSD MZ-7TD500BW, 3x WD20EARS 2 TB Green,
ASUS DRW-2014L1T (DVD), LG WH14NS40 (Blu Ray), Dell 2709W, Sony SDM-HS95P, Windows 10 Pro
The NAS Box: D-Link DNS-323, 0.1RC3 Alt-F firmware, 2x 7200.14 ST3000DM001 3TB EXT4 - NO RAID - 6 TB

Offline

 

#25 2007-04-26 15:22:56

haihai
Member
Registered: 2007-04-24
Posts: 6

Re: Updated fun_plug

Lighttpd has php support?

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB