aboutsummaryrefslogtreecommitdiff
path: root/net/foreman-proxy
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2014-01-29 11:46:59 +0000
committerMartin Matuska <mm@FreeBSD.org>2014-01-29 11:46:59 +0000
commit1b7d97b18415edf3a426d3c58af6f708faa94e91 (patch)
tree02f34a8c4f2dd5ddd93d306df44e1fc01e0f27c9 /net/foreman-proxy
parent8ab604e284c962a7f53a1a260372b513c1d7ce32 (diff)
downloadports-1b7d97b18415edf3a426d3c58af6f708faa94e91.tar.gz
ports-1b7d97b18415edf3a426d3c58af6f708faa94e91.zip
Notes
Diffstat (limited to 'net/foreman-proxy')
-rw-r--r--net/foreman-proxy/Makefile91
-rw-r--r--net/foreman-proxy/distinfo2
-rw-r--r--net/foreman-proxy/files/foreman-proxy.in28
-rw-r--r--net/foreman-proxy/files/patch-config-settings.yml.example90
-rw-r--r--net/foreman-proxy/files/patch-lib-proxy-tftp.rb11
-rw-r--r--net/foreman-proxy/files/patch-lib-sinatra-patch.rb11
-rw-r--r--net/foreman-proxy/files/pkg-install.in19
-rw-r--r--net/foreman-proxy/pkg-descr17
-rw-r--r--net/foreman-proxy/pkg-plist90
9 files changed, 359 insertions, 0 deletions
diff --git a/net/foreman-proxy/Makefile b/net/foreman-proxy/Makefile
new file mode 100644
index 000000000000..d006ec7c424d
--- /dev/null
+++ b/net/foreman-proxy/Makefile
@@ -0,0 +1,91 @@
+# Created by: Martin Matuska <mm@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME= foreman-proxy
+DISTVERSION= 1.4.0-RC2
+CATEGORIES= net
+MASTER_SITES= GH
+
+MAINTAINER= mm@FreeBSD.org
+COMMENT= Foreman Smart Proxy
+
+LICENSE= GPLv3
+
+RUN_DEPENDS= rubygem-sinatra>=1.4.3:${PORTSDIR}/www/rubygem-sinatra \
+ rubygem-json>=1.8.1:${PORTSDIR}/devel/rubygem-json
+
+OPTIONS_DEFINE= BMC PUPPET
+BMC_DESC= Depend on rubyipmi for BMC support
+PUPPET_DESC= Depend on Puppet
+
+USE_GITHUB= yes
+GH_ACCOUNT= theforeman
+GH_PROJECT= smart-proxy
+GH_COMMIT= 255c9bf
+USE_RUBY= yes
+USE_RAKE= yes
+USE_RC_SUBR= foreman-proxy
+NO_BUILD= yes
+PKGINSTALL= ${WRKDIR}/pkg-install
+
+FOREMAN_PROXY_USER?= foreman_proxy
+FOREMAN_PROXY_GROUP?= foreman_proxy
+FOREMAN_PROXY_LOGDIR?= /var/log/foreman-proxy
+FOREMAN_PROXY_RUNDIR?= /var/run/foreman-proxy
+
+USERS= ${FOREMAN_PROXY_USER}
+GROUPS= ${FOREMAN_PROXY_GROUP}
+
+SUB_FILES+= pkg-install
+SUB_LIST+= RUBY="${RUBY}" \
+ FOREMAN_PROXY_USER="${FOREMAN_PROXY_USER}" \
+ FOREMAN_PROXY_GROUP="${FOREMAN_PROXY_GROUP}" \
+ FOREMAN_PROXY_RUNDIR="${FOREMAN_PROXY_RUNDIR}" \
+ FOREMAN_PROXY_LOGDIR="${FOREMAN_PROXY_LOGDIR}"
+
+PLIST_SUB+= ${SUB_LIST} \
+ MKDIR="${MKDIR}"
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MBMC}
+RUN_DEPENDS+= rubygem-rubyipmi>=0.7:${PORTSDIR}/sysutils/rubygem-rubyipmi
+.endif
+
+.if ${PORT_OPTIONS:MPUPPET}
+RUN_DEPENDS+= puppet:${PORTSDIR}/sysutils/puppet
+.endif
+
+.include <bsd.port.pre.mk>
+
+post-patch:
+ @${REINPLACE_CMD} \
+ -e "s|/usr/bin/env ruby|${RUBY}|g" \
+ -e "s|#{File.dirname(__FILE__)}/..|${DATADIR}|g" \
+ ${WRKSRC}/bin/smart-proxy
+ @${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" \
+ -e "s|%%LOCALBASE%%|${LOCALBASE}|g" \
+ ${WRKSRC}/config/settings.yml.example
+
+do-install:
+ @${MKDIR} ${STAGEDIR}${PREFIX}/etc/foreman-proxy
+ @${MKDIR} ${STAGEDIR}${DATADIR}
+ @${LN} -s ${PREFIX}/etc/foreman-proxy ${STAGEDIR}${DATADIR}/config
+ @${INSTALL_SCRIPT} ${WRKSRC}/bin/smart-proxy \
+ ${STAGEDIR}${PREFIX}/sbin/smart-proxy
+.for file in Rakefile config.ru lib public views
+ @${CP} -r ${WRKSRC}/${file} ${STAGEDIR}${DATADIR}
+.endfor
+ @${INSTALL_DATA} ${WRKSRC}/config/settings.yml.example \
+ ${STAGEDIR}${PREFIX}/etc/foreman-proxy/settings.yml.sample
+.if !exists(${STAGEDIR}${PREFIX}/etc/foreman-proxy/settings.yml)
+ @${INSTALL_DATA} ${WRKSRC}/config/settings.yml.example \
+ ${STAGEDIR}${PREFIX}/etc/foreman-proxy/settings.yml
+.endif
+
+post-install:
+ @${MKDIR} -m 0700 ${STAGEDIR}${FOREMAN_PROXY_LOGDIR} \
+ ${STAGEDIR}${FOREMAN_PROXY_RUNDIR}
+ @${SH} ${PKGINSTALL} STAGEDIR=${STAGEDIR}
+
+.include <bsd.port.post.mk>
diff --git a/net/foreman-proxy/distinfo b/net/foreman-proxy/distinfo
new file mode 100644
index 000000000000..ecf184f9cdf1
--- /dev/null
+++ b/net/foreman-proxy/distinfo
@@ -0,0 +1,2 @@
+SHA256 (foreman-proxy-1.4.0-RC2.tar.gz) = bbe0f3be114b8fb406e79fdd845690ad69d83915ccd1513fbc3deb71b894343a
+SIZE (foreman-proxy-1.4.0-RC2.tar.gz) = 84992
diff --git a/net/foreman-proxy/files/foreman-proxy.in b/net/foreman-proxy/files/foreman-proxy.in
new file mode 100644
index 000000000000..2d922ece1296
--- /dev/null
+++ b/net/foreman-proxy/files/foreman-proxy.in
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# PROVIDE: foreman-proxy
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable foreman-proxy:
+# foreman_proxy_enable (bool): Set to "NO" by default
+# Set it to "YES" to enable nsca.
+. /etc/rc.subr
+
+name="foreman_proxy"
+rcvar="foreman_proxy_enable"
+
+command="%%PREFIX%%/sbin/smart-proxy"
+command_interpreter="%%RUBY%%"
+pidfile="%%FOREMAN_PROXY_RUNDIR%%/foreman-proxy.pid"
+
+foreman_proxy_enable=${foreman_proxy_enable:-"NO"}
+foreman_proxy_user=${foreman_proxy_user-"%%FOREMAN_PROXY_USER%%"}
+
+load_rc_config "${name}"
+
+required_files="%%PREFIX%%/etc/foreman-proxy/settings.yml"
+
+run_rc_command "$1"
diff --git a/net/foreman-proxy/files/patch-config-settings.yml.example b/net/foreman-proxy/files/patch-config-settings.yml.example
new file mode 100644
index 000000000000..e9b945cc6987
--- /dev/null
+++ b/net/foreman-proxy/files/patch-config-settings.yml.example
@@ -0,0 +1,90 @@
+--- config/settings.yml.example.orig 2014-01-28 19:55:58.769179974 +0100
++++ config/settings.yml.example 2014-01-28 20:06:51.840135157 +0100
+@@ -23,7 +23,7 @@
+
+ # Enable TFTP management
+ :tftp: false
+-:tftproot: /var/lib/tftpboot
++:tftproot: /tftpboot
+ # Defines the TFTP Servername to use, overrides the name in the subnet declaration
+ #:tftp_servername: tftp.domain.com
+
+@@ -35,14 +35,14 @@
+ # nsupdate_gss (for GSS-TSIG support)
+ # virsh (simple implementation for libvirt)
+ :dns_provider: nsupdate
+-#:dns_key: /etc/rndc.key
++#:dns_key: /usr/local/etc/namedb/rndc.key
+ # use this setting if you are managing a dns server which is not localhost though this proxy
+ #:dns_server: dns.domain.com
+ # use this setting if you want to override default TTL setting (86400)
+ #:dns_ttl: 86400
+ # use dns_tsig_* for GSS-TSIG updates using Kerberos. Required for Windows MS DNS with
+ # Secure Dynamic Updates, or BIND as used in FreeIPA. Set dns_provider to nsupdate_gss.
+-#:dns_tsig_keytab: /usr/share/foreman-proxy/dns.keytab
++#:dns_tsig_keytab: /usr/local/share/foreman-proxy/dns.keytab
+ #:dns_tsig_principal: DNS/host.example.com@EXAMPLE.COM
+
+ # Enable DHCP management
+@@ -55,15 +55,8 @@
+ # dhcp_subnets is a Native MS implementation setting. It restricts the subnets queried to a
+ # subset, so as to reduce the query time.
+ #:dhcp_subnets: [192.168.205.0/255.255.255.128, 192.168.205.128/255.255.255.128]
+-# Settings for Ubuntu ISC
+-#:dhcp_config: /etc/dhcp3/dhcpd.conf
+-#:dhcp_leases: /var/lib/dhcp3/dhcpd.leases
+-# Settings for Redhat ISC
+-# Redhat 5
+-#:dhcp_config: /etc/dhcpd.conf
+-# Redhat 6
+-#:dhcp_config: /etc/dhcp/dhcpd.conf
+-#:dhcp_leases: /var/lib/dhcpd/dhcpd.leases
++#:dhcp_config: %%LOCALBASE%%/etc/dhcpd.conf
++#:dhcp_leases: /var/db/dhcpd.leases
+ #:dhcp_key_name: secret_key_name
+ #:dhcp_key_secret: secret_key
+
+@@ -72,8 +65,8 @@
+
+ # enable PuppetCA management
+ :puppetca: false
+-#:ssldir: /var/lib/puppet/ssl
+-#:puppetdir: /etc/puppet
++#:ssldir: /var/puppet/ssl
++#:puppetdir: %%LOCALBASE%%/etc/puppet
+
+ # enable Puppet management
+ :puppet: false
+@@ -87,19 +80,19 @@
+
+ # customrun command details
+ # Set :customrun_cmd to the full path of the script you want to run, instead of /bin/false
+-:customrun_cmd: /bin/false
++:customrun_cmd: /usr/bin/false
+ # Set :customrun_args to any args you want to pass to your custom script. The hostname of the
+ # system to run against will be appended after the custom commands.
+ :customrun_args: -ay -f -s
+
+-:puppet_conf: /etc/puppet/puppet.conf
++:puppet_conf: %%LOCALBASE%%/etc/puppet/puppet.conf
+ # whether to use sudo before the ssh command
+ :puppetssh_sudo: false
+ # the command which will be sent to the host
+-:puppetssh_command: /usr/bin/puppet agent --onetime --no-usecacheonfailure
++:puppetssh_command: %%LOCALBASE%%/bin/puppet agent --onetime --no-usecacheonfailure
+ # With which user should the proxy connect
+ #:puppetssh_user: root
+-#:puppetssh_keyfile: /etc/foreman-proxy/id_rsa
++#:puppetssh_keyfile: %%PREFIX%%/etc/foreman-proxy/id_rsa
+
+ # Which user to invoke sudo as to run puppet commands
+ #:puppet_user: root
+@@ -111,7 +104,7 @@
+ # smart-proxy client node needs to have some admin right on chef-server
+ # in order to retrive all nodes public keys
+ # :chef_smartproxy_clientname: 'host.example.net'
+-# :chef_smartproxy_privatekey: '/etc/chef/client.pem'
++# :chef_smartproxy_privatekey: '%%LOCALBASE%%/etc/chef/client.pem'
+
+ # enable BMC management (Bare metal power and bios controls)
+ # Available providers:
diff --git a/net/foreman-proxy/files/patch-lib-proxy-tftp.rb b/net/foreman-proxy/files/patch-lib-proxy-tftp.rb
new file mode 100644
index 000000000000..6a66c6564980
--- /dev/null
+++ b/net/foreman-proxy/files/patch-lib-proxy-tftp.rb
@@ -0,0 +1,11 @@
+--- lib/proxy/tftp.rb.orig 2014-01-29 00:26:35.629061321 +0100
++++ lib/proxy/tftp.rb 2014-01-29 00:28:05.669054835 +0100
+@@ -104,7 +104,7 @@
+ # as the dst might contain another sub directory
+ FileUtils.mkdir_p destination.parent
+
+- cmd = "wget --timeout=10 --tries=3 --no-check-certificate -nv -c #{src} -O \"#{destination}\""
++ cmd = "/usr/bin/fetch --timeout=10 -a --no-verify-hostname --no-verify-peer -a -m -o \"#{destination}\" #{src}"
+ Proxy::Util::CommandTask.new(cmd)
+ end
+ end
diff --git a/net/foreman-proxy/files/patch-lib-sinatra-patch.rb b/net/foreman-proxy/files/patch-lib-sinatra-patch.rb
new file mode 100644
index 000000000000..930cc88e91e7
--- /dev/null
+++ b/net/foreman-proxy/files/patch-lib-sinatra-patch.rb
@@ -0,0 +1,11 @@
+--- lib/sinatra-patch.rb.orig 2014-01-29 12:16:04.574127338 +0100
++++ lib/sinatra-patch.rb 2014-01-29 12:17:34.113121100 +0100
+@@ -17,7 +17,7 @@
+
+ puts "Starting Foreman Proxy on #{port} using #{handler_name}" unless handler_name =~/cgi/i
+
+- FileUtils.mkdir_p(File.join(APP_ROOT, 'tmp/pids'))
++ # FileUtils.mkdir_p(File.join(APP_ROOT, 'tmp/pids'))
+
+ # Create the PID's parent directory if it doesn't exist yet.
+ if SETTINGS.daemon
diff --git a/net/foreman-proxy/files/pkg-install.in b/net/foreman-proxy/files/pkg-install.in
new file mode 100644
index 000000000000..565bf8d40af8
--- /dev/null
+++ b/net/foreman-proxy/files/pkg-install.in
@@ -0,0 +1,19 @@
+#!/bin/sh
+# $FreeBSD$
+
+if [ "$2" != "POST-INSTALL" ]; then
+ exit 0
+fi
+
+USER=%%FOREMAN_PROXY_USER%%
+GROUP=%%FOREMAN_PROXY_GROUP%%
+LOGDIR=%%FOREMAN_PROXY_LOGDIR%%
+RUNDIR=%%FOREMAN_PROXY_RUNDIR%%
+
+echo "===> Changing owner and modes for \"${LOGDIR}\"."
+chown -R ${USER}:${GROUP} ${STAGEDIR}${LOGDIR}
+chmod -R go= ${STAGEDIR}${LOGDIR}
+
+echo "===> Changing owner and modes for \"${RUNDIR}\"."
+chown -R ${USER}:${GROUP} ${STAGEDIR}${RUNDIR}
+chmod -R go= ${STAGEDIR}${RUNDIR}
diff --git a/net/foreman-proxy/pkg-descr b/net/foreman-proxy/pkg-descr
new file mode 100644
index 000000000000..d9e27d4a1945
--- /dev/null
+++ b/net/foreman-proxy/pkg-descr
@@ -0,0 +1,17 @@
+The Foreman Smart Proxy is a project which provides a restful API to various
+sub-systems.
+
+Its goal is to provide API for a higher level orchestration tools (such as
+Foreman). The Smart proxy provides an easy way to add or extended existing
+subsystems and API's.
+
+Currently supported are:
+DHCP - ISC DHCP and MS DHCP Servers
+DNS - Bind and MS DNS Servers
+TFTP - any UNIX based tftp server
+Puppet - Any Puppet server from 0.24.x
+Puppet CA - Manage certificate signing, cleaning and autosign on a Puppet CA
+ server
+BMC - BMC management etc
+
+WWW: http://theforeman.org
diff --git a/net/foreman-proxy/pkg-plist b/net/foreman-proxy/pkg-plist
new file mode 100644
index 000000000000..05bccbf9bee0
--- /dev/null
+++ b/net/foreman-proxy/pkg-plist
@@ -0,0 +1,90 @@
+sbin/smart-proxy
+@unexec if cmp -s %D/etc/foreman-proxy/settings.yml %D/etc/foreman-proxy/settings.yml.sample; then rm -f %D/etc/foreman-proxy/settings.yml; fi
+etc/foreman-proxy/settings.yml.sample
+@exec [ -f %B/settings.yml ] || cp %B/%f %B/settings.yml
+%%DATADIR%%/Rakefile
+%%DATADIR%%/config.ru
+%%DATADIR%%/config
+%%DATADIR%%/lib/bmc_api.rb
+%%DATADIR%%/lib/checks.rb
+%%DATADIR%%/lib/chefproxy_api.rb
+%%DATADIR%%/lib/daemon.rb
+%%DATADIR%%/lib/dhcp_api.rb
+%%DATADIR%%/lib/dns_api.rb
+%%DATADIR%%/lib/facts_api.rb
+%%DATADIR%%/lib/features_api.rb
+%%DATADIR%%/lib/helpers.rb
+%%DATADIR%%/lib/proxy.rb
+%%DATADIR%%/lib/proxy/authentication.rb
+%%DATADIR%%/lib/proxy/bmc.rb
+%%DATADIR%%/lib/proxy/bmc/base.rb
+%%DATADIR%%/lib/proxy/bmc/ipmi.rb
+%%DATADIR%%/lib/proxy/bmc/shell.rb
+%%DATADIR%%/lib/proxy/chefproxy.rb
+%%DATADIR%%/lib/proxy/dhcp.rb
+%%DATADIR%%/lib/proxy/dhcp/monkey_patch_subnet.rb
+%%DATADIR%%/lib/proxy/dhcp/monkey_patches.rb
+%%DATADIR%%/lib/proxy/dhcp/record.rb
+%%DATADIR%%/lib/proxy/dhcp/record/lease.rb
+%%DATADIR%%/lib/proxy/dhcp/record/reservation.rb
+%%DATADIR%%/lib/proxy/dhcp/server.rb
+%%DATADIR%%/lib/proxy/dhcp/server/isc.rb
+%%DATADIR%%/lib/proxy/dhcp/server/ms.rb
+%%DATADIR%%/lib/proxy/dhcp/server/native_ms.rb
+%%DATADIR%%/lib/proxy/dhcp/server/virsh.rb
+%%DATADIR%%/lib/proxy/dhcp/subnet.rb
+%%DATADIR%%/lib/proxy/dns.rb
+%%DATADIR%%/lib/proxy/dns/default_dns_settings.rb
+%%DATADIR%%/lib/proxy/dns/dnscmd.rb
+%%DATADIR%%/lib/proxy/dns/nsupdate.rb
+%%DATADIR%%/lib/proxy/dns/nsupdate_gss.rb
+%%DATADIR%%/lib/proxy/dns/virsh.rb
+%%DATADIR%%/lib/proxy/error.rb
+%%DATADIR%%/lib/proxy/log.rb
+%%DATADIR%%/lib/proxy/puppet.rb
+%%DATADIR%%/lib/proxy/puppet/class_scanner.rb
+%%DATADIR%%/lib/proxy/puppet/class_scanner_eparser.rb
+%%DATADIR%%/lib/proxy/puppet/customrun.rb
+%%DATADIR%%/lib/proxy/puppet/default_puppet_settings.rb
+%%DATADIR%%/lib/proxy/puppet/environment.rb
+%%DATADIR%%/lib/proxy/puppet/initializer.rb
+%%DATADIR%%/lib/proxy/puppet/mcollective.rb
+%%DATADIR%%/lib/proxy/puppet/puppet_class.rb
+%%DATADIR%%/lib/proxy/puppet/puppet_ssh.rb
+%%DATADIR%%/lib/proxy/puppet/puppetrun.rb
+%%DATADIR%%/lib/proxy/puppet/salt.rb
+%%DATADIR%%/lib/proxy/puppetca.rb
+%%DATADIR%%/lib/proxy/settings.rb
+%%DATADIR%%/lib/proxy/tftp.rb
+%%DATADIR%%/lib/proxy/util.rb
+%%DATADIR%%/lib/proxy/validations.rb
+%%DATADIR%%/lib/proxy/virsh.rb
+%%DATADIR%%/lib/puppet_api.rb
+%%DATADIR%%/lib/puppetca_api.rb
+%%DATADIR%%/lib/sinatra-patch.rb
+%%DATADIR%%/lib/smart_proxy.rb
+%%DATADIR%%/lib/tftp_api.rb
+%%DATADIR%%/public/css/styles.css
+%%DATADIR%%/views/dhcp/index.erb
+%%DATADIR%%/views/dhcp/show.erb
+%%DATADIR%%/views/features/index.erb
+%%DATADIR%%/views/layout.erb
+@dirrm %%DATADIR%%/views/features
+@dirrm %%DATADIR%%/views/dhcp
+@dirrm %%DATADIR%%/views
+@dirrm %%DATADIR%%/public/css
+@dirrm %%DATADIR%%/public
+@dirrm %%DATADIR%%/lib/proxy/bmc
+@dirrm %%DATADIR%%/lib/proxy/dhcp/record
+@dirrm %%DATADIR%%/lib/proxy/dhcp/server
+@dirrm %%DATADIR%%/lib/proxy/dhcp
+@dirrm %%DATADIR%%/lib/proxy/dns
+@dirrm %%DATADIR%%/lib/proxy/puppet
+@dirrm %%DATADIR%%/lib/proxy
+@dirrm %%DATADIR%%/lib
+@dirrmtry %%DATADIR%%
+@dirrmtry etc/foreman-proxy
+@cwd /
+@exec %%MKDIR%% -m 0700 %%FOREMAN_PROXY_LOGDIR%% %%FOREMAN_PROXY_RUNDIR%%
+@unexec rmdir %%FOREMAN_PROXY_LOGDIR%% >/dev/null 2>&1 || :
+@unexec rmdir %%FOREMAN_PROXY_RUNDIR%% >/dev/null 2>&1 || :