Skip to content

How to transfer configs to clients using openvpn::deploy::export and openvpn::deploy::client? #353

@flyingstar16

Description

@flyingstar16

Hi,

I'm having some trouble getting my configs exported to a client, and the README is not 100% clear on how this should be configured (or I'm missing something obvious).
I tried a few different things, and read through the issues, PRs and the original description of the functions on bitbucket, googled stuff, but can't seem to get the configs transferred onto the client.

I defined the server first in hiera, then moved them to a .pp file in a "generic" module, and finally in its own module.
This is the (redacted) latest version of the config (although I pretty much copied and pasted everything)

in server.pp

class internal_vpn::server {
  class { 'openvpn':
    autostart_all                   => true,
    default_easyrsa_ver             => '3.0',
    easyrsa_source                  => '/usr/share/easy-rsa/',
  }

  openvpn::server {'internal_vpn':
    country => 'AU',
    province => 'Some-State',
    city => 'Some-City',
    organization => 'int-vpn.example.com',
    email => 'postmaster@example.com',
    server => '10.4.1.0 255.255.255.0',
    dev => 'tun1',
    user => 'nobody',
    group => 'nogroup',
    logfile => '/var/log/openvpn/int-vpn.example.com',
    port => '8443',
    proto => 'tcp',
    cipher => 'AES-256-GCM',
    key_cn => 'int-vpn.example.com',
    crl_auto_renew => true,
    autostart => true,
    local => '1.2.3.4',
    ssl_key_size => 4096,
    tls_server => true,
    tls_auth => true,
    custom_options => {
      key-direction => 0,
    },
  }


  openvpn::client {
    'client':
      server => 'internal_vpn',
      remote_host => 'int-vpn.example.com',
      port => '8443',
      proto => 'tcp',
      cipher => 'AES-256-GCM',
      tls_auth => true,
      custom_options => {
        key-direction => 1,
      },
  }

  openvpn::client_specific_config {
    'client':
      server => 'internal_vpn',
      redirect_gateway => false,
  }

  openvpn::deploy::export {
    'client':
      server   => 'internal_vpn',
      tls_auth => true
  }
}

The client has this in the node config:

  openvpn::deploy::client {'client':
    server => 'internal_vpn'
  }

When (on the server) I look into /etc/openvpn/internal_vpn, the configuration in download-configs are present, but client-configs only contains an empty file with the same name as the client

root@host~ # ls -l /etc/openvpn/internal_vpn/download-configs/
total 36
drwxr-xr-x. 3 root root  4096 Sep 22 13:32 client
-r--------. 1 root root 15247 Sep 22 13:32 client.ovpn
-rw-r--r--. 1 root root  9608 Sep 22 13:32 client.tar.gz
drwxr-xr-x. 2 root root  4096 Aug  1 13:36 client.tblk
root@host ~ # ls -l /etc/openvpn/internal_vpn/client-configs/
total 4
-rw-r--r--. 1 root root 1 Sep 22 13:05 client

There is absolutely nothing on the client :/

Can someone please let me know what I'm doing wrong?

Thanks in advance!

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.9.0-1stretch
  • Ruby: ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-gnu]
  • Distribution: Debian Buster
  • Module version: v8.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions