News:

RAID is not a replacement for a backup! Here's why.

Main Menu

nas_configgen edits on NAS T3xxx

Started by MWCSystems, August 20, 2021, 09:54:21 AM

Previous topic - Next topic

MWCSystems

Buffalo Terastation T3410RN
Ubuntu 14.04.1: Linaro 4.8.4

Maybe this is not the preferred method to do what I want to do. My goal is to make edits to /etc/samba/smb.conf and stop those edits from being overwritten. I tried using chattr +i, but that crashed the smbd.sh when it tried to overwrite the config. I could comment out the line that runs nas_configgen, but I am not sure what else it does, so I would rather not do that.

Using Ghidra, I decompiled the nas_configgen binary and found the fwrite function that writes the line I want to edit. I used a hex editor to make the changes to the string and copied the modified nas_configgen onto the NAS.

The hard coded string:
Quotefwrite("    veto files = /.AppleDesktop/Network Trash Folder/TheVolumeSettingsFolder/.AppleDouble/.AppleDB/.com.apple.timemachine.supported/\n"
           ,1,0x85,pFVar5)

I want the string to be:
Quoteveto files = /Untitled*/.AppleDesktop/Network Trash Folder/TheVolumeSettingsFolder/.AppleDouble/.AppleDB/.com.apple.timemachine.supported/\n"
           ,1,0x85,pFVar5)

After making, saving the changes, and copying the file to the NAS, when I restart smbd the script loads the modified nas_configgen but crashes. I assume the 0x85(133) flag is the length of characters in the string. So I need that flag to be 0x8f, but I cannot find where or how to change that. Any thoughts?

The goal is to prevent users from being able to save files with the name Untitled at the beginning.

1000001101000

That looks fun!

I'd probably add a sed command to smbd.sh that makes the desired change before starting samba. Basically make your changes after buffalo makes theirs rather than trying to prevent their changes.


MWCSystems

Quote from: 1000001101000 on August 20, 2021, 11:34:56 AM
That looks fun!

I'd probably add a sed command to smbd.sh that makes the desired change before starting samba. Basically make your changes after buffalo makes theirs rather than trying to prevent their changes.

The problem with that is that I have to reload smbd for the changes to take effect, which runs nas_configgen, thus overwriting anything. So, it's possible that I could have a 2nd smbd.sh that has nas_configgen commented out, but not knowing fully what nas_configgen does worries me on this idea.

MWCSystems

Update: I did copy the smb.sh and commented out the line with nas_configgen. It reloaded and saved my changes, so that's good, but not the ideal method. This will have to ran upon restarts, updates, and any time the service is interrupted.

Browser ID: smf (is_webkit)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 5: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default), StopForumSpam.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 199 (show)
Files included: 35 - 1354KB. (show)
Memory used: 982KB.
Tokens: post-login.
Queries used: 19.

[Show Queries]