-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from jlambert121/remove_users
cleanup unused users, root pw, ohshit user
- Loading branch information
Showing
4 changed files
with
96 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
fixtures: | ||
repositories: | ||
beaver: git://github.com/evenup/evenup-beaver.git | ||
concat: git://github.com/ripienaar/puppet-concat.git | ||
account: https://github.com/torrancew/puppet-account.git | ||
beaver: https://github.com/evenup/evenup-beaver.git | ||
concat: https://github.com/ripienaar/puppet-concat.git | ||
symlinks: | ||
common: "#{source_dir}" | ||
|
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,59 @@ | ||
# Moved to their own class to set stage | ||
class common::users ( | ||
$root_pw = undef, | ||
$ohshit_pw = undef, | ||
$ohshit_key = undef, | ||
){ | ||
|
||
if $root_pw { | ||
account { 'root': | ||
home_dir => '/root', | ||
password => $root_pw, | ||
} | ||
} | ||
|
||
if $ohshit_pw { | ||
account { 'ohshit': | ||
ensure => 'present', | ||
comment => 'Emergency Backup User', | ||
uid => '999', | ||
create_group => true, | ||
groups => [ 'wheel' ], | ||
password => $ohshit_pw, | ||
home_dir => '/home/.ohshit', | ||
shell => '/bin/bash', | ||
manage_home => true, | ||
ssh_key => $ohshit_key, | ||
} | ||
} | ||
|
||
# Clean users/groups Easiest way to make sure users before groups, just chain them | ||
user { 'bin': ensure => 'absent'} -> | ||
user { 'games': ensure => 'absent'} -> | ||
user { 'gopher': ensure => 'absent'} -> | ||
user { 'uucp': ensure => 'absent'} -> | ||
user { 'adm': ensure => 'absent'} -> | ||
user { 'lp': ensure => 'absent'} -> | ||
user { 'shutdown': ensure => 'absent'} -> | ||
user { 'halt': ensure => 'absent'} -> | ||
user { 'mail': ensure => 'absent'} -> | ||
user { 'sync': ensure => 'absent'} -> | ||
user { 'ftp': ensure => 'absent'} -> | ||
user { 'vcsa': ensure => 'absent'} -> | ||
group { 'adm': ensure => 'absent'} -> | ||
group { 'lp': ensure => 'absent'} -> | ||
group { 'news': ensure => 'absent'} -> | ||
group { 'uucp': ensure => 'absent'} -> | ||
group { 'games': ensure => 'absent'} -> | ||
group { 'dip': ensure => 'absent'} -> | ||
group { 'popusers': ensure => 'absent'} -> | ||
group { 'video': ensure => 'absent'} -> | ||
group { 'ftp': ensure => 'absent'} -> | ||
group { 'audio': ensure => 'absent'} -> | ||
group { 'floppy': ensure => 'absent'} -> | ||
group { 'vcsa': ensure => 'absent'} -> | ||
group { 'cdrom': ensure => 'absent'} -> | ||
group { 'tape': ensure => 'absent'} -> | ||
group { 'dialout': ensure => 'absent'} | ||
|
||
} |
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,32 @@ | ||
require 'spec_helper' | ||
|
||
describe 'common::users', :type => :class do | ||
let(:facts) { { :concat_basedir => '/var/lib/puppet/concat' } } | ||
|
||
describe "no parameters" do | ||
it { should create_class('common::users') } | ||
it { should_not contain_account('root') } | ||
it { should_not contain_account('ohshit') } | ||
|
||
# just make sure one works | ||
it { should contain_user('bin').with_ensure('absent') } | ||
it { should contain_group('adm').with_ensure('absent') } | ||
end | ||
|
||
describe 'root_pw' do | ||
let(:params) { { :root_pw => 'asdf' } } | ||
it { should contain_account('root').with_password('asdf') } | ||
it { should_not contain_account('ohshit') } | ||
end | ||
|
||
describe 'ohshit_pw' do | ||
let(:params) { { :ohshit_pw => 'asdf' } } | ||
it { should contain_account('ohshit').with_password('asdf').with_key(nil) } | ||
|
||
describe 'ohshit_key' do | ||
let(:params) { { :ohshit_pw => 'asdf', :ohshit_key => 'biglongstring' } } | ||
it { should contain_account('ohshit').with_password('asdf').with_ssh_key('biglongstring') } | ||
end | ||
end | ||
|
||
end |