-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TLS and x509-name verification support #118
Changes from all commits
b189c07
ad1456e
64d7bf0
882f701
a7c78a0
130cab5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,8 @@ | |
it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^verb\s+3$/)} | ||
it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^mute\s+20$/)} | ||
it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^auth-retry\s+none$/)} | ||
|
||
it { should_not contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^tls-client$/)} | ||
it { should_not contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^verify-x509-name\s+"test_server"\s+name$/)} | ||
it { should_not contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^sndbuf/)} | ||
it { should_not contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^rcvbuf/)} | ||
end | ||
|
@@ -82,8 +83,10 @@ | |
'verb' => '1', | ||
'setenv' => {'CLIENT_CERT' => '0'}, | ||
'setenv_safe' => {'FORWARD_COMPATIBLE' => '1'}, | ||
'sndbuf' => 393216, | ||
'rcvbuf' => 393215, | ||
'tls_auth' => true, | ||
'x509_name' => 'test_server', | ||
'sndbuf' => 393216, | ||
'rcvbuf' => 393215, | ||
} } | ||
let(:facts) { { | ||
:fqdn => 'somehost', | ||
|
@@ -108,6 +111,8 @@ | |
it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^setenv\s+CLIENT_CERT\s+0$/)} | ||
it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^setenv_safe\s+FORWARD_COMPATIBLE\s+1$/)} | ||
it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^cipher\s+BF-CBC$/)} | ||
it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^tls-client$/)} | ||
it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^verify-x509-name\s+"test_server"\s+name$/)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add some reverse tests? So that it does not appear in the config if the parameter has not been specified? |
||
it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^sndbuf\s+393216$/)} | ||
it { should contain_file('/etc/openvpn/test_server/download-configs/test_client/test_client.conf').with_content(/^rcvbuf\s+393215$/)} | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,8 @@ | |
it { should_not contain_file('/etc/openvpn/test_server.conf').with_content(/persist-tun/) } | ||
it { should_not contain_file('/etc/openvpn/test_server.conf').with_content(%r{^duplicate-cn$}) } | ||
it { should_not contain_file('/etc/openvpn/test_server.conf').with_content(/^ns-cert-type server/) } | ||
it { should_not contain_file('/etc/openvpn/test_server.conf').with_content(%r{^tls-auth\s+/etc/openvpn/test_server/keys/ta.key\s+0$}) } | ||
|
||
end | ||
|
||
context "creating a server setting all parameters" do | ||
|
@@ -143,6 +145,8 @@ | |
'persist_key' => true, | ||
'persist_tun' => true, | ||
'duplicate_cn' => true, | ||
'tls_auth' => true, | ||
'tls_server' => true, | ||
} } | ||
|
||
let(:facts) { { | ||
|
@@ -189,6 +193,8 @@ | |
it { should contain_file('/etc/openvpn/test_server.conf').with_content(%r{^down "/tmp/down"$}) } | ||
it { should contain_file('/etc/openvpn/test_server.conf').with_content(%r{^script-security 2$}) } | ||
it { should contain_file('/etc/openvpn/test_server.conf').with_content(%r{^duplicate-cn$}) } | ||
it { should contain_file('/etc/openvpn/test_server.conf').with_content(%r{^tls-server$}) } | ||
it { should contain_file('/etc/openvpn/test_server.conf').with_content(%r{^tls-auth\s+/etc/openvpn/test_server/keys/ta.key\s+0$}) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add some reverse tests? So that it does not appear in the config if the parameter has not been specified? |
||
|
||
it { should_not contain_file('/etc/openvpn/test_server.conf').with_content(/^server-poll-timeout/) } | ||
it { should_not contain_file('/etc/openvpn/test_server.conf').with_content(/^ping-timer-rem/) } | ||
|
@@ -209,7 +215,8 @@ | |
:key_expire => 365, | ||
:key_cn => 'yolo', | ||
:key_name => 'burp', | ||
:key_ou => 'NSA') | ||
:key_ou => 'NSA', | ||
:tls_auth => true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a trailing comma so we have less changes next time. |
||
} | ||
|
||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please specify the dependency on the other side (
Exec["tar the thing ${server} with ${name}"]
) withrequire
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I do this I have to copy the whole code since this file is only required as long as tls_auth is true, otherwise it is not required. Or do you have any other suggestion how to solve that nicely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right... My bad.