Skip to content

refactor: modernize openvpn cookbook to custom resource standards#253

Open
damacus wants to merge 13 commits into
mainfrom
fix/modernize-standards
Open

refactor: modernize openvpn cookbook to custom resource standards#253
damacus wants to merge 13 commits into
mainfrom
fix/modernize-standards

Conversation

@damacus

@damacus damacus commented Mar 19, 2026

Copy link
Copy Markdown
Member

Modernize the openvpn cookbook to follow sous-chefs custom resource standards.

Changes

  • Research: Add LIMITATIONS.md documenting OpenVPN package availability and container constraints
  • Structure: Fix kitchen.yml/dokken/global platform alignment, remove EOL platforms, create proper InSpec default profile
  • Resources: Extract shared PKI properties into resources/_partial/_pki.rb partial (used by server and user)
  • ChefSpec: Add specs for server, service, and user resources (43 examples, 0 failures)
  • Integration: Create InSpec profile at test/integration/default/ with controls for install, service, config, PKI, CRL, and IP forwarding
  • Documentation: Add resource docs for all 5 custom resources (install, conf, server, service, user)

Verification

  • cookbook-helpers check-structure
  • cookbook-helpers check-kitchen
  • chef exec rspec — 43 examples, 0 failures
  • chef exec cookstyle — 17 files, 0 offenses

@damacus damacus requested a review from a team as a code owner March 19, 2026 11:01
- Add openvpn_conf resource spec (1 example, 0 failures)

- Note: conf :delete action has a bug (references local var from :create)

- Update spec_helper ubuntu 16.04 to 22.04

- Add frozen_string_literal to 7 files

- Replace all EOL platforms with current non-EOL in kitchen.yml, kitchen.dokken.yml, CI
@damacus damacus force-pushed the fix/modernize-standards branch from ace2b25 to 2359cfb Compare March 19, 2026 11:22
…utes

BREAKING CHANGE: Remove recipes/, attributes/, and legacy service management.

New resources:

- openvpn_install: package installation, apt repo, yum-epel, IP forwarding

- openvpn_server: PKI/CA management (keys, certs, DH params, CRL, easy-rsa)

- openvpn_conf: rewritten with properties (no node attributes), :delete bug fixed

- openvpn_user: rewritten with properties (no node attributes)

- openvpn_service: systemd instance service with platform-specific naming

Templates rewritten to use @variables instead of node[] attributes.

4 examples, 0 failures locally.

Signed-off-by: Dan Webb <dan.webb@damacus.io>
@damacus damacus force-pushed the fix/modernize-standards branch from e421b8f to e56857c Compare March 19, 2026 12:15
damacus added 4 commits March 20, 2026 11:43
- Add LIMITATIONS.md documenting OpenVPN package availability

- Create proper InSpec profile for default suite (inspec.yml + controls/)

- Fix kitchen.yml default suite verifier path to test/integration/default

- Remove EOL platforms from kitchen.global.yml

- Simplify kitchen.dokken.yml format

- Remove stale integration test directories (server, server_verification, server_verify_no_databag, data_bags)
- Create resources/_partial/_pki.rb with shared PKI properties

- Update server.rb and user.rb to use the partial

- No functional changes, cookstyle and rspec pass
- Add server_spec.rb covering create action with defaults and custom PKI

- Add service_spec.rb covering Ubuntu and AlmaLinux service names

- Add user_spec.rb covering create with/without bundle, custom properties, and delete

- All 43 examples pass with 0 failures
- Add documentation/openvpn_install.md

- Add documentation/openvpn_conf.md

- Add documentation/openvpn_server.md

- Add documentation/openvpn_service.md

- Add documentation/openvpn_user.md

- Remove documentation/.gitkeep

Signed-off-by: Dan Webb <dan.webb@damacus.io>
@damacus damacus changed the title fix: add frozen_string_literal to all Ruby files refactor: modernize openvpn cookbook to custom resource standards Mar 20, 2026
damacus added 7 commits March 20, 2026 12:43
… templates

- pkitool.erb: use @message_digest instead of node['openvpn']['key']['message_digest']

- Rakefile.erb: use @dev, @proto, @PORT, @server_verification

- client.conf.erb: use template variables for all config values

- client-inline.conf.erb: use template variables for all config values

- server.rb: add dev, proto, port, server_verification properties

- user.rb: add dev, proto, gateway, port, config_options, server_verification properties
- Remove -extensions server from openssl req (fails on OpenSSL 3.x)

- Update openssl.cnf.erb: remove deprecated RANDFILE, default_md md5->sha256

- Fix RHEL symlink target: openvpn-server@.service not openvpn@.service

- Fix test recipe: use platform-appropriate group (nogroup/nobody)

- Fix InSpec profile: platform-family redhat not rhel
…Dokken

The shared workflow 5.0.8 uses Ruby/Bundler instead of chef-install for lint-unit.

Dokken still needs Chef's mixlib-install to resolve 'chef' product in containers.
Use cincproject/cinc Docker image and product_name: cinc in provisioner.

This eliminates the need for actionshub/chef-install entirely.
… images

Cinc Docker images use 'latest' tag, not 'current' like Chef.
sysctl resources are not idempotent in Docker containers.

Switch kitchen configs to use Cinc instead of Chef.
@github-actions

Copy link
Copy Markdown

Slowest examples

Top 10 slowest examples (0.92 seconds, 32% of total time)
Example Description Time in seconds
spec/resources/server_spec.rb:18 openvpn_server create action with defaults is expected to create template "/etc/openvpn/easy-rsa/Rakefile" 0.16041
spec/resources/server_spec.rb:22 openvpn_server create action with defaults is expected to create directory "/etc/openvpn/server.up.d" 0.09741
spec/resources/user_spec.rb:50 openvpn_user create action with custom properties is expected to create template "/opt/keys/vpn-test-customuser.ovpn" 0.0928
spec/resources/service_spec.rb:29 openvpn_service on ubuntu delete action is expected to stop service "openvpn" 0.0876
spec/resources/user_spec.rb:15 openvpn_user create action with defaults is expected to run execute "generate-openvpn-testuser" 0.08662
spec/resources/server_spec.rb:21 openvpn_server create action with defaults is expected to create template "/etc/openvpn/server.up.sh" 0.0847
spec/resources/user_spec.rb:30 openvpn_user create action without bundle is expected not to create template "/etc/openvpn/keys/vpn-prod-testuser.conf" 0.08291
spec/resources/server_spec.rb:46 openvpn_server create action with custom PKI properties is expected not to create template "/etc/openvpn/server.up.sh" 0.07888
spec/resources/service_spec.rb:45 openvpn_service on almalinux create action is expected to start service "openvpn" 0.07693
spec/resources/server_spec.rb:25 openvpn_server create action with defaults is expected to create_if_missing file "/etc/openvpn/keys/serial" 0.07541

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant