From 235fc9e45e388e11d662729a603dc445c4c3b89d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20M=E4kinen?= Date: Thu, 7 Oct 2010 20:26:49 +0300 Subject: [PATCH] Added $tftp_datadir support to tftp server and fixed SELinux contexts from it. Added tftp::client class. --- tftp/manifests/init.pp | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/tftp/manifests/init.pp b/tftp/manifests/init.pp index e4ce70b..2d62484 100644 --- a/tftp/manifests/init.pp +++ b/tftp/manifests/init.pp @@ -1,10 +1,68 @@ # Install tftp server # +# === Global variables: +# +# $tftp_datadir: +# Directory containing tftp files. +# class tftp::server { include inetd::server + if $tftp_datadir { + file { "${tftp_datadir}": + ensure => directory, + mode => 0755, + owner => root, + group => root, + seltype => "tftpdir_t", + } + file { "/srv/tftpboot": + ensure => link, + target => "${tftp_datadir}", + seltype => "tftpdir_t", + require => File["${tftp_datadir}"], + } + } else { + file { "/srv/tftpboot": + ensure => directory, + mode => 0755, + owner => root, + group => root, + seltype => "tftpdir_t", + } + } + + if $operatingsystem == "Fedora" { + file { "/var/lib/tftpboot": + ensure => link, + target => "/srv/tftpboot", + force => true, + require => File["/srv/tftpboot"], + } + } else { + file { "/tftpboot": + ensure => link, + target => "/srv/tftpboot", + force => true, + require => File["/srv/tftpboot"], + } + } + + if $selinux { + selinux::manage_fcontext { "/srv/tftpboot(/.*)?": + type => "tftpdir_t", + before => File["/srv/tftpboot"], + } + if $tftp_datadir { + selinux::manage_fcontext { "${tftp_datadir}(/.*)?": + type => "tftpdir_t", + before => File["${tftp_datadir}"], + } + } + } + package { "tftp-server": ensure => installed, } @@ -15,3 +73,14 @@ class tftp::server { } } + + +# Install tftp client tools +# +class tftp::client { + + package { "tftp": + ensure => installed, + } + +}