From owner-svn-ports-head@freebsd.org Mon Oct 10 04:40:12 2016 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E23FAF7F41; Mon, 10 Oct 2016 04:40:12 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B1A869E; Mon, 10 Oct 2016 04:40:12 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9A4eBa7085515; Mon, 10 Oct 2016 04:40:11 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9A4eAlw085502; Mon, 10 Oct 2016 04:40:10 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201610100440.u9A4eAlw085502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Mon, 10 Oct 2016 04:40:10 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r423636 - in head/sysutils: . amazon-ssm-agent amazon-ssm-agent/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 04:40:12 -0000 Author: cperciva Date: Mon Oct 10 04:40:10 2016 New Revision: 423636 URL: https://svnweb.freebsd.org/changeset/ports/423636 Log: Add amazon-ssm-agent, an "Agent" which can be run on systems to enable remote code execution via the Amazon Simple Systems Manager (SSM) service. Added: head/sysutils/amazon-ssm-agent/ head/sysutils/amazon-ssm-agent/Makefile (contents, props changed) head/sysutils/amazon-ssm-agent/distinfo (contents, props changed) head/sysutils/amazon-ssm-agent/files/ head/sysutils/amazon-ssm-agent/files/amazon-ssm-agent.in (contents, props changed) head/sysutils/amazon-ssm-agent/files/patch-agent_appconfig_constants__unix.go (contents, props changed) head/sysutils/amazon-ssm-agent/files/patch-agent_fileutil_fileutil__unix.go (contents, props changed) head/sysutils/amazon-ssm-agent/files/patch-agent_log_log__unix.go (contents, props changed) head/sysutils/amazon-ssm-agent/files/patch-agent_platform_platform__unix.go (contents, props changed) head/sysutils/amazon-ssm-agent/files/patch-agent_ssm_service.go (contents, props changed) head/sysutils/amazon-ssm-agent/files/patch-makefile (contents, props changed) head/sysutils/amazon-ssm-agent/pkg-descr (contents, props changed) Modified: head/sysutils/Makefile Modified: head/sysutils/Makefile ============================================================================== --- head/sysutils/Makefile Mon Oct 10 04:33:16 2016 (r423635) +++ head/sysutils/Makefile Mon Oct 10 04:40:10 2016 (r423636) @@ -27,6 +27,7 @@ SUBDIR += aimage SUBDIR += aird SUBDIR += am-utils + SUBDIR += amazon-ssm-agent SUBDIR += amrstat SUBDIR += amtc SUBDIR += anacron Added: head/sysutils/amazon-ssm-agent/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/amazon-ssm-agent/Makefile Mon Oct 10 04:40:10 2016 (r423636) @@ -0,0 +1,39 @@ +# $FreeBSD$ + +PORTNAME= amazon-ssm-agent +PORTVERSION= v1.2.252.0 +CATEGORIES= sysutils + +MAINTAINER= cperciva@FreeBSD.org +COMMENT= Amazon Simple Systems Manager Agent + +LICENSE= Amazon +LICENSE_NAME= Amazon Software License +LICENSE_FILE= ${WRKSRC}/LICENSE +LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept + +BUILD_DEPENDS= bash:shells/bash \ + go:lang/go +RUN_DEPENDS= ${LOCALBASE}/share/certs/ca-root-nss.crt:security/ca_root_nss + +USE_GITHUB= yes +GH_ACCOUNT= aws + +WRKSRC= ${WRKDIR}/src/github.com/aws/amazon-ssm-agent +USES= gmake +MAKEFILE= makefile +ALL_TARGET= build-freebsd +INSTALL_TARGET= install-freebsd +MAKE_ARGS= SKIP_CHECKSTYLE="YES" DESTDIR=${STAGEDIR}${PREFIX} + +PLIST_FILES= etc/amazon/ssm/amazon-ssm-agent.json.template \ + etc/amazon/ssm/seelog_unix.xml.template \ + sbin/amazon-ssm-agent + +USE_RC_SUBR= amazon-ssm-agent + +post-extract: + ${MKDIR} ${WRKDIR}/src/github.com/aws + ${MV} ${WRKDIR}/${PORTNAME}-${PORTVERSION:S/v//} ${WRKSRC} + +.include Added: head/sysutils/amazon-ssm-agent/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/amazon-ssm-agent/distinfo Mon Oct 10 04:40:10 2016 (r423636) @@ -0,0 +1,3 @@ +TIMESTAMP = 1468390545 +SHA256 (aws-amazon-ssm-agent-v1.2.252.0_GH0.tar.gz) = 94e9633eadd0a78e5e1b9071b4f75c238dbbb78761f75d45461f8b0f5a5fbf24 +SIZE (aws-amazon-ssm-agent-v1.2.252.0_GH0.tar.gz) = 4562897 Added: head/sysutils/amazon-ssm-agent/files/amazon-ssm-agent.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/amazon-ssm-agent/files/amazon-ssm-agent.in Mon Oct 10 04:40:10 2016 (r423636) @@ -0,0 +1,27 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: amazon-ssm-agent +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# amazon_ssm_agent_enable: Set to YES to enable the Amazon SSM Agent + +. /etc/rc.subr + +name="amazon_ssm_agent" +rcvar=amazon_ssm_agent_enable + +load_rc_config $name + +: ${amazon_ssm_agent_enable="NO"} + +pidfile="/var/run/${name}.pid" +command="/usr/sbin/daemon" +command_args="-f -P ${pidfile} %%PREFIX%%/sbin/amazon-ssm-agent" + +run_rc_command "$1" Added: head/sysutils/amazon-ssm-agent/files/patch-agent_appconfig_constants__unix.go ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/amazon-ssm-agent/files/patch-agent_appconfig_constants__unix.go Mon Oct 10 04:40:10 2016 (r423636) @@ -0,0 +1,20 @@ +--- agent/appconfig/constants_unix.go.orig 2016-07-06 21:51:35 UTC ++++ agent/appconfig/constants_unix.go +@@ -18,7 +18,7 @@ package appconfig + + const ( + // Program Folder +- DefaultProgramFolder = "/etc/amazon/ssm/" ++ DefaultProgramFolder = "/usr/local/etc/amazon/ssm/" + + // AppConfig Path + AppConfigPath = DefaultProgramFolder + AppConfigFileName +@@ -27,7 +27,7 @@ const ( + DownloadRoot = "/var/log/amazon/ssm/download/" + + // DefaultDataStorePath represents the directory for storing system data +- DefaultDataStorePath = "/var/lib/amazon/ssm/" ++ DefaultDataStorePath = "/var/run/amazon/ssm/" + + // UpdaterArtifactsRoot represents the directory for storing update related information + UpdaterArtifactsRoot = "/var/lib/amazon/ssm/update/" Added: head/sysutils/amazon-ssm-agent/files/patch-agent_fileutil_fileutil__unix.go ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/amazon-ssm-agent/files/patch-agent_fileutil_fileutil__unix.go Mon Oct 10 04:40:10 2016 (r423636) @@ -0,0 +1,15 @@ +--- agent/fileutil/fileutil_unix.go.orig 2016-07-06 21:51:35 UTC ++++ agent/fileutil/fileutil_unix.go +@@ -85,9 +85,9 @@ func GetDiskSpaceInfo() (diskSpaceInfo D + + // return DiskSpaceInfo with calculated bytes + return DiskSpaceInfo{ +- AvailBytes: (int64)(stat.Bavail * bSize), // available space = # of available blocks * block size +- FreeBytes: (int64)(stat.Bfree * bSize), // free space = # of free blocks * block size +- TotalBytes: (int64)(stat.Blocks * bSize), // total space = # of total blocks * block size ++ AvailBytes: (int64)((uint64)(stat.Bavail) * bSize), // available space = # of available blocks * block size ++ FreeBytes: (int64)(stat.Bfree * bSize), // free space = # of free blocks * block size ++ TotalBytes: (int64)(stat.Blocks * bSize), // total space = # of total blocks * block size + }, nil + } + Added: head/sysutils/amazon-ssm-agent/files/patch-agent_log_log__unix.go ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/amazon-ssm-agent/files/patch-agent_log_log__unix.go Mon Oct 10 04:40:10 2016 (r423636) @@ -0,0 +1,11 @@ +--- agent/log/log_unix.go.orig 2016-07-06 21:51:35 UTC ++++ agent/log/log_unix.go +@@ -24,7 +24,7 @@ const ( + // DefaultSeelogConfigFilePath specifies the default seelog location + // The underlying logger is based of https://github.com/cihub/seelog + // See Seelog documentation to customize the logger +- DefaultSeelogConfigFilePath = "/etc/amazon/ssm/seelog.xml" ++ DefaultSeelogConfigFilePath = "/usr/local/etc/amazon/ssm/seelog.xml" + + DefaultLogDir = "/var/log/amazon/ssm" + ) Added: head/sysutils/amazon-ssm-agent/files/patch-agent_platform_platform__unix.go ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/amazon-ssm-agent/files/patch-agent_platform_platform__unix.go Mon Oct 10 04:40:10 2016 (r423636) @@ -0,0 +1,37 @@ +--- agent/platform/platform_unix.go.orig 2016-07-06 21:51:35 UTC ++++ agent/platform/platform_unix.go +@@ -20,6 +20,7 @@ import ( + "os" + "os/exec" + "path/filepath" ++ "runtime" + "strings" + + "github.com/aws/amazon-ssm-agent/agent/fileutil" +@@ -29,6 +30,7 @@ import ( + const ( + systemReleaseCommand = "/etc/system-release" + redhatReleaseCommand = "/etc/redhat-release" ++ unameCommand = "/usr/bin/uname" + lsbReleaseCommand = "lsb_release" + fetchingDetailsMessage = "fetching platform details from %v" + errorOccurredMessage = "There was an error running %v, err: %v" +@@ -94,6 +96,18 @@ func getPlatformDetails(log log.T) (name + versionData := strings.Split(data[1], "(") + version = strings.TrimSpace(versionData[0]) + } ++ } else if runtime.GOOS == "freebsd" { ++ log.Debugf(fetchingDetailsMessage, unameCommand) ++ ++ if contentsBytes, err = exec.Command(unameCommand, "-sr").Output(); err != nil { ++ log.Debugf(fetchingDetailsMessage, lsbReleaseCommand, err) ++ return ++ } ++ log.Debugf(commandOutputMessage, contentsBytes) ++ ++ data := strings.Split(string(contentsBytes), " ") ++ name = strings.TrimSpace(data[0]) ++ version = strings.TrimSpace(data[1]) + } else { + log.Debugf(fetchingDetailsMessage, lsbReleaseCommand) + Added: head/sysutils/amazon-ssm-agent/files/patch-agent_ssm_service.go ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/amazon-ssm-agent/files/patch-agent_ssm_service.go Mon Oct 10 04:40:10 2016 (r423636) @@ -0,0 +1,11 @@ +--- agent/ssm/service.go.orig 2016-07-06 21:51:35 UTC ++++ agent/ssm/service.go +@@ -128,6 +128,8 @@ func (svc *sdkService) UpdateInstanceInf + params.PlatformType = aws.String(ssm.PlatformTypeWindows) + case "linux": + params.PlatformType = aws.String(ssm.PlatformTypeLinux) ++ case "freebsd": ++ params.PlatformType = aws.String(ssm.PlatformTypeLinux) + default: + return nil, fmt.Errorf("Cannot report platform type of unrecognized OS. %v", goOS) + } Added: head/sysutils/amazon-ssm-agent/files/patch-makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/amazon-ssm-agent/files/patch-makefile Mon Oct 10 04:40:10 2016 (r423636) @@ -0,0 +1,39 @@ +--- makefile.orig 2016-07-06 21:51:35 UTC ++++ makefile +@@ -26,13 +26,15 @@ endif + export GOPATH + + checkstyle:: ++ifndef SKIP_CHECKSTYLE + # Run checkstyle script + $(BGO_SPACE)/Tools/src/checkstyle.sh ++endif + + coverage:: build-linux + $(BGO_SPACE)/Tools/src/coverage.sh github.com/aws/amazon-ssm-agent/agent/... + +-build:: build-linux build-windows build-linux-386 build-windows-386 ++build:: build-linux build-freebsd build-windows build-linux-386 build-windows-386 + + prepack:: prepack-linux prepack-linux-386 prepack-windows prepack-windows-386 + +@@ -75,6 +77,19 @@ build-linux: checkstyle copy-src pre-bui + GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o $(BGO_SPACE)/bin/linux_amd64/updater -v \ + $(BGO_SPACE)/agent/update/updater/updater.go $(BGO_SPACE)/agent/update/updater/updater_unix.go + ++.PHONY: build-freebsd ++build-freebsd: checkstyle copy-src pre-build ++ @echo "Build for freebsd agent" ++ GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w" -o $(BGO_SPACE)/bin/freebsd_amd64/amazon-ssm-agent -v \ ++ $(BGO_SPACE)/agent/agent.go $(BGO_SPACE)/agent/agent_unix.go $(BGO_SPACE)/agent/agent_parser.go ++ ++install-freebsd: ++ @echo "Install for freebsd agent" ++ install -m 555 $(BGO_SPACE)/bin/freebsd_amd64/amazon-ssm-agent $(DESTDIR)$(PREFIX)/sbin/ ++ mkdir -p $(DESTDIR)$(PREFIX)/etc/amazon/ssm ++ install -m 644 $(BGO_SPACE)/bin/amazon-ssm-agent.json.template $(DESTDIR)$(PREFIX)/etc/amazon/ssm ++ install -m 644 $(BGO_SPACE)/bin/seelog_unix.xml $(DESTDIR)$(PREFIX)/etc/amazon/ssm/seelog_unix.xml.template ++ + .PHONY: build-darwin + build-darwin: checkstyle copy-src pre-build + @echo "Rebuild for darwin agent" Added: head/sysutils/amazon-ssm-agent/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/amazon-ssm-agent/pkg-descr Mon Oct 10 04:40:10 2016 (r423636) @@ -0,0 +1,6 @@ +Amazon SSM (Simple Systems Manager) is a service for remotely controlling +(executing code on) EC2 instances. This port provides the SSM "Agent", +which polls an Amazon Web Services API for commands, spawns them, and +sends their output back. + +WWW: https://github.com/aws/amazon-ssm-agent