PageRenderTime 28ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/README.md

https://gitlab.com/waldi/waagent
Markdown | 442 lines | 316 code | 126 blank | 0 comment | 0 complexity | 2fa09ede86173876cb1a179042819364 MD5 | raw file
  1. ## Microsoft Azure Linux Agent README
  2. ### INTRODUCTION
  3. The Microsoft Azure Linux Agent (waagent) manages Linux & BSD provisioning,
  4. and VM interaction with the Azure Fabric Controller. It provides the following
  5. functionality for Linux and BSD IaaS deployments:
  6. * Image Provisioning
  7. - Creation of a user account
  8. - Configuring SSH authentication types
  9. - Deployment of SSH public keys and key pairs
  10. - Setting the host name
  11. - Publishing the host name to the platform DNS
  12. - Reporting SSH host key fingerprint to the platform
  13. - Resource Disk Management
  14. - Formatting and mounting the resource disk
  15. - Configuring swap space
  16. * Networking
  17. - Manages routes to improve compatibility with platform DHCP servers
  18. - Ensures the stability of the network interface name
  19. * Kernel
  20. - Configure virtual NUMA (disable for kernel <2.6.37)
  21. - Consume Hyper-V entropy for /dev/random
  22. - Configure SCSI timeouts for the root device (which could be remote)
  23. * Diagnostics
  24. - Console redirection to the serial port
  25. * SCVMM Deployments
  26. - Detect and bootstrap the VMM agent for Linux when running in a System
  27. Center Virtual Machine Manager 2012R2 environment
  28. * VM Extension
  29. - Inject component authored by Microsoft and Partners into Linux VM (IaaS)
  30. to enable software and configuration automation
  31. - VM Extension reference implementation on https://github.com/Azure/azure-linux-extensions
  32. ### COMMUNICATION
  33. The information flow from the platform to the agent occurs via two channels:
  34. * A boot-time attached DVD for IaaS deployments.
  35. This DVD includes an OVF-compliant configuration file that includes all
  36. provisioning information other than the actual SSH keypairs.
  37. * A TCP endpoint exposing a REST API used to obtain deployment and topology
  38. configuration.
  39. The agent will use an HTTP proxy if provided via the `http_proxy` (for `http` requests) or
  40. `https_proxy` (for `https` requests) environment variables. The `HttpProxy.Host` and
  41. `HttpProxy.Port` configuration variables (see below), if used, will override the environment
  42. settings. Due to limitations of Python, the agent *does not* support HTTP proxies requiring
  43. authentication.
  44. ### REQUIREMENTS
  45. The following systems have been tested and are known to work with the Azure
  46. Linux Agent. Please note that this list may differ from the official list
  47. of supported systems on the Microsoft Azure Platform as described here:
  48. http://support.microsoft.com/kb/2805216
  49. Waagent depends on some system packages in order to function properly:
  50. * Python 2.6+
  51. * OpenSSL 1.0+
  52. * OpenSSH 5.3+
  53. * Filesystem utilities: sfdisk, fdisk, mkfs, parted
  54. * Password tools: chpasswd, sudo
  55. * Text processing tools: sed, grep
  56. * Network tools: ip-route
  57. ### INSTALLATION
  58. Installation via your distribution's package repository is preferred.
  59. You can also customize your own RPM or DEB packages using the configuration
  60. samples provided (see deb and rpm sections below).
  61. For more advanced installation options, such as installing to custom locations
  62. or prefixes, you can use ***setuptools*** to install from source by running:
  63. #sudo python setup.py install --register-service
  64. You can view more installation options by running:
  65. #sudo python setup.py install --help
  66. The agent's log file is kept at /var/log/waagent.log.
  67. ### UPGRADE
  68. Upgrading via your distribution's package repository is preferred.
  69. If upgrading manually, same with installation above by running:
  70. #sudo python setup.py install --force
  71. Restart waagent service,for most of linux distributions:
  72. #sudo service waagent restart
  73. For Ubuntu, use:
  74. #sudo service walinuxagent restart
  75. For CoreOS, use:
  76. #sudo systemctl restart waagent
  77. The agent's log file is kept at /var/log/waagent.log.
  78. ### COMMAND LINE OPTIONS
  79. Flags:
  80. -verbose: Increase verbosity of specified command
  81. -force: Skip interactive confirmation for some commands
  82. Commands:
  83. -help: Lists the supported commands and flags.
  84. -deprovision: Attempt to clean the system and make it suitable for
  85. re-provisioning, by deleting the following:
  86. * All SSH host keys (if Provisioning.RegenerateSshHostKeyPair
  87. is 'y' in the configuration file)
  88. * Nameserver configuration in /etc/resolv.conf
  89. * Root password from /etc/shadow (if
  90. Provisioning.DeleteRootPassword is 'y' in the configuration file)
  91. * Cached DHCP client leases
  92. * Resets host name to localhost.localdomain
  93. WARNING! Deprovision does not guarantee that the image is cleared of
  94. all sensitive information and suitable for redistribution.
  95. -deprovision+user: Performs everything under deprovision (above)
  96. and also deletes the last provisioned user account and associated data.
  97. -version: Displays the version of waagent
  98. -serialconsole: Configures GRUB to mark ttyS0 (the first serial port)
  99. as the boot console. This ensures that kernel bootup logs are sent to
  100. the serial port and made available for debugging.
  101. -daemon: Run waagent as a daemon to manage interaction with the
  102. platform. This argument is specified to waagent in the waagent init
  103. script.
  104. -start: Run waagent as a background process
  105. ### CONFIGURATION
  106. A configuration file (/etc/waagent.conf) controls the actions of
  107. waagent. Blank lines and lines whose first character is a `#` are
  108. ignored (end-of-line comments are *not* supported).
  109. A sample configuration file is shown below:
  110. ```
  111. Provisioning.Enabled=y
  112. Provisioning.UseCloudInit=n
  113. Provisioning.DeleteRootPassword=n
  114. Provisioning.RegenerateSshHostKeyPair=y
  115. Provisioning.SshHostKeyPairType=rsa
  116. Provisioning.MonitorHostName=y
  117. Provisioning.DecodeCustomData=n
  118. Provisioning.ExecuteCustomData=n
  119. Provisioning.PasswordCryptId=6
  120. Provisioning.PasswordCryptSaltLength=10
  121. ResourceDisk.Format=y
  122. ResourceDisk.Filesystem=ext4
  123. ResourceDisk.MountPoint=/mnt/resource
  124. ResourceDisk.MountOptions=None
  125. ResourceDisk.EnableSwap=n
  126. ResourceDisk.SwapSizeMB=0
  127. LBProbeResponder=y
  128. Logs.Verbose=n
  129. OS.AllowHTTP=n
  130. OS.RootDeviceScsiTimeout=300
  131. OS.EnableFIPS=n
  132. OS.OpensslPath=None
  133. OS.SshDir=/etc/ssh
  134. HttpProxy.Host=None
  135. HttpProxy.Port=None
  136. ```
  137. The various configuration options are described in detail below. Configuration
  138. options are of three types : Boolean, String or Integer. The Boolean
  139. configuration options can be specified as "y" or "n". The special keyword "None"
  140. may be used for some string type configuration entries as detailed below.
  141. #### Configuration File Options
  142. * __Provisioning.Enabled__
  143. _Type: Boolean_
  144. _Default: y_
  145. This allows the user to enable or disable the provisioning functionality in the
  146. agent. Valid values are "y" or "n". If provisioning is disabled, SSH host and
  147. user keys in the image are preserved and any configuration specified in the
  148. Azure provisioning API is ignored.
  149. * __Provisioning.UseCloudInit__
  150. _Type: Boolean_
  151. _Default: n_
  152. This options enables / disables support for provisioning by means of cloud-init.
  153. When true ("y"), the agent will wait for cloud-init to complete before installing
  154. extensions and processing the latest goal state. _Provisioning.Enabled_ must be
  155. disabled ("n") for this option to have an effect. Setting _Provisioning.Enabled_ to
  156. true ("y") overrides this option and runs the built-in agent provisioning code.
  157. * __Provisioning.DeleteRootPassword__
  158. _Type: Boolean_
  159. _Default: n_
  160. If set, the root password in the /etc/shadow file is erased during the
  161. provisioning process.
  162. * __Provisioning.RegenerateSshHostKeyPair__
  163. _Type: Boolean_
  164. _Default: y_
  165. If set, all SSH host key pairs (ecdsa, dsa and rsa) are deleted during the
  166. provisioning process from /etc/ssh/. And a single fresh key pair is generated.
  167. The encryption type for the fresh key pair is configurable by the
  168. Provisioning.SshHostKeyPairType entry. Please note that some distributions will
  169. re-create SSH key pairs for any missing encryption types when the SSH daemon is
  170. restarted (for example, upon a reboot).
  171. * __Provisioning.SshHostKeyPairType__
  172. _Type: String_
  173. _Default: rsa_
  174. This can be set to an encryption algorithm type that is supported by the SSH
  175. daemon on the VM. The typically supported values are "rsa", "dsa" and "ecdsa".
  176. Note that "putty.exe" on Windows does not support "ecdsa". So, if you intend to
  177. use putty.exe on Windows to connect to a Linux deployment, please use "rsa" or
  178. "dsa".
  179. * __Provisioning.MonitorHostName__
  180. _Type: Boolean_
  181. _Default: y_
  182. If set, waagent will monitor the Linux VM for hostname changes (as returned by
  183. the "hostname" command) and automatically update the networking configuration in
  184. the image to reflect the change. In order to push the name change to the DNS
  185. servers, networking will be restarted in the VM. This will result in brief loss
  186. of Internet connectivity.
  187. * __Provisioning.DecodeCustomData__
  188. _Type: Boolean_
  189. _Default: n_
  190. If set, waagent will decode CustomData from Base64.
  191. * __Provisioning.ExecuteCustomData__
  192. _Type: Boolean_
  193. _Default: n_
  194. If set, waagent will execute CustomData after provisioning.
  195. * __Provisioning.PasswordCryptId__
  196. _Type:String_
  197. _Default:6_
  198. Algorithm used by crypt when generating password hash.
  199. 1 - MD5
  200. 2a - Blowfish
  201. 5 - SHA-256
  202. 6 - SHA-512
  203. * __Provisioning.PasswordCryptSaltLength__
  204. _Type:String_
  205. _Default:10_
  206. Length of random salt used when generating password hash.
  207. * __ResourceDisk.Format__
  208. _Type: Boolean_
  209. _Default: y_
  210. If set, the resource disk provided by the platform will be formatted and mounted
  211. by waagent if the filesystem type requested by the user in
  212. "ResourceDisk.Filesystem" is anything other than "ntfs". A single partition of
  213. type Linux (83) will be made available on the disk. Note that this partition
  214. will not be formatted if it can be successfully mounted.
  215. * __ResourceDisk.Filesystem__
  216. _Type: String_
  217. _Default: ext4_
  218. This specifies the filesystem type for the resource disk. Supported values vary
  219. by Linux distribution. If the string is X, then mkfs.X should be present on the
  220. Linux image. SLES 11 images should typically use 'ext3'. BSD images should use
  221. 'ufs2' here.
  222. * __ResourceDisk.MountPoint__
  223. _Type: String_
  224. _Default: /mnt/resource_
  225. This specifies the path at which the resource disk is mounted.
  226. * __ResourceDisk.MountOptions__
  227. _Type: String_
  228. _Default: None_
  229. Specifies disk mount options to be passed to the mount -o command. This is a comma
  230. separated list of values, ex. 'nodev,nosuid'. See mount(8) for details.
  231. * __ResourceDisk.EnableSwap__
  232. _Type: Boolean_
  233. _Default: n_
  234. If set, a swap file (/swapfile) is created on the resource disk and added to the
  235. system swap space.
  236. * __ResourceDisk.SwapSizeMB__
  237. _Type: Integer_
  238. _Default: 0_
  239. The size of the swap file in megabytes.
  240. * __LBProbeResponder__
  241. _Type: Boolean_
  242. _Default: y_
  243. If set, waagent will respond to load balancer probes from the platform (if
  244. present).
  245. * Logs.Verbose
  246. _Type: Boolean_
  247. _Default: n_
  248. If set, log verbosity is boosted. Waagent logs to /var/log/waagent.log and
  249. leverages the system logrotate functionality to rotate logs.
  250. * __OS.AllowHTTP__
  251. _Type: Boolean_
  252. _Default: n_
  253. If set to `y` and SSL support is not compiled into Python, the agent will fall-back to
  254. use HTTP. Otherwise, if SSL support is not compiled into Python, the agent will fail
  255. all HTTPS requests.
  256. Note: Allowing HTTP may unintentionally expose secure data.
  257. * __OS.EnableRDMA__
  258. _Type: Boolean_
  259. _Default: n_
  260. If set, the agent will attempt to install and then load an RDMA kernel driver
  261. that matches the version of the firmware on the underlying hardware.
  262. * __OS.EnableFIPS__
  263. _Type: Boolean_
  264. _Default: n_
  265. If set, the agent will emit into the environment "OPENSSL_FIPS=1" when executing
  266. OpenSSL commands. This signals OpenSSL to use any installed FIPS-compliant libraries.
  267. Note that the agent itself has no FIPS-specific code. _If no FIPS-compliant are
  268. installed, then enabling this option will cause all OpenSSL commands to fail._
  269. * __OS.RootDeviceScsiTimeout__
  270. _Type: Integer_
  271. _Default: 300_
  272. This configures the SCSI timeout in seconds on the root device. If not set, the
  273. system defaults are used.
  274. * __OS.OpensslPath__
  275. _Type: String_
  276. _Default: None_
  277. This can be used to specify an alternate path for the openssl binary to use for
  278. cryptographic operations.
  279. * __OS.SshDir__
  280. _Type: String_
  281. _Default: `/etc/ssh`_
  282. This option can be used to override the normal location of the SSH configuration
  283. directory.
  284. * __HttpProxy.Host, HttpProxy.Port__
  285. _Type: String_
  286. _Default: None_
  287. If set, the agent will use this proxy server to access the internet. These values
  288. *will* override the `http_proxy` or `https_proxy` environment variables. Lastly,
  289. `HttpProxy.Host` is required (if to be used) and `HttpProxy.Port` is optional.
  290. ### APPENDIX
  291. We do not maintain packaging information in this repo but some samples
  292. are shown below as a reference. See the downstream distribution
  293. repositories for officially maintained packaging.
  294. #### deb packages
  295. The official Ubuntu WALinuxAgent package can be found here:
  296. https://launchpad.net/ubuntu/+source/walinuxagent
  297. Run once:
  298. 1. Install required packages:
  299. `sudo apt-get -y install ubuntu-dev-tools pbuilder python-all debhelper`
  300. 2. Create the pbuilder environment:
  301. `sudo pbuilder create --debootstrapopts --variant=buildd`
  302. 3. Obtain <waagent.dsc> from a downstream package repo
  303. To compile the package, from the top-most directory:
  304. 1. Build the source package:
  305. `dpkg-buildpackage -S`
  306. 2. Build the package:
  307. `sudo pbuilder build <waagent.dsc>`
  308. 3. Fetch the built package, usually from `/var/cache/pbuilder/result`
  309. #### rpm packages
  310. The instructions below describe how to build an rpm package.
  311. 1. Install setuptools
  312. `curl https://bootstrap.pypa.io/ez_setup.py -o - | python`
  313. 2. The following command will build the binary and source RPMs:
  314. `python setup.py bdist_rpm`
  315. -----
  316. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.