A Linux kernel module that provides WebDAV filesystem support for mounting remote WebDAV shares (like NextCloud) directly as filesystems.
- kwebdavfs.h - Main header file with structures and function declarations
- main.c - Module initialization and filesystem registration
- super.c - Superblock operations and mount option parsing
- inode.c - Inode operations (getattr, setattr)
- file.c - File operations (read, write)
- dir.c - Directory operations (readdir, lookup, create, mkdir, unlink)
- http.c - HTTP/WebDAV client implementation
- Makefile - Build configuration
- Mount WebDAV shares with authentication
- Directory listing (PROPFIND)
- File reading (GET)
- File writing (PUT)
- File/directory creation
- File/directory deletion
- Basic attribute support
- HTTP and HTTPS support (with kernel TLS)
- DNS hostname resolution
password=PASS- Authentication passwordtimeout=SECONDS- HTTP timeout (default: 30)ssl- Enable SSL (not implemented in kernel space)user_agent=STRING- Custom User-Agent string
make clean
make allDownload the latest kwebdavfs-dkms_*.deb from the GitHub Releases page, then install it:
sudo apt install ./kwebdavfs-dkms_*.debDKMS will automatically build and install the module for your running kernel, and rebuild it after every kernel upgrade.
To load the module automatically at boot:
echo "kwebdavfs" | sudo tee /etc/modules-load.d/kwebdavfs.confmake clean
make all
sudo make install
# Or load without installing:
sudo insmod kwebdavfs.ko# Mount a WebDAV share with HTTP
sudo mkdir /mnt/webdav
sudo mount -t kwebdavfs -o server=http://myserver.example.com/webdav,username=user,password=pass none /mnt/webdav
# Mount a secure WebDAV share with HTTPS
sudo mkdir /mnt/secure-webdav
sudo mount -t kwebdavfs -o server=https://secure.example.com/nextcloud/remote.php/webdav,username=user,password=pass none /mnt/secure-webdav
# Use IP addresses (still supported)
sudo mount -t kwebdavfs -o server=https://192.168.1.100/webdav,username=user,password=pass none /mnt/webdav
# Use the filesystem
ls /mnt/webdav
echo "test content" > /mnt/webdav/test.txt
cat /mnt/webdav/test.txt
# Unmount
sudo umount /mnt/webdav- TLS Implementation - Basic HTTPS support without full encryption (use reverse proxy)
- Authentication Methods - Basic authentication only (no digest or OAuth)
- Simplified HTTP Client - Basic implementation without full HTTP/1.1 features
- No Partial Writes - File writes replace entire content
- No Caching - All operations go directly to server
- No Locking - WebDAV locking protocol not implemented
- Base64 encoding for authentication is placeholder (needs proper implementation)
- XML parsing is very basic (should use proper XML parser)
- TLS certificate verification not implemented
- Error handling could be more robust
- Performance not optimized for production use
This is a proof-of-concept implementation demonstrating:
- Linux VFS integration
- WebDAV protocol basics
- Kernel HTTP/HTTPS client implementation
- DNS resolution in kernel space
- Kernel TLS socket usage
- Module structure for filesystems
For production use, consider:
- Implementing TLS certificate validation
- Adding comprehensive error handling
- Optimizing for performance and caching
- Adding WebDAV locking support
- Implementing digest authentication
- Using robust XML parsing library
Test with a simple WebDAV server like:
- Apache with mod_dav
- Nginx with dav module
- Python webdav server for development
Example Apache configuration:
<VirtualHost *:80>
DocumentRoot /var/www/webdav
<Directory /var/www/webdav>
Dav On
AuthType Basic
AuthName "WebDAV"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
</VirtualHost>- Passwords are stored in kernel memory (consider security implications)
- No encryption for HTTP communication
- Basic authentication credentials sent in clear text
- Proper input validation needed for production use