Skip to content

Instantly share code, notes, and snippets.

@gonzopancho
Created March 28, 2015 16:32
Show Gist options
  • Save gonzopancho/cbacd6ecf13305f99782 to your computer and use it in GitHub Desktop.
Save gonzopancho/cbacd6ecf13305f99782 to your computer and use it in GitHub Desktop.
OpenVPN saltstack
---
# OpenVPN -- secure connection with the internet
openvpn-rc:
file.managed:
- name: /etc/rc.conf.d/openvpn
- source: salt://openvpn/files/openvpn_rc.conf
- template: jinja
openvpn:
pkg:
- installed
service.running:
- require:
- file: openvpn-rc
# Directories
/usr/local/etc/openvpn:
file.directory:
- user: root
- mode: 700
/usr/local/etc/openvpn/private:
file.directory:
- user: root
- mode: 500
- require:
- file: /usr/local/etc/openvpn
# Configuration
/usr/local/etc/openvpn/server.conf:
file.managed:
- source: salt://openvpn/files/server.conf
- mode: 400
- template: jinja
- require:
- file: /usr/local/etc/openvpn
# Certificates
/usr/local/etc/openvpn/ca.crt:
file.managed:
- source: salt://openvpn/files/keys/ca.crt
- require:
- file: /usr/local/etc/openvpn
/usr/local/etc/openvpn/dh2048.pem:
file.managed:
- source: salt://openvpn/files/keys/dh2048.pem
- require:
- file: /usr/local/etc/openvpn
/usr/local/etc/openvpn/ta.key:
file.managed:
- source: salt://openvpn/files/keys/ta.key
- require:
- file: /usr/local/etc/openvpn
# Public key
/usr/local/etc/openvpn/alpha.netgate.org.crt:
file.managed:
- source: salt://openvpn/files/keys/alpha.netgate.org.crt
- require:
- file: /usr/local/etc/openvpn
# Private key
/usr/local/etc/openvpn/private/alpha.netgate.org.key:
file.managed:
- source: salt://openvpn/files/keys/alpha.netgate.org.key
- mode: 400
- require:
- file: /usr/local/etc/openvpn/private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment