72 lines
1.8 KiB
Ruby
72 lines
1.8 KiB
Ruby
#
|
|
# Cookbook Name:: kosmos-base
|
|
# Recipe:: default
|
|
#
|
|
# Copyright 2017, Kosmos
|
|
#
|
|
# All rights reserved - Do Not Redistribute
|
|
#
|
|
|
|
include_recipe 'apt'
|
|
include_recipe 'timezone_iii'
|
|
include_recipe 'ntp'
|
|
|
|
# Update chef to the chosen version
|
|
chef_version = '14.11.21'
|
|
chef_client_updater "Install #{chef_version}" do
|
|
version chef_version
|
|
end
|
|
|
|
package 'mailutils'
|
|
package 'mosh'
|
|
|
|
# Don't create users and rewrite the sudo config in development environment.
|
|
# It breaks the vagrant user
|
|
unless node.chef_environment == "development"
|
|
# Searches data bag "users" for groups attribute "sysadmin".
|
|
# Places returned users in Unix group "sysadmin" with GID 2300.
|
|
users_manage 'sysadmin' do
|
|
group_id 2300
|
|
action [:remove, :create]
|
|
end
|
|
|
|
node.override['authorization']['sudo']['sudoers_defaults'] = [
|
|
# not default on Ubuntu, explicitely enable. Uses a minimal white list of
|
|
# environment variables
|
|
'env_reset',
|
|
# Send emails on unauthorized attempts
|
|
'mail_badpass',
|
|
'secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"',
|
|
]
|
|
include_recipe "sudo"
|
|
sudo "sysadmin" do
|
|
group "sysadmin"
|
|
nopasswd true
|
|
end
|
|
|
|
include_recipe 'kosmos-base::firewall'
|
|
|
|
include_recipe 'kosmos-postfix'
|
|
|
|
node.override['set_fqdn'] = '*'
|
|
include_recipe 'hostname'
|
|
|
|
package 'ca-certificates'
|
|
|
|
directory '/usr/local/share/ca-certificates/cacert' do
|
|
action :create
|
|
end
|
|
|
|
['http://www.cacert.org/certs/root.crt', 'http://www.cacert.org/certs/class3.crt'].each do |cert|
|
|
remote_file "/usr/local/share/ca-certificates/cacert/#{File.basename(cert)}" do
|
|
source cert
|
|
action :create_if_missing
|
|
notifies :run, 'execute[update-ca-certificates]', :immediately
|
|
end
|
|
end
|
|
|
|
execute 'update-ca-certificates' do
|
|
action :nothing
|
|
end
|
|
end
|