From a3027bd256133a739dc5ea6002349fdf61cd6e67 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 22 Oct 2010 23:02:56 +0200 Subject: add xinetd based service --- files/xinetd.d/git | 16 +++++++++++++++ files/xinetd.d/git.disabled | 16 +++++++++++++++ files/xinetd.d/git.vhosts | 16 +++++++++++++++ manifests/daemon.pp | 49 ++++++++++++++++++++++++++++++++++++--------- manifests/daemon/vhosts.pp | 14 ++++++++++--- 5 files changed, 99 insertions(+), 12 deletions(-) create mode 100644 files/xinetd.d/git create mode 100644 files/xinetd.d/git.disabled create mode 100644 files/xinetd.d/git.vhosts diff --git a/files/xinetd.d/git b/files/xinetd.d/git new file mode 100644 index 0000000..64c53e8 --- /dev/null +++ b/files/xinetd.d/git @@ -0,0 +1,16 @@ +# default: off +# description: The git dæmon allows git repositories to be exported using +# the git:// protocol. + +service git +{ + disable = no + socket_type = stream + wait = no + user = nobody + server = /usr/bin/git-daemon + server_args = --base-path=/srv/git --export-all --user-path=public_git --syslog --inetd --verbose + log_on_failure += USERID +# xinetd doesn't do this by default. bug #195265 + flags = IPv6 +} diff --git a/files/xinetd.d/git.disabled b/files/xinetd.d/git.disabled new file mode 100644 index 0000000..dcfae91 --- /dev/null +++ b/files/xinetd.d/git.disabled @@ -0,0 +1,16 @@ +# default: off +# description: The git dæmon allows git repositories to be exported using +# the git:// protocol. + +service git +{ + disable = yes + socket_type = stream + wait = no + user = nobody + server = /usr/bin/git-daemon + server_args = --base-path=/srv/git --export-all --user-path=public_git --syslog --inetd --verbose + log_on_failure += USERID +# xinetd doesn't do this by default. bug #195265 + flags = IPv6 +} diff --git a/files/xinetd.d/git.vhosts b/files/xinetd.d/git.vhosts new file mode 100644 index 0000000..9893820 --- /dev/null +++ b/files/xinetd.d/git.vhosts @@ -0,0 +1,16 @@ +# default: off +# description: The git dæmon allows git repositories to be exported using +# the git:// protocol. + +service git +{ + disable = no + socket_type = stream + wait = no + user = nobody + server = /usr/bin/git-daemon + server_args = --interpolated-path=/srv/git/%H/%D --syslog --inetd --verbose + log_on_failure += USERID +# xinetd doesn't do this by default. bug #195265 + flags = IPv6 +} diff --git a/manifests/daemon.pp b/manifests/daemon.pp index 36c1302..c7df2af 100644 --- a/manifests/daemon.pp +++ b/manifests/daemon.pp @@ -5,25 +5,56 @@ class git::daemon { require => Package['git'], } + include xinetd + file{'/etc/xinetd.d/git': + require => Package['git-daemon','xinetd'], + notify => Service[xinetd], + owner => root, group => 0, mode => 0755; + } file{'/etc/init.d/git-daemon': + require => Package['git-daemon'], + owner => root, group => 0, mode => 0755; + } + file{'/etc/sysconfig/git-daemon': + require => Package['git-daemon'], + owner => root, group => 0, mode => 0644; + } + service{'git-daemon': + hasstatus => true, + } + if $git_daemon == 'service' { + File['/etc/xinet.d/git']{ + source => "puppet:///modules/git/xinetd.d/git.disabled" + } + File['/etc/init.d/git-daemon']{ source => [ "puppet:///modules/site-git/init.d/${fqdn}/git-daemon", "puppet:///modules/site-git/init.d/git-daemon", "puppet:///modules/git/init.d/git-daemon" ], - require => Package['git-daemon'], - owner => root, group => 0, mode => 0755; - } - file{'/etc/sysconfig/git-daemon': + } + File['/etc/sysconfig/git-daemon']{ source => [ "puppet:///modules/site-git/sysconfig/${fqdn}/git-daemon", "puppet:///modules/site-git/sysconfig/git-daemon", "puppet:///modules/git/sysconfig/git-daemon" ], - require => Package['git-daemon'], - owner => root, group => 0, mode => 0644; - } - service{'git-daemon': + } + Service['git-daemon']{ ensure => running, enable => true, - hasstatus => true, require => [ File['/etc/sysconfig/git-daemon'], File['/etc/init.d/git-daemon'] ], + } + } else { + File['/etc/xinetd.d/git']{ + source => [ "puppet:///modules/site-git/xinetd.d/${fqdn}/git", + "puppet:///modules/site-git/xinetd.d/git", + "puppet:///modules/git/xinetd.d/git" ], + } + Service['git-daemon']{ + ensure => stopped, + enable => false, + before => [ File['/etc/sysconfig/git-daemon'], File['/etc/init.d/git-daemon'] ], + } + File['/etc/init.d/git-daemon','/etc/sysconfig/git-daemon']{ + ensure => absent, + } } if $use_shorewall { diff --git a/manifests/daemon/vhosts.pp b/manifests/daemon/vhosts.pp index 3777fa1..8dd238d 100644 --- a/manifests/daemon/vhosts.pp +++ b/manifests/daemon/vhosts.pp @@ -1,7 +1,15 @@ class git::daemon::vhosts inherits git::daemon { + if $git_daemon == 'service' { File['/etc/sysconfig/git-daemon']{ - source => [ "puppet:///modules/site-git/sysconfig/${fqdn}/git-daemon.vhosts", - "puppet:///modules/site-git/sysconfig/git-daemon.vhosts", - "puppet:///modules/git/sysconfig/git-daemon.vhosts" ], + source => [ "puppet:///modules/site-git/sysconfig/${fqdn}/git-daemon.vhosts", + "puppet:///modules/site-git/sysconfig/git-daemon.vhosts", + "puppet:///modules/git/sysconfig/git-daemon.vhosts" ], } + } else { + File['/etc/xinetd.d/git']{ + source => [ "puppet:///modules/site-git/xinetd.d/${fqdn}/git.vhosts", + "puppet:///modules/site-git/xinetd.d/git.vhosts", + "puppet:///modules/git/xinetd.d/git.vhosts" ], + } + } } -- cgit v1.2.3