forked from Azure/WALinuxAgent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
571 lines (454 loc) · 20.6 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
Microsoft Azure Linux Agent README
INTRODUCTION
The Microsoft Azure Linux Agent (waagent) manages Linux & FreeBSD provisioning,
and VM interaction with the Azure Fabric Controller. It provides the following
functionality for Linux and FreeBSD IaaS deployments:
* Image Provisioning
- Creation of a user account
- Configuring SSH authentication types
- Deployment of SSH public keys and key pairs
- Setting the host name
- Publishing the host name to the platform DNS
- Reporting SSH host key fingerprint to the platform
- Resource Disk Management
- Formatting and mounting the resource disk
- Configuring swap space
* Networking
- Manages routes to improve compatibility with platform DHCP servers
- Ensures the stability of the network interface name
* Kernel
- Configure virtual NUMA (disable for kernel <2.6.37)
- Consume Hyper-V entropy for /dev/random
- Configure SCSI timeouts for the root device (which could be remote)
* Diagnostics
- Console redirection to the serial port
* SCVMM Deployments
- Detect and bootstrap the VMM agent for Linux when running in a System
Center Virtual Machine Manager 2012R2 environment
* VM Extension
- Inject component authored by Microsoft and Partners into Linux VM (IaaS)
to enable software and configuration automation
- VM Extension reference implementation on https://github.com/Azure/azure-linux-extensions
COMMUNICATION
The information flow from the platform to the agent occurs via two channels:
* A boot-time attached DVD for IaaS deployments.
This DVD includes an OVF-compliant configuration file that includes all
provisioning information other than the actual SSH keypairs.
* A TCP endpoint exposing a REST API used to obtain deployment and topology
configuration.
REQUIREMENTS
The following systems have been tested and are known to work with the Azure
Linux Agent. Please note that this list may differ from the official list
of supported systems on the Windows Azure Platform as described here:
http://support.microsoft.com/kb/2805216
Supported Linux Distributions:
* CoreOS
* CentOS 6.2+
* Debian 7.0+
* Ubuntu 12.04+
* openSUSE 12.3+
* SLES 11 SP2+
* Oracle Linux 6.4+
Other Supported Systems:
* FreeBSD 10+ (Azure Linux Agent v2.0.10+)
Waagent depends on some system packages in order to function properly:
* Python 2.6+
* OpenSSL 1.0+
* OpenSSH 5.3+
* Filesystem utilities: sfdisk, fdisk, mkfs, parted
* Password tools: chpasswd, sudo
* Text processing tools: sed, grep
* Network tools: ip-route
INSTALLATION
Installation via your distribution's package repository is preferred.
You can also customize your own RPM or DEB packages using the configuration
files provided (see debian/README and rpm/README).
If installing manually, waagent should be copied to /usr/sbin/waagent and
installed by running:
# sudo chmod 755 /usr/sbin/waagent
# sudo /usr/sbin/waagent -install -verbose
The agent's log file is kept at /var/log/waagent.log.
Note: Provision Guest Agent must be enabled for Linux VM in Azure. But if you are running Linux VM created from your VHD file or unchecked the VM agent option during creating Linux VM in Azure portal, the value of provision guest agent on the VM may not be set to "True". You need run below PowerShell command to set the ProvisionGuestAgent to "True":
Powershell command:
$vm = Get-AzureVM -ServiceName 'MyServiceName' -Name 'MyVMName'
$vm.GetInstance().ProvisionGuestAgent = $true
UPGRADE
Upgrading via your distribution's package repository is preferred.
If upgrading manually, same with installation above, waagent should be copied
to /usr/sbin/waagent to override original file and installed by running:
# sudo chmod 755 /usr/sbin/waagent
Restart waagent service,for most of linux distributions:
#sudo service waagent restart
For Ubuntu, use:
#sudo service walinuxagent restart
For CoreOS, use:
#sudo systemctl restart waagent
Check the agent version, you will see it is updated to new version:
#waagent -version
or(on Ubuntu)
#walinuxagent -version
COMMAND LINE OPTIONS
Flags:
-verbose: Increase verbosity of specified command
-force: Skip interactive confirmation for some commands
Options:
-conf=/path/to/file.conf: Specify configuration file to use instead of default one.
Commands:
-help: Lists the supported commands and flags.
-install: Manual installation of the agent
* Checks the system for required dependencies
* Creates the SysV init script (/etc/init.d/waagent), the logrotate
configuration file (/etc/logrotate.d/waagent) and configures the image
to run the init script on boot
* Writes sample configuration file to /etc/waagent.conf
* Any existing configuration file is moved to /etc/waagent.conf.old
* Detects kernel version and applies the VNUMA workaround if necessary
* Moves udev rules that may interfere with networking
(/lib/udev/rules.d/75-persistent-net-generator.rules,
/etc/udev/rules.d/70-persistent-net.rules) to /var/lib/waagent/
-uninstall: Unregisters the init script from the system and deletes it.
Deletes the logrotate configuration and the waagent config file in
/etc/waagent.conf. Automatic reverting of the VNUMA workaround is not
supported, please edit the GRUB configuration files by hand to re-enable
NUMA if required. Restores any moved udev rules that were moved during
installation.
-deprovision: Attempt to clean the system and make it suitable for
re-provisioning. Deletes the following:
* All SSH host keys
(if Provisioning.RegenerateSshHostKeyPair is 'y' in the configuration
file)
* Nameserver configuration in /etc/resolv.conf
* Root password from /etc/shadow
(if Provisioning.DeleteRootPassword is 'y' in the configuration file)
* Cached DHCP client leases.
* Resets host name to localhost.localdomain.
WARNING! Deprovision does not guarantee that the image is cleared of all
sensitive information and suitable for redistribution.
-deprovision+user: Performs everything under deprovision (above) and also
deletes the last provisioned user account and associated data.
-version: Displays the version of waagent
-serialconsole: Configures GRUB to mark ttyS0 (the first serial port) as
the boot console. This ensures that kernel bootup logs are sent to the
serial port and made available for debugging.
-daemon: Run waagent as a daemon to manage interaction with the platform.
This argument is specified to waagent in the waagent init script.
CONFIGURATION
A configuration file (/etc/waagent.conf) controls the actions of
waagent. A sample configuration file is shown below:
#
# Azure Linux Agent Configuration
#
Role.StateConsumer=None
Role.ConfigurationConsumer=None
Role.TopologyConsumer=None
Provisioning.Enabled=y
Provisioning.DeleteRootPassword=n
Provisioning.RegenerateSshHostKeyPair=y
Provisioning.SshHostKeyPairType=rsa
Provisioning.MonitorHostName=y
Provisioning.DecodeCustomData=n
Provisioning.ExecuteCustomData=n
Provisioning.PasswordCryptId=6
Provisioning.PasswordCryptSaltLength=10
ResourceDisk.Format=y
ResourceDisk.Filesystem=ext4
ResourceDisk.MountPoint=/mnt/resource
ResourceDisk.EnableSwap=n
ResourceDisk.SwapSizeMB=0
LBProbeResponder=y
Logs.File=/var/log/waagent.log
Logs.Console=y
Logs.Verbose=n
OS.RootDeviceScsiTimeout=300
OS.OpensslPath=None
HttpProxy.Host=None
HttpProxy.Port=None
The various configuration options are described in detail below. Configuration
options are of three types : Boolean, String or Integer. The Boolean
configuration options can be specified as "y" or "n". The special keyword "None"
may be used for some string type configuration entries as detailed below.
Configuration File Options:
Role.StateConsumer:
Type: String Default: None
If a path to an executable program is specified, it is invoked when waagent has
provisioned the image and the "Ready" state is about to be reported to the
Fabric. The argument specified to the program will be "Ready". The agent will
not wait for the program to return before continuing.
Role.ConfigurationConsumer:
Type: String Default: None
If a path to an executable program is specified, the program is invoked when the
Fabric indicates that a configuration file is available for the VM. The path to
the XML configuration file is provided as an argument to the executable. This
may be invoked multiple times whenever the configuration file changes. A sample
file is provided in the Appendix. Please note that the XML schema used in this
file may change in the future. The current path of this file is
/var/lib/waagent/HostingEnvironmentConfig.xml.
Role.TopologyConsumer:
Type: String Default: None
If a path to an executable program is specified, the program is invoked when the
Fabric indicates that a new network topology layout is available for the VM. The
path to the XML configuration file is provided as an argument to the executable.
This may be invoked multiple times whenever the network topology changes (due to
service healing for example). A sample file is provided in the Appendix. Please
note that the XML schema used in this file may change in the future. The
current location of this file is /var/lib/waagent/SharedConfig.xml.
Provisioning.Enabled:
Type: Boolean Default: y
This allows the user to enable or disable the provisioning functionality in the
agent. Valid values are "y" or "n". If provisioning is disabled, SSH host and
user keys in the image are preserved and any configuration specified in the
Azure provisioning API is ignored.
Provisioning.DeleteRootPassword:
Type: Boolean Default: n
If set, the root password in the /etc/shadow file is erased during the
provisioning process.
Provisioning.RegenerateSshHostKeyPair:
Type: Boolean Default: y
If set, all SSH host key pairs (ecdsa, dsa and rsa) are deleted during the
provisioning process from /etc/ssh/. And a single fresh key pair is generated.
The encryption type for the fresh key pair is configurable by the
Provisioning.SshHostKeyPairType entry. Please note that some distributions will
re-create SSH key pairs for any missing encryption types when the SSH daemon is
restarted (for example, upon a reboot).
Provisioning.SshHostKeyPairType:
Type: String Default: rsa
This can be set to an encryption algorithm type that is supported by the SSH
daemon on the VM. The typically supported values are "rsa", "dsa" and "ecdsa".
Note that "putty.exe" on Windows does not support "ecdsa". So, if you intend to
use putty.exe on Windows to connect to a Linux deployment, please use "rsa" or
"dsa".
Provisioning.MonitorHostName:
Type: Boolean Default: y
If set, waagent will monitor the Linux VM for hostname changes (as returned by
the "hostname" command) and automatically update the networking configuration in
the image to reflect the change. In order to push the name change to the DNS
servers, networking will be restarted in the VM. This will result in brief loss
of Internet connectivity.
Provisioning.DecodeCustomData:
Type: Boolean Default: n
If set, waagent will decode CustomData from Base64.
Provisioning.ExecuteCustomData:
Type: Boolean Default: n
If set, waagent will execute CustomData after provisioning.
Provisioning.PasswordCryptId:
Type:String Default:6
Algorithm used by crypt when generating password hash.
1 - MD5
2a - Blowfish
5 - SHA-256
6 - SHA-512
Provisioning.PasswordCryptSaltLength
Type:String Default:10
Length of random salt used when generating password hash.
ResourceDisk.Format:
Type: Boolean Default: y
If set, the resource disk provided by the platform will be formatted and mounted
by waagent if the filesystem type requested by the user in
"ResourceDisk.Filesystem" is anything other than "ntfs". A single partition of
type Linux (83) will be made available on the disk. Note that this partition
will not be formatted if it can be successfully mounted.
ResourceDisk.Filesystem:
Type: String Default: ext4
This specifies the filesystem type for the resource disk. Supported values vary
by Linux distribution. If the string is X, then mkfs.X should be present on the
Linux image. SLES 11 images should typically use 'ext3'. FreeBSD images should
use 'ufs2' here.
ResourceDisk.MountPoint:
Type: String Default: /mnt/resource
This specifies the path at which the resource disk is mounted.
ResourceDisk.EnableSwap:
Type: Boolean Default: n
If set, a swap file (/swapfile) is created on the resource disk and added to the
system swap space.
ResourceDisk.SwapSizeMB:
Type: Integer Default: 0
The size of the swap file in megabytes.
LBProbeResponder:
Type: Boolean Default: y
If set, waagent will respond to load balancer probes from the platform (if
present).
Logs.File:
Type: String Default: /dev/stdout
If set, logs are appended to this file (instead of stdout). Bundled
config (config/waagent.conf) sets this to '/var/log/waagent.log'.
Logs.Console:
Type: Boolean Default: n
If set, waagent also logs to serial console. Bundled config (config/waagent.conf)
sets this to 'y'.
Logs.Verbose:
Type: Boolean Default: n
If set, log verbosity is boosted. When waagent logs to file it can
leverage the system logrotate functionality to rotate logs.
OS.RootDeviceScsiTimeout:
Type: Integer Default: 300
This configures the SCSI timeout in seconds on the root device. If not set, the
system defaults are used.
OS.OpensslPath:
Type: String Default: None
This can be used to specify an alternate path for the openssl binary to use for
cryptographic operations.
HttpProxy.Host=None
HttpProxy.Port=None
Type: String Default: None
If set, agent will use proxy server to access internet
APPENDIX
Sample Role Configuration File:
<?xml version="1.0" encoding="utf-8"?> <HostingEnvironmentConfig
version="1.0.0.0" goalStateIncarnation="1">
<StoredCertificates>
<StoredCertificate
name="Stored0Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption"
certificateId="sha1:C093FA5CD3AAE057CB7C4E04532B2E16E07C26CA" storeName="My"
configurationLevel="System" />
</StoredCertificates>
<Deployment name="a99549a92e38498f98cf2989330cd2f1"
guid="{374ef9a2-de81-4412-ac87-e586fc869923}" incarnation="14">
<Service name="LinuxDemo1" guid="{00000000-0000-0000-0000-000000000000}" />
<ServiceInstance name="a99549a92e38498f98cf2989330cd2f1.4"
guid="{250ac9df-e14c-4c5b-9cbc-f8a826ced0e7}" />
</Deployment>
<Incarnation number="1" instance="LinuxVM_IN_2"
guid="{5c87ab8b-2f6a-4758-9f74-37e68c3e957b}" />
<Role guid="{47a04da2-d0b7-26e2-f039-b1f1ab11337a}" name="LinuxVM"
hostingEnvironmentVersion="1" software="" softwareType="ApplicationPackage"
entryPoint="" parameters="" settleTimeSeconds="10" />
<HostingEnvironmentSettings name="full"
Runtime="rd_fabric_stable.111026-1712.RuntimePackage_1.0.0.9.zip">
<CAS mode="full" />
<PrivilegeLevel mode="max" />
<AdditionalProperties><CgiHandlers></CgiHandlers></AdditionalProperties></HostingEnvironmentSettings>
<ApplicationSettings>
<Setting name="__ModelData" value="<m role="LinuxVM"
xmlns="urn:azure:m:v1"><r name="LinuxVM"><e
name="HTTP" /><e
name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Rdp" /><e
name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.RdpInput"
/><e name="SSH" /></r></m>" />
<Setting
name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword"
value="..." />
<Setting
name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration"
value="2015-11-06T23:59:59.0000000-08:00" />
<Setting
name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername"
value="rdos" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled"
value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled"
value="true" />
<Setting name="startpage" value="Hello World!" />
<Setting
name="Certificate|Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption"
value="sha1:C093FA5CD3AAE057CB7C4E04532B2E16E07C26CA" />
</ApplicationSettings>
<ResourceReferences>
<Resource name="DiagnosticStore" type="directory"
request="Microsoft.Cis.Fabric.Controller.Descriptions.ServiceDescription.Data.Policy"
sticky="true" size="1"
path="a99549a92e38498f98cf2989330cd2f1.LinuxVM.DiagnosticStore\"
disableQuota="false" />
</ResourceReferences>
</HostingEnvironmentConfig>
Sample Role Topology File:
<?xml version="1.0" encoding="utf-8"?> <SharedConfig
version="1.0.0.0" goalStateIncarnation="2">
<Deployment name="a99549a92e38498f98cf2989330cd2f1"
guid="{374ef9a2-de81-4412-ac87-e586fc869923}" incarnation="14">
<Service name="LinuxDemo1" guid="{00000000-0000-0000-0000-000000000000}" />
<ServiceInstance name="a99549a92e38498f98cf2989330cd2f1.4"
guid="{250ac9df-e14c-4c5b-9cbc-f8a826ced0e7}" />
</Deployment>
<Incarnation number="1" instance="LinuxVM_IN_1"
guid="{a7b94774-db5c-4007-8707-0b9e91fd808d}" />
<Role guid="{47a04da2-d0b7-26e2-f039-b1f1ab11337a}" name="LinuxVM"
settleTimeSeconds="10" />
<LoadBalancerSettings timeoutSeconds="32" waitLoadBalancerProbeCount="8">
<Probes>
<Probe name="LinuxVM" />
<Probe name="03F7F19398C4358108B7ED059966EEBD" />
<Probe name="47194D0E3AB3FCAD621CAAF698EC82D8" />
</Probes>
</LoadBalancerSettings>
<OutputEndpoints>
<Endpoint name="LinuxVM:Microsoft.WindowsAzure.Plugins.RemoteAccess.Rdp"
type="SFS">
<Target instance="LinuxVM_IN_0"
endpoint="Microsoft.WindowsAzure.Plugins.RemoteAccess.Rdp" />
<Target instance="LinuxVM_IN_1"
endpoint="Microsoft.WindowsAzure.Plugins.RemoteAccess.Rdp" />
<Target instance="LinuxVM_IN_2"
endpoint="Microsoft.WindowsAzure.Plugins.RemoteAccess.Rdp" />
</Endpoint>
</OutputEndpoints>
<Instances>
<Instance id="LinuxVM_IN_1" address="10.115.38.202">
<FaultDomains randomId="1" updateId="1" updateCount="2" />
<InputEndpoints>
<Endpoint name="HTTP" address="10.115.38.202:80" protocol="tcp"
isPublic="true" loadBalancedPublicAddress="70.37.56.176:80"
enableDirectServerReturn="false" isDirectAddress="false"
disableStealthMode="false">
<LocalPorts>
<LocalPortRange from="80" to="80" />
</LocalPorts>
</Endpoint>
<Endpoint name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Rdp"
address="10.115.38.202:3389" protocol="tcp" isPublic="false"
enableDirectServerReturn="false" isDirectAddress="false"
disableStealthMode="false">
<LocalPorts>
<LocalPortRange from="3389" to="3389" />
</LocalPorts>
<RemoteInstances>
<RemoteInstance instance="LinuxVM_IN_0" />
<RemoteInstance instance="LinuxVM_IN_2" />
</RemoteInstances>
</Endpoint>
<Endpoint name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.RdpInput"
address="10.115.38.202:20000" protocol="tcp" isPublic="true"
loadBalancedPublicAddress="70.37.56.176:3389"
enableDirectServerReturn="false" isDirectAddress="false"
disableStealthMode="false">
<LocalPorts>
<LocalPortRange from="20000" to="20000" />
</LocalPorts>
</Endpoint>
<Endpoint name="SSH" address="10.115.38.202:22" protocol="tcp"
isPublic="true" loadBalancedPublicAddress="70.37.56.176:22"
enableDirectServerReturn="false" isDirectAddress="false"
disableStealthMode="false">
<LocalPorts>
<LocalPortRange from="22" to="22" />
</LocalPorts>
</Endpoint>
</InputEndpoints>
</Instance>
<Instance id="LinuxVM_IN_0" address="10.115.58.82">
<FaultDomains randomId="0" updateId="0" updateCount="2" />
<InputEndpoints>
<Endpoint name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Rdp"
address="10.115.58.82:3389" protocol="tcp" isPublic="false"
enableDirectServerReturn="false" isDirectAddress="false"
disableStealthMode="false">
<LocalPorts>
<LocalPortRange from="3389" to="3389" />
</LocalPorts>
</Endpoint>
</InputEndpoints>
</Instance>
<Instance id="LinuxVM_IN_2" address="10.115.58.148">
<FaultDomains randomId="0" updateId="2" updateCount="2" />
<InputEndpoints>
<Endpoint name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Rdp"
address="10.115.58.148:3389" protocol="tcp" isPublic="false"
enableDirectServerReturn="false" isDirectAddress="false"
disableStealthMode="false">
<LocalPorts>
<LocalPortRange from="3389" to="3389" />
</LocalPorts>
</Endpoint>
</InputEndpoints>
</Instance>
</Instances>
</SharedConfig>