vpnc

package module
v0.0.0-...-fe61044 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildClientArchive

func BuildClientArchive(name string, ovpn OpenVPNServer, rsa EasyRSA, publicAddresses ...string) (string, error)

Create client archive (ZIP) whith all required files: CA, cert, key and configuration

func BuildSimpleDebian

func BuildSimpleDebian(server string, targetDir string) (EasyRSA, OpenVPNServer, error)

Create server configuration with defaults for DEBIAN systems Generates config into targetDir for specified server

Types

type ClientKeyFiles

type ClientKeyFiles struct {
	Files          KeyPair
	Name           string // Client name
	SigningRequest string // Certification sign request (optionally, for future use)
}

type EasyRSA

type EasyRSA struct {
	BinDir string // Home of easy-rsa tools
	KeyDir string // Location of key files

	KeySize      int    // Diffie-Hellman key size
	CaExpire     int    // CA expires in day
	KeyExpire    int    // Server key expires in day
	Server       string // Server name
	Province     string
	CountryCode  string
	City         string
	State        string
	Organization string
	Email        string
}

func DefaultEasyRSA

func DefaultEasyRSA(server, keyDir string) EasyRSA

Get default Easy-rsa instance

func (EasyRSA) BuildAllServerKeys

func (er EasyRSA) BuildAllServerKeys() error

Clean all and generate CA, server and Diffie-Hellman keys

func (EasyRSA) BuildClientKeys

func (er EasyRSA) BuildClientKeys(name string) (ClientKeyFiles, error)

Make a certificate/private key pair using a locally generated root certificate.

Returns list of all generated files

func (EasyRSA) BuildDH

func (er EasyRSA) BuildDH() error

Build Diffie-Hellman parameters for the server side of an SSL/TLS connection.

func (EasyRSA) BuildKeyCa

func (er EasyRSA) BuildKeyCa() error

Build a root certificate

func (EasyRSA) BuildKeyServer

func (er EasyRSA) BuildKeyServer() error

Make a certificate/private key pair using a locally generated root certificate.

Explicitly set nsCertType to server using the "server" extension in the openssl.cnf file.

func (EasyRSA) CleanAll

func (er EasyRSA) CleanAll() error

Removes all in keys directory and initialize again

func (EasyRSA) HomeDir

func (er EasyRSA) HomeDir() string

Home directory of easy-rsa tools. Returns default Debian location if not present

func (EasyRSA) KeyFiles

func (er EasyRSA) KeyFiles() KeyFiles

Generate list of all path to all generating keys

func (EasyRSA) KeysDir

func (er EasyRSA) KeysDir() string

Target directory for keys

func (EasyRSA) PkiTool

func (er EasyRSA) PkiTool() string

Path to pkitool executable

type KeyFiles

type KeyFiles struct {
	Server        KeyPair // Certificate and key for server
	CA            KeyPair // Certificate and key for CA
	DiffieHellman string  // Location of Diffie-Hellman key (typically dh2048.pem or dh1024.pen)
}

type KeyPair

type KeyPair struct {
	Certificate string // Location of certificate file
	Key         string // Location of key file
}

type OpenVPNServer

type OpenVPNServer struct {
	LocalAddr      string   // Bind to specific local address. Optional
	Addresses      []string // Public addresses of server. Required for client configuration
	Port           uint16   // Public port
	Protocol       string   // Network protocol. Could be tcp or udp
	Keys           KeyFiles // Keys files generated by easy-rsa: CA, server.key and e.t.c.
	PersistIPFile  string   // List of clients and their static ips. Optional
	TlsKey         string   // Location of TLS key. Automatically sets after BuildTLSKey(). If set, server and clients config will use TLS
	ClientToClient bool     // Enable client to client communication
}

func OpenServerConf

func OpenServerConf(serverConf string) (OpenVPNServer, error)

Read necessary parameters from OpenSSL server configuration file

func (OpenVPNServer) AddStaticIP

func (ovpn OpenVPNServer) AddStaticIP(client string, ip string) error

Append static ip for client to PersistIPFile. It doesn't check unique (use ListStaticIP before)

func (OpenVPNServer) BaseCACertFile

func (ovpn OpenVPNServer) BaseCACertFile() string

Base file name of CA certificate

func (OpenVPNServer) BaseTLSKeyFile

func (ovpn OpenVPNServer) BaseTLSKeyFile() string

Base file name of TLS key

func (OpenVPNServer) BuildClientConf

func (ovpn OpenVPNServer) BuildClientConf(targetDir string, clientCert, clientKey string) error

Create client configuration based on easy-rsa keys. It copies (really it links) all required files into targetDir and creates client.conf

func (*OpenVPNServer) BuildTLSKey

func (ovpn *OpenVPNServer) BuildTLSKey(keysDir string) error

Create TLS key into keysDir as ta.key file and sets TlsKey property. This enables TLS connection for server and future clients

func (OpenVPNServer) CheckRequiredFields

func (ovpn OpenVPNServer) CheckRequiredFields() error

Check required parameters like port, protocol and others

func (OpenVPNServer) InitialConfig

func (ovpn OpenVPNServer) InitialConfig(targetDir string) error

Create initial server configuration file into targetDir

func (OpenVPNServer) ListStaticIP

func (ovpn OpenVPNServer) ListStaticIP() (map[string]string, error)

Read and parse PersistIPFile - list of client and static ip pairs

func (OpenVPNServer) RemoveStaticIP

func (ovpn OpenVPNServer) RemoveStaticIP(client string) error

Read, parse, exclude client and save PersistIPFile

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL