ruborg 0.7.6 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +0 -19
- data/SECURITY.md +1 -9
- data/lib/ruborg/backup.rb +0 -63
- data/lib/ruborg/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8cc86659dca9c85fca163fd08ad8f23d4a0ca296cb32944274f6ae87e0086751
|
|
4
|
+
data.tar.gz: 2fb298807e3960026917f05a0552161c4d778cc7102ac62150b41710c8f0b1a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8443ac13e208645f5bce4126961c7c765b33f22038a2fcf92aedff110e3c3cc1def4db52c3c847c4aae13d3d8871c02dd00d67d71ec6d37698ad2084044954df
|
|
7
|
+
data.tar.gz: 33707f77cffb7e756fe0446786cd11807bf2f168b6b40ba40efc5ff4854017ec9871fe48127047f574d35e6fad376a32fcc5d348536b76079edaf14755dbc40e
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.8.0] - 2025-10-09
|
|
11
|
+
|
|
12
|
+
### Removed
|
|
13
|
+
- **chattr/lsattr Functionality**: Completely removed Linux immutable attribute handling
|
|
14
|
+
- The feature caused issues with network filesystems (CIFS/SMB, NFS) that don't support chattr
|
|
15
|
+
- Users with truly immutable files should remove the attribute manually before using `--remove-source`
|
|
16
|
+
- Simplifies code and eliminates filesystem compatibility issues
|
|
17
|
+
- `--remove-source` now relies on standard file permissions only
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- File deletion now uses standard Ruby FileUtils methods without chattr checks
|
|
21
|
+
- Improved compatibility with all filesystem types (local, network, cloud)
|
|
22
|
+
|
|
10
23
|
## [0.7.6] - 2025-10-09
|
|
11
24
|
|
|
12
25
|
### Fixed
|
data/README.md
CHANGED
|
@@ -398,25 +398,6 @@ Error: Cannot use --remove-source: 'allow_remove_source' must be true (boolean).
|
|
|
398
398
|
Current value: "true" (String). Set 'allow_remove_source: true' in configuration.
|
|
399
399
|
```
|
|
400
400
|
|
|
401
|
-
**📌 Immutable File Handling (Linux)**
|
|
402
|
-
|
|
403
|
-
Ruborg automatically detects and removes Linux immutable attributes (`chattr +i`) when deleting files with `--remove-source`:
|
|
404
|
-
|
|
405
|
-
- **Automatic Detection**: Checks files with `lsattr` before deletion
|
|
406
|
-
- **Automatic Removal**: Removes immutable flag with `chattr -i` if present
|
|
407
|
-
- **Platform-Aware**: Gracefully skips on non-Linux systems (macOS, BSD, etc.)
|
|
408
|
-
- **Comprehensive**: Works for both single files and directories (recursive)
|
|
409
|
-
- **Logged**: All immutable attribute operations are logged for audit trail
|
|
410
|
-
|
|
411
|
-
**Root Privileges**: If your files have immutable attributes, you'll need root privileges to remove them. Configure sudoers for ruborg:
|
|
412
|
-
|
|
413
|
-
```bash
|
|
414
|
-
# /etc/sudoers.d/ruborg
|
|
415
|
-
michail ALL=(root) NOPASSWD: /usr/local/bin/ruborg
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
This allows running ruborg with sudo for file deletion without password prompts.
|
|
419
|
-
|
|
420
401
|
### List Archives
|
|
421
402
|
|
|
422
403
|
```bash
|
data/SECURITY.md
CHANGED
|
@@ -19,15 +19,7 @@ Ruborg implements several security measures to protect your backup operations:
|
|
|
19
19
|
- Refuses to delete system directories even when targeted via symlinks
|
|
20
20
|
- Uses `FileUtils.rm_rf` with `secure: true` option
|
|
21
21
|
|
|
22
|
-
### 4.
|
|
23
|
-
- **Automatic Detection**: Checks for Linux immutable attributes (`lsattr`) before file deletion
|
|
24
|
-
- **Safe Removal**: Removes immutable flag (`chattr -i`) only when necessary for deletion
|
|
25
|
-
- **Platform-Aware**: Feature only active on Linux systems with lsattr/chattr commands available
|
|
26
|
-
- **Error Handling**: Raises informative errors if immutable flag cannot be removed
|
|
27
|
-
- **Audit Trail**: All immutable attribute operations are logged for security auditing
|
|
28
|
-
- **Root Required**: Removing immutable attributes requires root privileges (use sudo with appropriate sudoers configuration)
|
|
29
|
-
|
|
30
|
-
### 5. Safe YAML Loading
|
|
22
|
+
### 4. Safe YAML Loading
|
|
31
23
|
- Uses `YAML.safe_load_file` to prevent arbitrary code execution
|
|
32
24
|
- Rejects YAML files containing Ruby objects or other dangerous constructs
|
|
33
25
|
- Only permits basic data types and Symbol class
|
data/lib/ruborg/backup.rb
CHANGED
|
@@ -361,69 +361,10 @@ module Ruborg
|
|
|
361
361
|
raise BorgError, "Refusing to delete system path: #{real_path}"
|
|
362
362
|
end
|
|
363
363
|
|
|
364
|
-
# Check for immutable attribute and remove it if present
|
|
365
|
-
remove_immutable_attribute(real_path)
|
|
366
|
-
|
|
367
364
|
@logger&.info("Removing file: #{real_path}")
|
|
368
365
|
FileUtils.rm(real_path)
|
|
369
366
|
end
|
|
370
367
|
|
|
371
|
-
def remove_immutable_attribute(file_path)
|
|
372
|
-
# Check if lsattr command is available (Linux only)
|
|
373
|
-
return unless system("which lsattr > /dev/null 2>&1")
|
|
374
|
-
|
|
375
|
-
# Get file attributes
|
|
376
|
-
require "open3"
|
|
377
|
-
stdout, stderr, status = Open3.capture3("lsattr", file_path)
|
|
378
|
-
|
|
379
|
-
unless status.success?
|
|
380
|
-
@logger&.warn("Could not check attributes for #{file_path}: #{stderr.strip}")
|
|
381
|
-
return
|
|
382
|
-
end
|
|
383
|
-
|
|
384
|
-
# Check if immutable flag is set (format: "----i--------e----- /path/to/file")
|
|
385
|
-
# Extract the flags portion (everything before the file path)
|
|
386
|
-
flags = stdout.split.first || ""
|
|
387
|
-
return unless flags.include?("i")
|
|
388
|
-
|
|
389
|
-
@logger&.info("Removing immutable attribute from: #{file_path}")
|
|
390
|
-
_chattr_stdout, chattr_stderr, chattr_status = Open3.capture3("chattr", "-i", file_path)
|
|
391
|
-
|
|
392
|
-
unless chattr_status.success?
|
|
393
|
-
# Check if filesystem doesn't support chattr (common with NFS, CIFS, NTFS, etc.)
|
|
394
|
-
if chattr_stderr.include?("Operation not supported")
|
|
395
|
-
@logger&.warn(
|
|
396
|
-
"Filesystem does not support chattr operations for #{file_path}. " \
|
|
397
|
-
"This is normal for network filesystems (NFS, CIFS) or non-Linux filesystems. " \
|
|
398
|
-
"Attempting deletion anyway."
|
|
399
|
-
)
|
|
400
|
-
return
|
|
401
|
-
end
|
|
402
|
-
|
|
403
|
-
# Other errors (like permission denied) should still raise
|
|
404
|
-
@logger&.error("Failed to remove immutable attribute from #{file_path}: #{chattr_stderr.strip}")
|
|
405
|
-
raise BorgError, "Cannot remove immutable file: #{file_path}. Error: #{chattr_stderr.strip}"
|
|
406
|
-
end
|
|
407
|
-
|
|
408
|
-
@logger&.info("Successfully removed immutable attribute from: #{file_path}")
|
|
409
|
-
end
|
|
410
|
-
|
|
411
|
-
def remove_immutable_from_directory(dir_path)
|
|
412
|
-
# Check if lsattr command is available (Linux only)
|
|
413
|
-
return unless system("which lsattr > /dev/null 2>&1")
|
|
414
|
-
|
|
415
|
-
require "find"
|
|
416
|
-
require "open3"
|
|
417
|
-
|
|
418
|
-
# Remove immutable from directory itself
|
|
419
|
-
remove_immutable_attribute(dir_path)
|
|
420
|
-
|
|
421
|
-
# Recursively remove immutable from all files in directory
|
|
422
|
-
Find.find(dir_path) do |path|
|
|
423
|
-
remove_immutable_attribute(path) if File.file?(path)
|
|
424
|
-
end
|
|
425
|
-
end
|
|
426
|
-
|
|
427
368
|
def remove_source_files
|
|
428
369
|
require "fileutils"
|
|
429
370
|
|
|
@@ -457,12 +398,8 @@ module Ruborg
|
|
|
457
398
|
@logger&.info("Removing #{file_type}: #{real_path}")
|
|
458
399
|
|
|
459
400
|
if File.directory?(real_path)
|
|
460
|
-
# Remove immutable attributes from all files in directory
|
|
461
|
-
remove_immutable_from_directory(real_path)
|
|
462
401
|
FileUtils.rm_rf(real_path, secure: true)
|
|
463
402
|
elsif File.file?(real_path)
|
|
464
|
-
# Remove immutable attribute from single file
|
|
465
|
-
remove_immutable_attribute(real_path)
|
|
466
403
|
FileUtils.rm(real_path)
|
|
467
404
|
end
|
|
468
405
|
|
data/lib/ruborg/version.rb
CHANGED