-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mod_vroot.c - vroot_cmd_fixup_path breaking Directory Limit permissions #41
Comments
If I'm understanding this correctly, you had a working One way of handling this issue might be add a |
Sorry I believe the issue got closed accidentally when I tried to comment. I could have interpreted this incorrect but I thought bug #23 should have more to do with log decoration than functionality. That the complaint was about dst-path not being logged and prior only vroot path was? Again my issue appears to be more functionality with applying permissions to the VRoot path, that some how fixing log decoration broke VRoot path permissions. I assume that if we’re in the VRoot then we should be dealing with permissions of the VRoot path, so when fixup alters it to the real dst-path it seems to be invalid to attempt applying permissions if they’re not in the same context. Likely this new bug I exposed because of my more complicated file system structure. VRootOption would work but I don't think it is the best approach because I think my fix was just a hack to make it work by skipping code. Since I’m not an expert on this or know the extent of how the PRE handlers call all the way into dirtree.c, for example, I would leave it up to you for the best fix. It seems like you put in good work to improve the SFTP/SCP functionality when the #23 bug fix went in, you comment about it around line 721, and I wouldn’t suggest by-passing more robust functionality. #23 is odd in my opinion. Logging from a clients POV seems to makes sense and now it's shifted to be dst-path. Unless you're a client of the system you really don't know what their VRoot path is if you alter the log to real path. I'm not sure a majority of people needed real path, or cared and I don't really know what's better. Different needs for different implementations. Maybe one suggestion would be VRootPathLogging bool which when "On" keeps path logging as the Vroot path only for logging purposes? This way a default "Off" doesn't undo the current behavior people might already be using. Someone like me who doesn't care could just set it to "On" so my log history doesn't get have a format change. I apologize because revisiting #23 seems like a lengthy way to go, again your call. Either way I appreciate your efforts and this software. |
@techerati No apologies needed; I really appreciate your feedback on this! I suspect that there will indeed be different needs, with regard to What would help me is to understand more about your particular file system structure/approach. Feel free to contact me directly via email, if you'd rather than discuss all of that in this GitHub ticket. That way, knowing how your structure is set up, I can then reproduce that structure locally, and use it in my development/testing and handling of this. Thanks! |
I think I'm getting bitten by this issue as well. I had set a <Directory /data/ftp> section to allow overwrites as that's the root of where my (S)FTP users live. The allowoverwrite works perfectly for mod_sftp connections, however it does not work for FTP connections. I found that I had to create a section for my FTP service to allow file overwrites. Here's the tracelog with only the first Directory section for /data/ftp:
Given that all my FTP connections are already DefaultRoot'ed, I'm not worried about giving '/' overwrite permission, as I can make it only apply to the FTP service and not SFTP, which is a sufficient mitigation for me. But hopefully this at least provides more data on the issue and possibly how to resolve it. |
I recently had to upgrade both a 1.3.5 and a 1.3.6 proftpd to the most recent 1.3.8. The file system in use has to carry forward a directory structure layout to maintain a legacy standard. Aliases are in use to map the chroot env to the real paths and directory limits are in place to control inadvertent destruction of that structure, protecting the user environment. We haven't had a problem with previous versions but in this transition, while using 0.9.11 mod_vroot the directory directive limits are broken. This system only runs in SFTP mode.
There is also an alias duplication bug which I will report separately.
I've tested with other mod_vroot versions and bug #23 appears to be responsible for the issue. On previous versions of mod_vroot, it appears in the trace log that both alias path (or vpath depending on how you want to name it) and real path were both iterated over to test for limits. Virtual path would match and the limits for that would be honored. With the introduction of vroot_cmd_fixup_path, now it appears that only "real path" is returned, ie, the target, and if you have a <Directory /*> directive then all of the users tree will end up matching, in this case it's a deny so the user(s) cannot write at all. According to the configuration documentation, you should be able to include and exclude subdirs by using this method of / and /* wildcarding but as mentioned it seems now that /* is being 100% greedy.
Trace log of issue, repetitive noise truncated:
Here's the configuration I needed to use for my testing. I've placed a start/end comment where the directory limits can be toggled on and off, for convenience.
Although bug #23 was an issue, we have lived with that issue without much harm. So I tested this fix, without log concerns, and it resolved our issue but it's just a hack from my perspective, which is why I wanted to report the problem.
After the patch, this is the trace log with noise truncated again and a successful WRITE file transfer.
The text was updated successfully, but these errors were encountered: