-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This type generates (or is supposed to) users/orgs and certificates. (The latter is still open for implementation.) Additional fixes: * Create `orgs` dir for user creation to work. * Update documentation. * Move certificates to data directory instead of using /usr. * Make `cn` optional for server certificate and use FQDN.
- Loading branch information
Showing
8 changed files
with
121 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ config_file: '/etc/taskd/config' | |
pki_vars: | ||
bits: 4096 | ||
expiration_days: 365 | ||
cn: "%{::fqdn}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
--- | ||
package_name: 'taskd' | ||
taskd_executable: '/usr/bin/taskd' | ||
pki_base_dir: '/usr/share/taskd/pki' | ||
pki_vars_file: "%{alias('pki_base_dir')}/vars" | ||
config: | ||
pid.file: '/run/taskd.pid' | ||
root: '/var/lib/taskd' | ||
server: "%{::fqdn}:53589" | ||
certificate: | ||
client: | ||
cert: "%{alias('pki_base_dir')}/client.cert.pem" | ||
key: "%{alias('pki_base_dir')}/client.key.pem" | ||
cert: "%{alias('config.root')}/client.cert.pem" | ||
key: "%{alias('config.root')}/client.key.pem" | ||
server: | ||
cert: "%{alias('pki_base_dir')}/server.cert.pem" | ||
key: "%{alias('pki_base_dir')}/server.key.pem" | ||
crl: "%{alias('pki_base_dir')}/server.crl.pem" | ||
cert: "%{alias('config.root')}/server.cert.pem" | ||
key: "%{alias('config.root')}/server.key.pem" | ||
crl: "%{alias('config.root')}/server.crl.pem" | ||
ca: | ||
cert: "%{alias('pki_base_dir')}/ca.cert.pem" | ||
cert: "%{alias('config.root')}/ca.cert.pem" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# taskd::user | ||
# | ||
# Generates a new user (certicate). | ||
# | ||
# @summary Generates a new user (certicate). | ||
# | ||
# @example | ||
# taskd::user { 'namevar': } | ||
define taskd::user( | ||
String $user = $name, | ||
String $group = $name, | ||
) { | ||
# TODO is there a better way to do this without falling back to ::params? | ||
$config = lookup('taskd::config') | ||
$taskd_executable = lookup('taskd::taskd_executable') | ||
|
||
exec { 'Create group if necessary': | ||
command => "${taskd_executable} --data ${config['root']} add org ${group}", | ||
onlyif => "/usr/bin/test ! -d ${config['root']}/orgs/${group}", | ||
} | ||
|
||
exec { 'Create user if necessary': | ||
command => "${taskd_executable} --data ${config['root']} add user ${group} ${user}", | ||
onlyif => "/bin/grep -v '^user=${user}$' -r ${config['root']}/orgs/${group}", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'spec_helper' | ||
|
||
describe 'taskd::user' do | ||
let(:title) { 'namevar' } | ||
let(:params) do | ||
{} | ||
end | ||
|
||
on_supported_os.each do |os, os_facts| | ||
context "on #{os}" do | ||
let(:facts) { os_facts } | ||
|
||
it { is_expected.to compile } | ||
end | ||
end | ||
end |