appconfig

package
v0.0.0-...-a9ed6da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package appconfig manages the configuration of the agent.

Package appconfig manages the configuration of the agent.

Package appconfig manages the configuration of the agent.

Package appconfig manages the configuration of the agent.

Index

Constants

View Source
const (
	// Agent defaults
	DefaultAgentName = "amazon-ssm-agent"

	DefaultCommandWorkersLimit    = 5
	DefaultCommandWorkersLimitMin = 1

	DefaultCommandRetryLimit    = 15
	DefaultCommandRetryLimitMin = 1
	DefaultCommandRetryLimitMax = 100

	DefaultStopTimeoutMillis    = 20000
	DefaultStopTimeoutMillisMin = 10000
	DefaultStopTimeoutMillisMax = 1000000

	// SSM defaults
	DefaultSsmHealthFrequencyMinutes    = 5
	DefaultSsmHealthFrequencyMinutesMin = 5
	DefaultSsmHealthFrequencyMinutesMax = 60

	DefaultSsmAssociationFrequencyMinutes    = 10
	DefaultSsmAssociationFrequencyMinutesMin = 5
	DefaultSsmAssociationFrequencyMinutesMax = 60

	//aws-ssm-agent bookkeeping constants
	DefaultLocationOfPending     = "pending"
	DefaultLocationOfCurrent     = "current"
	DefaultLocationOfCompleted   = "completed"
	DefaultLocationOfCorrupt     = "corrupt"
	DefaultLocationOfState       = "state"
	DefaultLocationOfAssociation = "association"

	//aws-ssm-agent state and orchestration logs duration for Run Command and Association
	DefaultAssociationLogsRetentionDurationHours           = 24  // 1 day default retention
	DefaultRunCommandLogsRetentionDurationHours            = 336 // 14 days default retention
	DefaultStateOrchestrationLogsRetentionDurationHoursMin = 8   // Min retention of 8hrs as some processes may not timeout before this and don't want logs to be deleted before the process completes

	//aws-ssm-agent bookkeeping constants for long running plugins
	LongRunningPluginsLocation         = "longrunningplugins"
	LongRunningPluginsHealthCheck      = "healthcheck"
	LongRunningPluginDataStoreLocation = "datastore"
	LongRunningPluginDataStoreFileName = "store"
	PluginNameLongRunningPluginInvoker = "lrpminvoker"

	//aws-ssm-agent bookkeeping constants for inventory plugin
	InventoryRootDirName         = "inventory"
	CustomInventoryRootDirName   = "custom"
	FileInventoryRootDirName     = "file"
	RoleInventoryRootDirName     = "role"
	InventoryContentHashFileName = "contentHash"

	//aws-ssm-agent bookkeeping constants for failed sent replies
	RepliesRootDirName = "replies"

	//aws-ssm-agent bookkeeping constants for compliance
	ComplianceRootDirName         = "compliance"
	ComplianceContentHashFileName = "contentHash"

	// DefaultDocumentRootDirName is the root directory for storing command states
	DefaultDocumentRootDirName = "document"

	// ConfigurationRootDirName - the configuration folder used in ec2 config
	ConfigurationRootDirName = "Configuration"

	// WorkersRootDirName  - the worker folder used in ec2 config
	WorkersRootDirName = "Workers"

	// Permissions defaults
	//NOTE: Limit READ, WRITE and EXECUTE access to administrators/root.
	ReadWriteAccess        = 0600
	ReadWriteExecuteAccess = 0700

	// Common file flags when opening/creating files
	FileFlagsCreateOrAppend   = os.O_APPEND | os.O_WRONLY | os.O_CREATE
	FileFlagsCreateOrTruncate = os.O_TRUNC | os.O_WRONLY | os.O_CREATE

	// ExitCodes
	SuccessExitCode = 0
	ErrorExitCode   = 1

	// DefaultPluginConfig is a default config with which the plugins are initialized
	DefaultPluginConfig = "aws:defaultPluginConfig"

	// PluginNameAwsConfigureDaemon is the name for configure daemon plugin
	PluginNameAwsConfigureDaemon = "aws:configureDaemon"

	// PluginNameAwsConfigurePackage is the name for configure package plugin
	PluginNameAwsConfigurePackage = "aws:configurePackage"

	// PluginNameAwsRunShellScript is the name for run shell script plugin
	PluginNameAwsRunShellScript = "aws:runShellScript"

	// PluginNameAwsRunPowerShellScript is the name of the run powershell script plugin
	PluginNameAwsRunPowerShellScript = "aws:runPowerShellScript"

	// PluginNameAwsAgentUpdate is the name for agent update plugin
	PluginNameAwsAgentUpdate = "aws:updateSsmAgent"

	// PluginEC2ConfigUpdate is the name for ec2 config update plugin
	PluginEC2ConfigUpdate = "aws:updateAgent"

	// PluginDownloadContent is the name for downloadContent plugin
	PluginDownloadContent = "aws:downloadContent"

	// PluginRunDocument is the name of the run document plugin
	PluginRunDocument = "aws:runDocument"

	// PluginNameAwsSoftwareInventory is the name for inventory plugin
	PluginNameAwsSoftwareInventory = "aws:softwareInventory"

	// PluginNameDomainJoin is the name of domain join plugin
	PluginNameDomainJoin = "aws:domainJoin"

	// PluginNameCloudWatch is the name of cloud watch plugin
	PluginNameCloudWatch = "aws:cloudWatch"

	// PluginNameRunDockerAction is the name of the docker container plugin
	PluginNameDockerContainer = "aws:runDockerAction"

	// PluginNameConfigureDocker is the name of the configure Docker plugin
	PluginNameConfigureDocker = "aws:configureDocker"

	// PluginNameRefreshAssociation is the name of refresh association plugin
	PluginNameRefreshAssociation = "aws:refreshAssociation"

	// PluginNameAwsPowerShellModule is the name of the PowerShell Module
	PluginNameAwsPowerShellModule = "aws:psModule"

	// PluginNameAwsApplications is the name of the Applications plugin
	PluginNameAwsApplications = "aws:applications"

	AppConfigFileName    = "amazon-ssm-agent.json"
	SeelogConfigFileName = "seelog.xml"

	// Output truncation limits
	MaxStdoutLength = 24000
	MaxStderrLength = 8000
)
View Source
const (

	// PackageRoot specifies the directory under which packages will be downloaded and installed
	PackageRoot = "/var/lib/amazon/ssm/packages"

	// PackageLockRoot specifies the directory under which package lock files will reside
	PackageLockRoot = "/var/lib/amazon/ssm/locks/packages"

	// PackagePlatform is the platform name to use when looking for packages
	PackagePlatform = "linux"

	// DaemonRoot specifies the directory where daemon registration information is stored
	DaemonRoot = "/var/lib/amazon/ssm/daemons"

	// LocalCommandRoot specifies the directory where users can submit command documents offline
	LocalCommandRoot = "/var/lib/amazon/ssm/localcommands"

	// LocalCommandRootSubmitted is the directory where locally submitted command documents
	// are moved when they have been picked up
	LocalCommandRootSubmitted = "/var/lib/amazon/ssm/localcommands/submitted"
	LocalCommandRootCompleted = "/var/lib/amazon/ssm/localcommands/completed"

	// LocalCommandRootInvalid is the directory where locally submitted command documents
	// are moved if the service cannot validate the document (generally impossible via cli)
	LocalCommandRootInvalid = "/var/lib/amazon/ssm/localcommands/invalid"

	// DownloadRoot specifies the directory under which files will be downloaded
	DownloadRoot = "/var/log/amazon/ssm/download/"

	// DefaultDataStorePath represents the directory for storing system data
	DefaultDataStorePath = "/var/lib/amazon/ssm/"

	// EC2ConfigDataStorePath represents the directory for storing ec2 config data
	EC2ConfigDataStorePath = "/var/lib/amazon/ec2config/"

	// EC2ConfigSettingPath represents the directory for storing ec2 config settings
	EC2ConfigSettingPath = "/var/lib/amazon/ec2configservice/"

	// UpdaterArtifactsRoot represents the directory for storing update related information
	UpdaterArtifactsRoot = "/var/lib/amazon/ssm/update/"

	// DefaultPluginPath represents the directory for storing plugins in SSM
	DefaultPluginPath = "/var/lib/amazon/ssm/plugins"

	// ManifestCacheDirectory represents the directory for storing all downloaded manifest files
	ManifestCacheDirectory = "/var/lib/amazon/ssm/manifests"

	// RebootExitCode that would trigger a Soft Reboot
	RebootExitCode = 194

	// Default Custom Inventory Inventory Folder
	DefaultCustomInventoryFolder = DefaultDataStorePath + "inventory/custom"

	// Used to capture and return exit code for windows powershell script execution - empty for unix shell script case
	ExitCodeTrap = ""

	// PowerShellPluginCommandArgs is the arguments of powershell.exe to be used by the runPowerShellScript plugin
	PowerShellPluginCommandArgs = ""

	// Exit Code for a command that exits before completion (generally due to timeout or cancel)
	CommandStoppedPreemptivelyExitCode = 137 // Fatal error (128) + signal for SIGKILL (9) = 137

	// RunCommandScriptName is the script name where all downloaded or provided commands will be stored
	RunCommandScriptName = "_script.sh"
)

Variables

AppConfigPath is the path of the AppConfig

View Source
var DefaultDocumentWorker = "/usr/bin/ssm-document-worker"
View Source
var DefaultProgramFolder = "/etc/amazon/ssm/"

DefaultProgramFolder is the default folder for SSM

View Source
var PowerShellPluginCommandName string

PowerShellPluginCommandName is the path of the powershell.exe to be used by the runPowerShellScript plugin

View Source
var SupportedDocumentVersions = map[string]struct{}{
	"1.0":   {},
	"1.2":   {},
	"2.0":   {},
	"2.0.1": {},
	"2.0.2": {},
	"2.0.3": {},
	"2.2":   {},
}

Document versions that are supported by this Agent version. Note that 1.1 and 2.1 are deprecated schemas and hence are not added here. Version 2.0.1, 2.0.2, and 2.0.3 are added to support install documents for configurePackage that require capabilities that did not exist before the build where support for these versions was added

Functions

func GetDefaultEndPoint

func GetDefaultEndPoint(region string, service string) string

TODO https://sim.amazon.com/issues/SSM-3439 getDefaultEndPoint returns the default endpoint for a service, it should be empty unless it's a china region

Types

type AgentInfo

type AgentInfo struct {
	Name                 string
	Version              string
	Region               string
	OrchestrationRootDir string
	DownloadRootDir      string
}

AgentInfo represents metadata for amazon-ssm-agent

type BirdwatcherCfg

type BirdwatcherCfg struct {
	ForceEnable bool
}

BirdwatcherCfg represents configuration related to ConfigurePackage Birdwatcher integration

type CredentialProfile

type CredentialProfile struct {
	Path         string
	Name         string
	ShareCreds   bool
	ShareProfile string
}

CredentialProfile represents configurations for aws credential profile

type MdsCfg

type MdsCfg struct {
	Endpoint            string
	CommandWorkersLimit int
	StopTimeoutMillis   int64
	CommandRetryLimit   int
}

MdsCfg represents configuration for Message delivery service (MDS)

type MfsCfg

type MfsCfg struct {
	Endpoint  string
	Url       string
	ChannelId string
}

MfsCfg represents configuration for HummingBird service (MFS)

type OsInfo

type OsInfo struct {
	Lang    string
	Name    string
	Version string
}

OsInfo represents os related information

type S3Cfg

type S3Cfg struct {
	Endpoint  string
	Region    string
	LogBucket string
	LogKey    string
}

S3Cfg represents configurations related to S3 bucket and key for SSM

type SsmCfg

type SsmCfg struct {
	Endpoint                    string
	HealthFrequencyMinutes      int
	AssociationFrequencyMinutes int
	AssociationRetryLimit       int
	// TODO: test hook, can be removed before release
	// this is to skip ssl verification for the beta self signed certs
	InsecureSkipVerify                    bool
	CustomInventoryDefaultLocation        string
	AssociationLogsRetentionDurationHours int
	RunCommandLogsRetentionDurationHours  int
}

SsmCfg represents configuration for Simple system manager (SSM)

type SsmagentConfig

type SsmagentConfig struct {
	Profile     CredentialProfile
	Mds         MdsCfg
	Ssm         SsmCfg
	Mfs         MfsCfg
	Agent       AgentInfo
	Os          OsInfo
	S3          S3Cfg
	Birdwatcher BirdwatcherCfg
}

SsmagentConfig stores agent configuration values.

func Config

func Config(reload bool) (SsmagentConfig, error)

Config loads the app configuration for amazon-ssm-agent. If reload is true, it loads the config afresh, otherwise it returns a previous loaded version, if any.

func DefaultConfig

func DefaultConfig() SsmagentConfig

DefaultConfig returns default ssm agent configuration

func (SsmagentConfig) ProfileCredentials

func (config SsmagentConfig) ProfileCredentials() (credsInConfig *credentials.Credentials, err error)

ProfileCredentials checks to see if specific profile is being asked to use

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL