train-juniper 0.7.1 → 0.7.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86bf86dd54cabe94e072c6e3a2b64ffcdfbdf774a5f33f1a3a76012829dd71bc
4
- data.tar.gz: c2e5d2fe1ecfa259f78c2d80f76d94eaa68afb817d584c57d02bfb4c46779924
3
+ metadata.gz: c7074cafad165e2055edc5be8495a250025f4fc06ad658e740b77248e3d2273c
4
+ data.tar.gz: febffacb8ad71ffc912a76b3be460f598e48e20b0c500de48f10c3cefe11c549
5
5
  SHA512:
6
- metadata.gz: 168356b0c2a48f7b4817acb535571c2b651d12365dc7340c96c9b2b2d6db30981516683c29965bd295459d8cbb2b2625e020a35789a3bbed4d295ce29712264e
7
- data.tar.gz: 8a209708671652728890ff96f75b3a2da922f37f93c61896881e99b387adc15ecc1e889d6e416637dc0eee011ed1f1b9b0fcd33b99c2bacfe15f2736daaa9da8
6
+ metadata.gz: 4c47e243ab6d5922904bd7898b4c1da8dff8ac4986f3b60629e4662c566e79ace9bbec8a0dfda2ee400e51ec7f060f2c871b11be07d84130ce1f1ac1d23b4d76
7
+ data.tar.gz: af8b001261139a75f38da8be9711c3c9f14c8a618bd8195234c750262ef40e4a772cd9a081a59deb2880e1c78ac5ad44846ba7c902cc360420a4d4a4b5092be6
data/CHANGELOG.md CHANGED
@@ -5,6 +5,37 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.7.3] - 2025-06-23
9
+
10
+ ### Documentation
11
+
12
+ - Improve README structure for better MkDocs rendering
13
+ - Add platform support section to README
14
+
15
+ ### Fixed
16
+
17
+ - Follow standard RubyGems conventions for gem packaging
18
+ - Remove .md extensions from internal MkDocs links
19
+ - **docs**: Improve Support section formatting with subsections
20
+ - **windows**: Use PowerShell for SSH_ASKPASS on Windows and add cross-platform CI/CD
21
+ - **ci**: Add comprehensive platform support for cross-platform compatibility
22
+ - Update ffi dependency to support Ruby 3.3 on Windows
23
+ - Handle Windows PowerShell script paths in bastion proxy tests
24
+ - Use direct gem push instead of rubygems/release-gem action
25
+ - Complete release workflow implementation
26
+
27
+ ### Miscellaneous Tasks
28
+
29
+ - Add session.md to .gitignore
30
+
31
+ ### Styling
32
+
33
+ - Fix trailing whitespace in bastion proxy files
34
+
35
+ ### Testing
36
+
37
+ - Add nocov markers for Windows-specific PowerShell code
38
+
8
39
  ## [0.7.1] - 2025-06-23
9
40
 
10
41
  ### Added
@@ -26,6 +57,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
57
  - Add v0.7.0 to mkdocs and automate nav updates
27
58
  - **coverage**: Properly handle SimpleCov :nocov: markers in analysis
28
59
  - **docs**: Move Security Policy to About section in navigation
60
+ - Resolve RuboCop violations for CI/CD compliance
61
+ - Update release task to handle GitHub Actions gem publishing
62
+ - Resolve final RuboCop issues in release task
29
63
 
30
64
  ### Miscellaneous Tasks
31
65
 
data/CONTRIBUTING.md CHANGED
@@ -146,7 +146,7 @@ Releases are managed by project maintainers:
146
146
 
147
147
  ## Community
148
148
 
149
- - Follow our [Code of Conduct](CODE_OF_CONDUCT.md)
149
+ - Follow our [Code of Conduct](CODE_OF_CONDUCT)
150
150
  - Be respectful and collaborative
151
151
  - Help others learn and contribute
152
152
 
data/README.md CHANGED
@@ -175,11 +175,11 @@ This allows maximum flexibility while providing sensible defaults for common sce
175
175
  | `key_files` | SSH private key files | - | - |
176
176
  | `keys_only` | Use only specified keys | false | - |
177
177
 
178
- **Notes**:
179
- - Cannot specify both `bastion_host` and `proxy_command` simultaneously
180
- - If `bastion_user` not provided, falls back to using main `user` for bastion authentication
181
- - If `bastion_password` not provided, falls back to using main `password` for bastion authentication
182
- - Supports automated password authentication via SSH_ASKPASS mechanism
178
+ !!! note "Important Configuration Notes"
179
+ - Cannot specify both `bastion_host` and `proxy_command` simultaneously
180
+ - If `bastion_user` not provided, falls back to using main `user` for bastion authentication
181
+ - If `bastion_password` not provided, falls back to using main `password` for bastion authentication
182
+ - Supports automated password authentication via SSH_ASKPASS mechanism
183
183
 
184
184
  ### InSpec Configuration File
185
185
 
@@ -280,7 +280,8 @@ Train.create('juniper', {
280
280
 
281
281
  ### Common Authentication Issues
282
282
 
283
- #### ❌ **Error**: "No bastion password specified"
283
+ #### ❌ Error: "No bastion password specified"
284
+
284
285
  **Solution**: Train doesn't have `--bastion-password`. Use one of these patterns:
285
286
  ```bash
286
287
  # Same password for both (most common)
@@ -293,7 +294,8 @@ inspec detect -t "juniper://user@device?bastion_host=jump" --key-files ~/.ssh/id
293
294
  inspec detect -t "juniper://user@device?proxy_command=sshpass%20-p%20jumppass%20ssh%20jumpuser@jump%20-W%20%h:%p" --password "device_pass"
294
295
  ```
295
296
 
296
- #### ❌ **Error**: "Authentication failed"
297
+ #### ❌ Error: "Authentication failed"
298
+
297
299
  **Solutions**:
298
300
  ```bash
299
301
  # Verify bastion connection first
@@ -309,7 +311,8 @@ inspec detect -t "juniper://user@device?bastion_host=jump&proxy_command=ssh%20-v
309
311
  inspec detect -t "juniper://user@device?bastion_host=jump" --password "pass" -l debug
310
312
  ```
311
313
 
312
- #### ❌ **Error**: "Connection timeout"
314
+ #### ❌ Error: "Connection timeout"
315
+
313
316
  **Solutions**:
314
317
  ```bash
315
318
  # Increase timeouts
@@ -349,6 +352,7 @@ result = connection.run_command('show version')
349
352
  ```
350
353
 
351
354
  Mock mode provides:
355
+
352
356
  - ✅ Realistic JunOS command outputs
353
357
  - ✅ Platform detection (JunOS 12.1X47-D15.4)
354
358
  - ✅ Error simulation for negative testing
@@ -393,12 +397,31 @@ This plugin implements the Train Plugin V1 API with:
393
397
  - **Platform** (`lib/train-juniper/platform.rb`) - JunOS platform detection
394
398
  - **Version** (`lib/train-juniper/version.rb`) - Plugin version management
395
399
 
400
+ ### Platform Support
401
+
402
+ This gem supports a wide range of platforms to ensure maximum compatibility:
403
+
404
+ | Platform | Description | Use Case |
405
+ |----------|-------------|----------|
406
+ | `ruby` | Platform-independent | Pure Ruby installations |
407
+ | `x86_64-linux` | Standard Linux | Most Linux servers and CI/CD |
408
+ | `aarch64-linux` | ARM64 Linux | AWS Graviton, Raspberry Pi |
409
+ | `x86_64-linux-musl` | Alpine Linux | Docker containers |
410
+ | `x86_64-darwin` | Intel macOS | Older Mac workstations |
411
+ | `arm64-darwin-*` | Apple Silicon macOS | Modern Mac workstations |
412
+ | `x64-mingw-ucrt` | Windows (UCRT) | Windows 10/11 with modern Ruby |
413
+ | `x86_64-freebsd` | FreeBSD | Network appliances (JunOS heritage) |
414
+ | `x86_64-solaris` | Solaris/illumos | Enterprise environments |
415
+
416
+ !!! note "Platform Compatibility"
417
+ This comprehensive platform support ensures the plugin works wherever InSpec runs, from developer workstations to CI/CD pipelines to production jump hosts. The FreeBSD support is particularly relevant given that JunOS is based on FreeBSD.
418
+
396
419
  ### Documentation
397
420
 
398
- - **[Installation Guide](installation.md)** - Complete installation instructions
399
- - **[Basic Usage](basic-usage.md)** - Getting started with the plugin
400
- - **[Release Process](RELEASE_PROCESS.md)** - How to cut releases and publish gems
401
- - **[Project Roadmap](ROADMAP.md)** - Future development plans and contribution opportunities
421
+ - **[Installation Guide](installation)** - Complete installation instructions
422
+ - **[Basic Usage](basic-usage)** - Getting started with the plugin
423
+ - **[Release Process](RELEASE_PROCESS)** - How to cut releases and publish gems
424
+ - **[Project Roadmap](ROADMAP)** - Future development plans and contribution opportunities
402
425
 
403
426
  ### Plugin Development Resources
404
427
 
@@ -407,19 +430,29 @@ This plugin implements the Train Plugin V1 API with:
407
430
 
408
431
  ## Contributing
409
432
 
433
+ We welcome contributions! Here's how to get started:
434
+
410
435
  1. Fork the repository
411
- 2. Create a feature branch
436
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
412
437
  3. Make your changes with tests
413
- 4. Run `bundle exec rake test`
438
+ 4. Run `bundle exec rake test` to ensure tests pass
414
439
  5. Submit a pull request
415
440
 
441
+ Please see our [Contributing Guide](CONTRIBUTING) for more details.
442
+
416
443
  ## Support and Contact
417
444
 
445
+ ### General Support
446
+
418
447
  For questions, feature requests, or general support:
448
+
419
449
  - Email: [saf@mitre.org](mailto:saf@mitre.org)
420
450
  - GitHub Issues: [https://github.com/mitre/train-juniper/issues](https://github.com/mitre/train-juniper/issues)
421
451
 
452
+ ### Security Issues
453
+
422
454
  For security issues or vulnerabilities:
455
+
423
456
  - Email: [saf-security@mitre.org](mailto:saf-security@mitre.org)
424
457
  - GitHub Security: [https://github.com/mitre/train-juniper/security](https://github.com/mitre/train-juniper/security)
425
458
 
@@ -439,12 +472,12 @@ Special thanks to the Train and InSpec communities for their excellent documenta
439
472
 
440
473
  Licensed under the Apache-2.0 license, except as noted below.
441
474
 
442
- See [LICENSE](LICENSE.md) for full details.
475
+ See [LICENSE](LICENSE) for full details.
443
476
 
444
477
  ### Notice
445
478
 
446
479
  This software was produced for the U.S. Government under contract and is subject to Federal Acquisition Regulation Clause 52.227-14.
447
480
 
448
- See [NOTICE](NOTICE.md) for full details.
481
+ See [NOTICE](NOTICE) for full details.
449
482
 
450
483
  © 2025 The MITRE Corporation.
@@ -46,13 +46,33 @@ module TrainPlugins
46
46
  def create_ssh_askpass_script(password)
47
47
  require 'tempfile'
48
48
 
49
- script = Tempfile.new(['ssh_askpass', '.sh'])
50
- script.write("#!/bin/bash\necho '#{password}'\n")
51
- script.close
52
- File.chmod(0o755, script.path)
53
-
54
- @logger.debug("Created SSH_ASKPASS script at #{script.path}")
55
- script.path
49
+ if Gem.win_platform?
50
+ # :nocov:
51
+ # Create Windows PowerShell script
52
+ script = Tempfile.new(['ssh_askpass', '.ps1'])
53
+ # PowerShell handles escaping better, just escape quotes
54
+ escaped_password = password.gsub("'", "''")
55
+ script.write("Write-Output '#{escaped_password}'\r\n")
56
+ script.close
57
+
58
+ # Create a wrapper batch file to execute PowerShell with bypass policy
59
+ wrapper = Tempfile.new(['ssh_askpass_wrapper', '.bat'])
60
+ wrapper.write("@echo off\r\npowershell.exe -ExecutionPolicy Bypass -File \"#{script.path}\"\r\n")
61
+ wrapper.close
62
+
63
+ @logger.debug("Created SSH_ASKPASS PowerShell script at #{script.path} with wrapper at #{wrapper.path}")
64
+ wrapper.path
65
+ # :nocov:
66
+ else
67
+ # Create Unix shell script
68
+ script = Tempfile.new(['ssh_askpass', '.sh'])
69
+ script.write("#!/bin/bash\necho '#{password}'\n")
70
+ script.close
71
+ File.chmod(0o755, script.path)
72
+
73
+ @logger.debug("Created SSH_ASKPASS script at #{script.path}")
74
+ script.path
75
+ end
56
76
  end
57
77
 
58
78
  # Generate SSH proxy command for bastion host using ProxyJump (-J)
@@ -8,6 +8,6 @@
8
8
  module TrainPlugins
9
9
  module Juniper
10
10
  # Version number of the train-juniper plugin
11
- VERSION = '0.7.1'
11
+ VERSION = '0.7.3'
12
12
  end
13
13
  end
@@ -68,8 +68,8 @@ Gem::Specification.new do |spec|
68
68
  spec.add_dependency 'net-ssh', '>= 2.9', '< 8.0'
69
69
 
70
70
  # FFI dependency - required by train-core
71
- # Match InSpec 7's FFI version range for compatibility
72
- spec.add_dependency 'ffi', '>= 1.15.5', '< 1.17.0'
71
+ # Updated to support Ruby 3.3 on Windows (ffi 1.17.x required)
72
+ spec.add_dependency 'ffi', '>= 1.15.5', '< 1.18.0'
73
73
 
74
74
  # Development dependencies
75
75
  spec.add_development_dependency 'bundler', '~> 2.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: train-juniper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - MITRE Corporation
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: 1.15.5
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: 1.17.0
56
+ version: 1.18.0
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -63,7 +63,7 @@ dependencies:
63
63
  version: 1.15.5
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
- version: 1.17.0
66
+ version: 1.18.0
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: bundler
69
69
  requirement: !ruby/object:Gem::Requirement