cloud-init.tpl 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #cloud-config
  2. preserve_hostname: false
  3. prefer_fqdn_over_hostname: true
  4. manage_etc_hosts: true
  5. hostname: ${hostname}
  6. salt-master: ${salt_master}
  7. fqdn: ${fqdn}
  8. apt:
  9. http_proxy: "http://${proxy}:80/"
  10. https_proxy: "http://${proxy}:80/"
  11. # Ubuntu Advantage - broken? Using cmd.run
  12. #ubuntu_advantage:
  13. # enable:
  14. # - fips
  15. # - cis
  16. # - esm-infra
  17. # - fips-updates
  18. # - livepatch # no livepatch with fips!
  19. # Write files happens early
  20. write_files:
  21. - content: |
  22. http_proxy="http://${proxy}:80/"
  23. https_proxy="http://${proxy}:80/"
  24. no_proxy=localhost,127.0.0.1,169.254.169.254
  25. path: /etc/environment
  26. append: true
  27. - content: |
  28. Acquire::http::Proxy "http://${proxy}:80/";
  29. Acquire::https::Proxy "http://${proxy}:80/";
  30. APT::ExtractTemplates::TempDir "/opt/tmp/";
  31. path: /etc/apt/apt.conf.d/75xdrexecpath
  32. append: true
  33. - content: |
  34. [global]
  35. proxy=${proxy}:80
  36. path: /etc/pip.conf
  37. - content: |
  38. export HTTPS_PROXY=http://${proxy}:80
  39. export HTTP_PROXY=http://${proxy}:80
  40. export NO_PROXY=localhost,127.0.0.1,169.254.169.254,pvt.xdrtest.accenturefederalcyber.com,pvt.xdr.accenturefederalcyber.com,reposerver.msoc.defpoint.local,jenkins.msoc.defpoint.local,pod1search-splunk-sh.msoc.defpoint.local,s3.amazonaws.com,ssm.${ aws_region }.amazonaws.com,ec2messages.${ aws_region }.amazonaws.com,ec2.${ aws_region }.amazonaws.com,ssmmessages.${ aws_region }.amazonaws.com,iratemoses.mdr.defpoint.com,jira.mdr.defpoint.com,reposerver.pvt.xdr.accenturefederalcyber.com,jenkins.pvt.xdr.accenturefederalcyber.com,pod1search-splunk-sh.pvt.xdr.accenturefederalcyber.com,reposerver.pvt.xdrtest.accenturefederalcyber.com,jenkins.pvt.xdrtest.accenturefederalcyber.com,pod1search-splunk-sh.pvt.xdrtest.accenturefederalcyber.com,iratemoses.xdr.accenturefederalcyber.com,jira.xdr.accenturefederalcyber.com,iratemoses.xdrtest.accenturefederalcyber.com,jira.xdrtest.accenturefederalcyber.com
  41. export https_proxy=$HTTPS_PROXY
  42. export http_proxy=$HTTP_PROXY
  43. export no_proxy=$NO_PROXY
  44. path: /etc/profile.d/proxy.sh
  45. - content: |
  46. net.ipv6.conf.eth0.disable_ipv6 = 1
  47. permissions: 0644
  48. owner: root
  49. path: /etc/sysctl.d/10-disable-ipv6.conf
  50. - content: |
  51. ${fqdn}
  52. path: /etc/salt/minion_id
  53. - content: |
  54. master: ${salt_master}
  55. path: /etc/salt/minion
  56. - content: |
  57. grains:
  58. environment: ${ environment }
  59. aws_partition: ${ aws_partition }
  60. aws_partition_alias: ${ aws_partition_alias }
  61. aws_region: ${ aws_region }
  62. path: /etc/salt/minion.d/cloud_init_grains.conf
  63. #yum_repos:
  64. # epel-release:
  65. # baseurl: http://download.fedoraproject.org/pub/epel/7/$basearch
  66. # enabled: false
  67. # failovermethod: priority
  68. # gpgcheck: true
  69. # gpgkey: http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
  70. # name: Extra Packages for Enterprise Linux 7 - Release
  71. packages:
  72. - vim
  73. - ubuntu-advantage-tools
  74. package_update: true # Always patch
  75. growpart:
  76. mode: auto
  77. devices: [ '/', '/var', '/var/log', '/var/log/audit', '/var/tmp', '/tmp', '/home' ]
  78. ignore_growroot_disabled: false
  79. runcmd:
  80. - find /usr/local/lib -type f -exec chmod o+r {} \;
  81. - export http_proxy=http://${proxy}:80
  82. - export https_proxy=http://${proxy}:80
  83. - export no_proxy=localhost,127.0.0.1,169.254.169.254
  84. - ua auto-attach
  85. - ua enable --assume-yes usg
  86. # - ua enable --assume-yes usg fips fips-updates
  87. # - /usr/share/ubuntu-scap-security-guides/cis-hardening/Canonical_Ubuntu_20.04_CIS-harden.sh lvl2_server
  88. - apt update
  89. - apt upgrade -y
  90. - apt install -y usg
  91. - usg fix cis_level2_server
  92. # VMRay is incompatible with firewalld, but this should be enabled for other ubuntu systems
  93. #- apt install -y firewalld
  94. #- /bin/systemctl start firewalld
  95. #- /bin/systemctl enable firewalld
  96. - /bin/systemctl restart salt-minion
  97. - /bin/systemctl enable salt-minion
  98. - /bin/systemctl start snap.amazon-ssm-agent.amazon-ssm-agent.service
  99. - /bin/systemctl enable snap.amazon-ssm-agent.amazon-ssm-agent.service
  100. - /usr/sbin/aide --update --verbose=0
  101. - /bin/cp /var/lib/aide/aide.db.new /var/lib/aide/aide.db
  102. - /sbin/xfs_growfs /tmp
  103. # Either final message or power state, but probably not both
  104. #final_message: "The system is up after $UPTIME seconds"
  105. power_state:
  106. # delay is in minutes
  107. delay: "+1"
  108. mode: reboot
  109. message: "System configured after $UPTIME seconds"
  110. # timeout: 300
  111. # condition: true