Is there a secure way of editing files on FreeBSD from a Windows environment that isn't via SMB? reddit / freebsd ---------------------------------------------------------------------- gallopsdidnothingwrg · 2020-10-22 21:09 Sorry - I'm new to FreeBSD... I'm using FreeBSD 12.0 on TrueNAS to edit some sensitive files through SMB. My issue is that SMB exposes all the files to my entire Windows OS. I'd prefer to have a more secure way of editing these files in case my windows machine is infected. I edit the files (markdown .md files) graphically with a lot of pasted hyperlinks and images, etc... so I'd like a graphical desktop interface I can copy/paste stuff from my main Windows environment (ie over the network). I'm not familiar enough with FreeBSD to know what the Desktop softwares are capable of to know if what I'm asking for is even possible. ---------------------------------------------------------------------- VanaTallinn · 2020-10-22 21:19 You can probably find a web app to do that. That lets you manage fine access rights and rich-edit the files in your browser over HTTPS. ---------------------------------------------------------------------- dddddavidddd · 2020-10-22 21:28 I'm not specifically familiar with FreeNAS, but on a generic FreeBSD box I would maybe install a GUI and a VNC/Remote Desktop server (listening on localhost), and connect to it with SSH tunneling. That would fulfill your need for a graphical editor, without leaving traces of files on your Windows machine. You could also just connect when booted from a non-persistent live CD like Tails. ---------------------------------------------------------------------- Max-Normal-88 · 2020-10-22 21:52 For just editing markdown files I would probably go the easy route: SSH into the machine and use VIM or nano to edit them. No CLI but, I mean, it’s plaintext ---------------------------------------------------------------------- [deleted] · 2020-10-22 22:06 [removed] ---------------------------------------------------------------------- michael_hmich · 2020-10-22 22:22 you just need to enable the ssd daemon on the freebsd machine and access it from anywhere with a ssh client for windows, there are some good ones free, just try which you like most sshd_enable=YES in rc.conf ---------------------------------------------------------------------- gumnos · 2020-10-22 23:41 What's the threat from the Windows machine? That the files will be corrupted/encrypted? If your major concern is data integrity and SMB works for you otherwise, you can set up a `cron` job to make ZFS snapshots on regular intervals so if something tries to destroy your files, you can restore from a recent snapshot. You don't have to share out all your data, and can limit the sharing to a single subdirectory. Or are you concerned that they'll be exfiltrated? In which case you'd want to remote into the FreeBSD machine (remote X, VNC, rdesktop, etc for GUIs, or SSH) and use an editor directly on the machine such as vi/vim/ed/ee/emacs/joe/etc within a command-line/SSH session or your favorite GUI editor (Kate, Gedit, etc). While it doesn't completely remove the possibility of exfiltration, it significantly raises the bar. More options: - install an NFS client on your Windows machine, but I'm not keen on this option - copy the files locally (via `scp`, `sftp`, `ssh` or whatever), edit them locally (largely only exposing that one file as it's being edited) and push it back - use a `ssh`-aware editor on Windows such as [`vim` which can edit remote file urls](https://vim.fandom.com/wiki/Editing_remote_files_via_scp_in_vim) - set up a web-server with [WebDAV](https://en.wikipedia.org/wiki/Webdav) and have more controlled access to the files - set up a version control repo (e.g. `git`, `fossil`, `svn`, `hg` or whatever) on the FreeBSD box and check it out locally. Push/pull your Markdown files from that. If the local copy gets hosed, you still have them on the FreeBSD box (and possibly mirrored to other possibly- private repos) But without knowing your threat-model from your Windows machine, it's hard to give specifics. ---------------------------------------------------------------------- gallopsdidnothingwrg · 2020-10-23 00:01 Well... the nice thing about some markdown editors is that they also nicely render the markdown, which really really cleans up the experience and allows for pasting of images. Ideally, I'd still like to preserve that. Someone below mentioned using an editor that can use SFTP, so I'm actually currently researching if there are any markdown editors capable of that, or if any editors that do support SFTP have markdown plugins... will update UPDATE: So one thing I just realized, is that I can use WinSCP to connect, and then open+edit files in any Windows program I want. Meaning, I can edit in Typora (my current preferred editor) and it seems to edit/save changes seamlessly. Unless I'm missing something, this seems a lot more secure than connecting an SMB share. Sweet. ---------------------------------------------------------------------- gallopsdidnothingwrg · 2020-10-23 00:08 This led me down a couple google searches that made me realize that I can connect with WinSCP via SFTP and then use open/edit/save with any Windows program I want... ---------------------------------------------------------------------- Max-Normal-88 · 2020-10-23 00:08 Actually you always can use FileZilla to copy the files locally, work on them with your favorite editor, and then send them back to the server, using SFTP as protocol ---------------------------------------------------------------------- gallopsdidnothingwrg · 2020-10-23 00:09 This comment made me think of WinSCP, which looks like it'll allow me to open/edit/save with any Windows program I want. This is awesome because now I can use Typora without creating an SMB share. ---------------------------------------------------------------------- gallopsdidnothingwrg · 2020-10-23 00:11 Both are concerns. I am setting up automated snapshots on the dataset for backup. Yours and other comments made me realize I can use WinSCP over SFTP to connect and then open/edit/save with any native Windows program I want. Which means I can keep using Typora - NICE! ---------------------------------------------------------------------- gallopsdidnothingwrg · 2020-10-23 00:12 yep... seems like WinSCP SFTP lets me open/edit/save without even needing to transfer - it obfuscates all that for me. Nice! ---------------------------------------------------------------------- Holy_Pee_Shooter_PvZ · 2020-10-23 01:06 Jupyter notebook FTW ---------------------------------------------------------------------- dddddavidddd · 2020-10-23 01:13 FYI it probably does this by temporarily transferring the file. ---------------------------------------------------------------------- gallopsdidnothingwrg · 2020-10-23 01:21 Probably - but at least that significantly limits the scope of the security vulnerability since it's only the files that are open and not all of them ---------------------------------------------------------------------- michael_hmich · 2020-10-23 16:54 it seems you have not very much linux/unix experience, why you try to work with it then? use a windows server instead ---------------------------------------------------------------------- gallopsdidnothingwrg · 2020-10-23 16:59 This is a funny comment to see in /r/freebsd :) ---------------------------------------------------------------------- michael_hmich · 2020-10-23 17:23 you think so? me not, to start to work with it you should build your workstation first and learn the basics or at least have proved knowledge about server client communication, this I would call minimal requirements, but as it looks you are on blind flight ---------------------------------------------------------------------- gallopsdidnothingwrg · 2020-10-23 17:47 no thank you ---------------------------------------------------------------------- edthesmokebeard · 2020-10-24 01:28 This is the unixly correct answer. ---------------------------------------------------------------------- flatland_spider · 2020-10-27 22:03 Setup up something like NextCloud or Syncthing which will create revisions of changed documents when they sync. ---------------------------------------------------------------------- flatland_spider · 2020-10-27 22:06 > set up a version control repo This is pretty much what I would do. Setting up a bare git repo is pretty painless. Adding a hook to snapshot the FS before a commit is something that could happen as well.