full commit

This commit is contained in:
Arne Teuke
2025-04-22 15:58:46 +02:00
parent 35a641a70b
commit 3a0fd39423
12 changed files with 601 additions and 76 deletions

8
manifests/init.pp Normal file
View File

@@ -0,0 +1,8 @@
## ssh_cd::init.pp
# Module name: ssh_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class initializes the ssh_cd module
##############################################################################
class ssh_cd::init {
include ssh_cd::params
}

9
manifests/main/config.pp Normal file
View File

@@ -0,0 +1,9 @@
## ssh_cd::main::config.pp
# Module name: ssh_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages module logic
##############################################################################
class ssh_cd::main::config (
) inherits ssh_cd::params {
include ssh_cd::main::service
}

21
manifests/main/dirs.pp Normal file
View File

@@ -0,0 +1,21 @@
## ssh_cd::main::dirs.pp
# Module name: ssh_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages directories
##############################################################################
class ssh_cd::main::dirs (
) inherits ssh_cd::params {
require ssh_cd::main::install
file { $ssh_etc_path:
ensure => directory,
path => $ssh_etc_path,
owner => $sshd_user,
group => $sshd_user,
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
}
}

22
manifests/main/files.pp Normal file
View File

@@ -0,0 +1,22 @@
## ssh_cd::main::files.pp
# Module name: ssh_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages files
##############################################################################
class ssh_cd::main::files (
) inherits ssh_cd::params {
require ssh_cd::main::dirs
file { $sshd_config_path:
ensure => file,
path => $sshd_config_path,
owner => 'root',
group => 'root',
mode => '0640',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template($sshd_config_erb),
}
}

11
manifests/main/install.pp Normal file
View File

@@ -0,0 +1,11 @@
## ssh_cd::main::install.pp
# Module name: ssh_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages installation
##############################################################################
class ssh_cd::main::install (
) inherits ssh_cd::params {
package { $reqpackages:
ensure => $pkg_ensure,
}
}

16
manifests/main/service.pp Normal file
View File

@@ -0,0 +1,16 @@
## ssh_cd::main::service.pp
# Module name: ssh_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages service settings
##############################################################################
class ssh_cd::main::service (
) inherits ssh_cd::params {
require ssh_cd::main::files
service { $sshd_service:
ensure => running,
hasstatus => true,
hasrestart => true,
enable => true,
}
}

25
manifests/params.pp Normal file
View File

@@ -0,0 +1,25 @@
## ssh_cd::params.pp
# Module name: ssh_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class contains all class parameters for ssh_cd
# @param [array] reqpackages packages to install
# @param [string] pkg_ensure version to install: 'present' or 'latest'
# @param [string] sshd_user the name of the daemon user
# @param [string] ssh_etc_path the directory path
# @param [string] sshd_service the name of the daemon
##############################################################################
class ssh_cd::params (
Array $reqpackages = ['openssh','openssh-clients','openssh-server'],
String $pkg_ensure = 'latest',
) {
$sshd_user = 'root'
$ssh_etc_path = '/etc/ssh'
$sshd_service = 'sshd'
$sshd_config_path = "${ssh_etc_path}/sshd_config"
$sshd_config_erb = 'ssh_cd/ssh_config.erb'
# includes must be last
include ssh_cd::main::config
}