From: "Max R. Carrara" <m.carrara@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 pve-storage-plugin-examples 0/2] SSHFS Example Storage Plugin
Date: Fri, 4 Jul 2025 18:20:09 +0200 [thread overview]
Message-ID: <20250704162011.402195-1-m.carrara@proxmox.com> (raw)
SSHFS Example Storage Plugin - v2
=================================
Add a custom storage plugin based on SSHFS [0] to serve as an example
for an upcoming storage plugin development guide. This plugin should
also be ready for production usage, though it would be nice to get some
more testing (and potentially performance-tuning) done.
Previous version: https://lore.proxmox.com/pve-devel/20250416124735.320256-1-m.carrara@proxmox.com/
Notable Changes
---------------
- incorporated feedback on v1 (thanks Thomas!)
- private key is now passed by value instead of by path in order to
avoid TOCTOU races
- this still isn't perfectly ideal, but better than before
- use a separate known_hosts file for each SSHFS storage instead of
/etc/pve/priv/known_hosts
- this means that /etc/pve/priv/storage/${STOREID}_known_hosts is
now used
- allow overwriting an existing key file that wasn't cleaned up in
/etc/pve/priv/storage/ when creating an SSHFS storage
- Use the StrictHostKeyChecking=accept-new SSH option to trust the
remote on first use if connecting to it via pubkey auth succeeds
- minor code cleanup & readability improvements here and there
- format via perltidy w/ our custom profile
How to Use & Test
-----------------
(updated because of changes to parameters)
You'll need some kind guest you can SSH into with pubkey auth.
On that host, it's best to create some directory for SSHFS, e.g.:
mkdir -p /srv/sshfs && chmod 750 /srv/sshfs
The plugin can easily be built via `make deb` inside
`plugin-sshfs/`. Once built and installed on a different PVE host
of your choice, you should first deploy a private key for SSHFS, e.g.:
ssh-copy-id -i ~/.ssh/id_my_private_key [USER]@[HOST]
Then, using the deployed key, the storage can be added as follows:
pvesm add sshfs [STOREID] \
--username [USER] \
--server [HOST] \
--path /mnt/path/to/storage \
--remote-path /srv/sshfs \
--sshfs-private-key "$(cat ~/.ssh/id_my_private_key)"
The storage should then pop up in the UI. It should be functionally
equivalent to most other dir-based network storages, except that imports
aren't supported in order to keep the example from becoming too complex.
References
----------
[0]: https://github.com/libfuse/sshfs
Older Versions
--------------
v1: https://lore.proxmox.com/pve-devel/20250416124735.320256-1-m.carrara@proxmox.com/
rfc-v1: https://lore.proxmox.com/pve-devel/20250328171209.503132-1-m.carrara@proxmox.com/
Summary of Changes
------------------
Max R. Carrara (2):
plugin-sshfs: add example for custom storage plugin for SSHFS
plugin-sshfs: package the SSHFS example plugin
Makefile | 1 +
plugin-sshfs/Makefile | 71 ++++
plugin-sshfs/debian/changelog | 5 +
plugin-sshfs/debian/control | 22 +
plugin-sshfs/debian/copyright | 20 +
plugin-sshfs/debian/rules | 8 +
plugin-sshfs/debian/source/format | 1 +
plugin-sshfs/debian/triggers | 1 +
.../src/PVE/Storage/Custom/SSHFSPlugin.pm | 395 ++++++++++++++++++
9 files changed, 524 insertions(+)
create mode 100644 plugin-sshfs/Makefile
create mode 100644 plugin-sshfs/debian/changelog
create mode 100644 plugin-sshfs/debian/control
create mode 100644 plugin-sshfs/debian/copyright
create mode 100755 plugin-sshfs/debian/rules
create mode 100644 plugin-sshfs/debian/source/format
create mode 100644 plugin-sshfs/debian/triggers
create mode 100644 plugin-sshfs/src/PVE/Storage/Custom/SSHFSPlugin.pm
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next reply other threads:[~2025-07-04 16:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-04 16:20 Max R. Carrara [this message]
2025-07-04 16:20 ` [pve-devel] [PATCH v2 pve-storage-plugin-examples 1/2] plugin-sshfs: add example for custom storage plugin for SSHFS Max R. Carrara
2025-07-04 16:20 ` [pve-devel] [PATCH v2 pve-storage-plugin-examples 2/2] plugin-sshfs: package the SSHFS example plugin Max R. Carrara
2025-09-08 8:26 ` [pve-devel] applied: [PATCH v2 pve-storage-plugin-examples 0/2] SSHFS Example Storage Plugin Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250704162011.402195-1-m.carrara@proxmox.com \
--to=m.carrara@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox