vsftpd/azuredeploy.json

raw link view readme
1 {
2 "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3 "contentVersion": "1.0.0.0",
4 "parameters": {
5 "admin-username": {
6 "type": "string"
7 },
8 "ssh-public-key": {
9 "type": "string"
10 }
11 },
12 "variables": {
13 "ssh-keypath": "[concat('/home/', parameters('admin-username'), '/.ssh/authorized_keys')]",
14 "unique-prefix": "[concat(replace(resourceGroup().name,'-',''), substring(uniquestring(resourceGroup().name), 0, 5))]",
15 "storage-name": "[variables('unique-prefix')]",
16 "vnet-name": "[concat(resourceGroup().name, '-vnet')]",
17 "ip-prefix": "[concat(resourceGroup().name, '-ip-')]",
18 "nsg-prefix": "[concat(resourceGroup().name, '-nsg')]",
19 "nic-prefix": "[concat(resourceGroup().name, '-nic-')]",
20 "access-nic-internal": "[concat(resourceGroup().name, '-access-nic-internal')]",
21 "access-nic-external": "[concat(resourceGroup().name, '-access-nic-external')]",
22 "vm-prefix": "[concat(resourceGroup().name, '-vm-')]",
23 "names": [ "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", "iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi", "rho", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega" ],
24 "private-vm-size": "Standard_DS1_v2",
25 "vnet-address-space": "10.16.0.0/12",
26 "vnet-subnet01-octet": 17
27 },
28 "resources": [
29 {
30 "comments": "",
31 "type": "Microsoft.Network/publicIPAddresses",
32 "name": "[concat(variables('ip-prefix'), variables('names')[0])]",
33 "apiVersion": "2017-03-01",
34 "location": "[resourceGroup().location]",
35 "properties": {
36 "publicIPAllocationMethod": "Dynamic",
37 "idleTimeoutInMinutes": 4,
38 "dnsSettings": {
39 "domainNameLabel": "[concat(variables('unique-prefix'), '-', variables('names')[0])]"
40 }
41 },
42 "resources": [],
43 "dependsOn": []
44 },
45 {
46 "comments": "",
47 "type": "Microsoft.Network/publicIPAddresses",
48 "name": "[concat(variables('ip-prefix'), variables('names')[1])]",
49 "apiVersion": "2017-03-01",
50 "location": "[resourceGroup().location]",
51 "properties": {
52 "publicIPAllocationMethod": "Dynamic",
53 "idleTimeoutInMinutes": 4,
54 "dnsSettings": {
55 "domainNameLabel": "[concat(variables('unique-prefix'), '-', variables('names')[1])]"
56 }
57 },
58 "resources": [],
59 "dependsOn": []
60 },
61 {
62 "comments": "",
63 "type": "Microsoft.Compute/virtualMachines",
64 "name": "[concat(variables('vm-prefix'), variables('names')[0])]",
65 "apiVersion": "2016-04-30-preview",
66 "location": "[resourceGroup().location]",
67 "properties": {
68 "hardwareProfile": {
69 "vmSize": "Standard_DS2_v2"
70 },
71 "storageProfile": {
72 "imageReference": {
73 "publisher": "OpenLogic",
74 "offer": "CentOS",
75 "sku": "7.2",
76 "version": "latest"
77 },
78 "osDisk": {
79 "name": "[concat(variables('vm-prefix'), variables('names')[0], '-boot')]",
80 "createOption": "FromImage",
81 "vhd": {
82 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[0], '-boot.vhd')]"
83 },
84 "caching": "ReadWrite"
85 }
86 },
87 "osProfile": {
88 "computerName": "[concat(variables('vm-prefix'), variables('names')[0])]",
89 "adminUsername": "[parameters('admin-username')]",
90 "linuxConfiguration": {
91 "disablePasswordAuthentication": true,
92 "ssh": {
93 "publicKeys": [
94 {
95 "path": "[variables('ssh-keypath')]",
96 "keyData": "[parameters('ssh-public-key')]"
97 }
98 ]
99 }
100 }
101 },
102 "networkProfile": {
103 "networkInterfaces": [
104 {
105 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]"
106 }
107 ]
108 }
109 },
110 "resources": [],
111 "dependsOn": [
112 "[resourceId('Microsoft.Storage/storageAccounts', variables('storage-name'))]",
113 "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[0]))]"
114 ]
115 },
116 {
117 "type": "Microsoft.Compute/virtualMachines/extensions",
118 "name": "[concat(variables('vm-prefix'), variables('names')[0], '/script')]",
119 "apiVersion": "2015-05-01-preview",
120 "location": "[resourceGroup().location]",
121 "dependsOn": [
122 "[concat(variables('vm-prefix'), variables('names')[0])]"
123 ],
124 "properties": {
125 "publisher": "Microsoft.Azure.Extensions",
126 "type": "CustomScript",
127 "typeHandlerVersion": "2.0",
128 "autoUpgradeMinorVersion": true,
129 "settings": {
130 "fileUris": [
131 "https://linux.azure.david.betz.space/raw/vsftpd/service-install.sh"
132 ],
133 "commandToExecute": "sh service-install.sh"
134 }
135 }
136 },
137 {
138 "comments": "",
139 "type": "Microsoft.Compute/virtualMachines",
140 "name": "[concat(variables('vm-prefix'), variables('names')[1])]",
141 "apiVersion": "2016-04-30-preview",
142 "location": "[resourceGroup().location]",
143 "properties": {
144 "hardwareProfile": {
145 "vmSize": "[variables('private-vm-size')]"
146 },
147 "storageProfile": {
148 "imageReference": {
149 "publisher": "OpenLogic",
150 "offer": "CentOS",
151 "sku": "7.2",
152 "version": "latest"
153 },
154 "osDisk": {
155 "name": "[concat(concat(variables('vm-prefix'), variables('names')[1]), '-boot')]",
156 "createOption": "FromImage",
157 "vhd": {
158 "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storage-name')), '2015-06-15').primaryEndpoints.blob, 'vhds/', variables('names')[1], '-boot.vhd')]"
159 },
160 "caching": "ReadWrite"
161 }
162 },
163 "osProfile": {
164 "computerName": "[concat(variables('vm-prefix'), variables('names')[1])]",
165 "adminUsername": "[parameters('admin-username')]",
166 "linuxConfiguration": {
167 "disablePasswordAuthentication": true,
168 "ssh": {
169 "publicKeys": [
170 {
171 "path": "[variables('ssh-keypath')]",
172 "keyData": "[parameters('ssh-public-key')]"
173 }
174 ]
175 }
176 }
177 },
178 "networkProfile": {
179 "networkInterfaces": [
180 {
181 "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[1]))]"
182 }
183 ]
184 }
185 },
186 "resources": [],
187 "dependsOn": [
188 "[resourceId('Microsoft.Storage/storageAccounts', variables('storage-name'))]",
189 "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nic-prefix'), variables('names')[1]))]"
190 ]
191 },
192 {
193 "type": "Microsoft.Compute/virtualMachines/extensions",
194 "name": "[concat(variables('vm-prefix'), variables('names')[1], '/script')]",
195 "apiVersion": "2015-05-01-preview",
196 "location": "[resourceGroup().location]",
197 "dependsOn": [
198 "[concat(variables('vm-prefix'), variables('names')[1])]"
199 ],
200 "properties": {
201 "publisher": "Microsoft.Azure.Extensions",
202 "type": "CustomScript",
203 "typeHandlerVersion": "2.0",
204 "autoUpgradeMinorVersion": true,
205 "settings": {
206 "fileUris": [
207 "https://linux.azure.david.betz.space/raw/vsftpd/client-install.sh"
208 ],
209 "commandToExecute": "[concat('sh client-install.sh ', variables('unique-prefix'), '-', variables('names')[0], '.', resourceGroup().location, '.cloudapp.azure.com')]"
210 }
211 }
212 },
213 {
214 "comments": "",
215 "type": "Microsoft.Network/networkInterfaces",
216 "name": "[concat(variables('nic-prefix'), variables('names')[0])]",
217 "apiVersion": "2017-03-01",
218 "location": "[resourceGroup().location]",
219 "properties": {
220 "ipConfigurations": [
221 {
222 "name": "ifconfig1",
223 "properties": {
224 "privateIPAddress": "[concat('10.', variables('vnet-subnet01-octet'), '.0.4')]",
225 "privateIPAllocationMethod": "Static",
226 "publicIPAddress": {
227 "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]"
228 },
229 "subnet": {
230 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet01')]"
231 }
232 }
233 }
234 ],
235 "dnsSettings": {
236 "dnsServers": []
237 },
238 "enableIPForwarding": false,
239 "networkSecurityGroup": {
240 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
241 }
242 },
243 "resources": [],
244 "dependsOn": [
245 "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[0]))]",
246 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
247 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[0]))]"
248 ]
249 },
250 {
251 "comments": "",
252 "type": "Microsoft.Network/networkInterfaces",
253 "name": "[concat(variables('nic-prefix'), variables('names')[1])]",
254 "apiVersion": "2017-03-01",
255 "location": "[resourceGroup().location]",
256 "properties": {
257 "ipConfigurations": [
258 {
259 "name": "ifconfig",
260 "properties": {
261 "privateIPAddress": "[concat('10.', variables('vnet-subnet01-octet'), '.0.5')]",
262 "privateIPAllocationMethod": "Static",
263 "publicIPAddress": {
264 "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('ip-prefix'), variables('names')[1]))]"
265 },
266 "subnet": {
267 "id": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name')), '/subnets/subnet01')]"
268 }
269 }
270 }
271 ],
272 "dnsSettings": {
273 "dnsServers": []
274 },
275 "enableIPForwarding": false,
276 "networkSecurityGroup": {
277 "id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[1]))]"
278 }
279 },
280 "resources": [],
281 "dependsOn": [
282 "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet-name'))]",
283 "[resourceId('Microsoft.Network/networkSecurityGroups', concat(variables('nsg-prefix'), variables('names')[1]))]"
284 ]
285 },
286 {
287 "comments": "",
288 "type": "Microsoft.Network/virtualNetworks",
289 "name": "[variables('vnet-name')]",
290 "apiVersion": "2017-03-01",
291 "location": "[resourceGroup().location]",
292 "properties": {
293 "addressSpace": {
294 "addressPrefixes": [
295 "[variables('vnet-address-space')]"
296 ]
297 },
298 "subnets": [
299 {
300 "name": "subnet01",
301 "properties": {
302 "addressPrefix": "[concat('10.', variables('vnet-subnet01-octet'), '.0.0/16')]"
303 }
304 }
305 ]
306 },
307 "resources": [],
308 "dependsOn": []
309 },
310 {
311 "comments": "",
312 "type": "Microsoft.Network/networkSecurityGroups",
313 "name": "[concat(variables('nsg-prefix'), variables('names')[0])]",
314 "apiVersion": "2017-03-01",
315 "location": "[resourceGroup().location]",
316 "properties": {
317 "securityRules": [
318 {
319 "name": "default-allow-ssh",
320 "properties": {
321 "protocol": "Tcp",
322 "sourcePortRange": "*",
323 "destinationPortRange": "22",
324 "sourceAddressPrefix": "*",
325 "destinationAddressPrefix": "*",
326 "access": "Allow",
327 "priority": 1000,
328 "direction": "Inbound"
329 }
330 },
331 {
332 "name": "ftp",
333 "properties": {
334 "protocol": "Tcp",
335 "sourcePortRange": "*",
336 "destinationPortRange": "21",
337 "sourceAddressPrefix": "*",
338 "destinationAddressPrefix": "*",
339 "access": "Allow",
340 "priority": 1100,
341 "direction": "Inbound"
342 }
343 },
344 {
345 "name": "ftp-pasv",
346 "properties": {
347 "protocol": "Tcp",
348 "sourcePortRange": "*",
349 "destinationPortRange": "40000",
350 "sourceAddressPrefix": "*",
351 "destinationAddressPrefix": "*",
352 "access": "Allow",
353 "priority": 1200,
354 "direction": "Inbound"
355 }
356 }
357 ]
358 },
359 "resources": [],
360 "dependsOn": []
361 },
362 {
363 "comments": "",
364 "type": "Microsoft.Network/networkSecurityGroups",
365 "name": "[concat(variables('nsg-prefix'), variables('names')[1])]",
366 "apiVersion": "2017-03-01",
367 "location": "[resourceGroup().location]",
368 "properties": {
369 "securityRules": [
370 {
371 "name": "default-allow-ssh",
372 "properties": {
373 "protocol": "Tcp",
374 "sourcePortRange": "*",
375 "destinationPortRange": "22",
376 "sourceAddressPrefix": "*",
377 "destinationAddressPrefix": "*",
378 "access": "Allow",
379 "priority": 1000,
380 "direction": "Inbound"
381 }
382 }
383 ]
384 },
385 "resources": [],
386 "dependsOn": []
387 },
388 {
389 "comments": "",
390 "type": "Microsoft.Storage/storageAccounts",
391 "sku": {
392 "name": "Standard_LRS",
393 "tier": "Standard"
394 },
395 "kind": "Storage",
396 "name": "[variables('storage-name')]",
397 "apiVersion": "2016-01-01",
398 "location": "[resourceGroup().location]",
399 "tags": {},
400 "properties": { },
401 "resources": [],
402 "dependsOn": []
403 }
404 ],
405 "outputs": {
406 "alpha": {
407 "type": "string",
408 "value": "[concat('ssh ', variables('unique-prefix'), '-', variables('names')[0], '.', resourceGroup().location, '.cloudapp.azure.com')]"
409 },
410 "beta": {
411 "type": "string",
412 "value": "[concat('ssh ', variables('unique-prefix'), '-', variables('names')[1], '.', resourceGroup().location, '.cloudapp.azure.com')]"
413 }
414 }
415 }
416
417
418
419
420