Installation Guide¶
Complete installation instructions for the Train-Juniper plugin.
Quick Start
New to Train-Juniper? Follow Method 1 for the fastest installation experience.
Prerequisites¶
Ruby Environment¶
- Ruby: 3.0+ (3.1.6+ recommended)
- Bundler: Latest version
- InSpec: 6.0+ (latest recommended)
System Requirements¶
- SSH Client: OpenSSH or compatible
- Network Access: Connectivity to target Juniper devices
- Platform: Linux, macOS, or Windows with WSL
Installation Methods¶
Method 1: From RubyGems ¶
- Recommended for most users
# Install by name from RubyGems (once published)
inspec plugin install train-juniper
# Verify installation
inspec plugin list
Installation Complete
If you see train-juniper
in the plugin list, you're ready to go!
Method 2: Local Gem Installation ¶
Development Installation
This method is for development and testing. Use Method 1 for production.
Method 3: Bundle Development (Developers)¶
# Clone repository
git clone https://github.com/mitre/train-juniper.git
cd train-juniper
# Install dependencies
bundle install
# Use with bundle exec
bundle exec inspec detect -t juniper://device.example.com
Verification¶
Test Plugin Loading¶
# Verify plugin is registered
inspec plugin list
# Should show: train-juniper
# Test URI scheme recognition
inspec detect -t juniper://
# Should show usage help, not "unsupported scheme"
Test Mock Connection¶
Expected output:
Test Real Device Connection¶
# Test with real device (replace with your device)
inspec detect -t juniper://admin@device.example.com
Expected output:
Configuration¶
SSH Configuration¶
The plugin respects standard SSH configuration:
~/.ssh/config:
Host *.juniper.lab
User admin
Port 2222
IdentityFile ~/.ssh/juniper_key
StrictHostKeyChecking no
Host jump.example.com
User admin
IdentityFile ~/.ssh/bastion_key
Environment Variables¶
Set these for convenience:
# Device credentials
export JUNIPER_HOST=device.example.com
export JUNIPER_USER=admin
export JUNIPER_PASSWORD=secret123
# Bastion configuration
export JUNIPER_BASTION_HOST=jump.example.com
export JUNIPER_BASTION_USER=admin
# Connection tuning
export JUNIPER_TIMEOUT=60
export JUNIPER_PORT=22
Troubleshooting Installation¶
Common Installation Issues
Having trouble? Check these common problems and solutions.
Plugin Not Found¶
Solutions:
InSpec Plugin Manager Issues¶
Error: Plugin failed to load
Debug Steps:
# Test gem loads in Ruby
ruby -e "require 'train-juniper'; puts 'OK'"
# Check InSpec gem compatibility
inspec version
ruby --version
# Clean plugin cache
rm -rf ~/.inspec/plugins/
inspec plugin install train-juniper
Dependency Conflicts¶
Error: Gem::ConflictError
Solution: Use bundle development mode:
git clone https://github.com/mitre/train-juniper.git
cd train-juniper
bundle install
bundle exec inspec detect -t juniper://device.example.com
SSH Connection Issues¶
Error: SSH authentication failed
Debug Steps:
# Test SSH manually
ssh admin@device.example.com
# Enable SSH debug in plugin
TRAIN_DEBUG=true inspec detect -t juniper://admin@device.example.com
# Check SSH agent
ssh-add -l
Development Setup¶
For plugin development and contribution:
1. Clone and Setup¶
2. Run Tests¶
# All tests
bundle exec rake test
# Unit tests only
bundle exec ruby -Ilib:test test/unit/transport_test.rb
# Code coverage
bundle exec rake test
open coverage/index.html
3. Code Quality¶
4. Local Testing¶
# Build and test gem
gem build train-juniper.gemspec
inspec plugin install train-juniper-0.4.0.gem
# Test with real device
inspec detect -t juniper://admin@your-device.com
Next Steps¶
- Basic Usage - Learn to use the plugin
- Train Plugin Development Guide - Comprehensive development documentation
- Contributing Guide - How to contribute to the project
Support¶
- Issues: GitHub Issues
- Development: Contributing Guide
- Security: Security Policy