forked from plus3it/amigen7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NetSet.sh
executable file
·37 lines (33 loc) · 858 Bytes
/
NetSet.sh
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
#!/bin/sh
#
# Script to enable networking in the EL7 AMI:
# * Enable DHCP client for default interface (eth0)
# * Configure basic networking-behavior
# * Configure basic SSHD behavior
#
#################################################################
CHROOT="${CHROOT:-/mnt/ec2-root}"
# Create default if-script
cat <<EOF > "${CHROOT}/etc/sysconfig/network-scripts/ifcfg-eth0"
DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
TYPE="Ethernet"
USERCTL="yes"
PEERDNS="yes"
IPV6INIT="no"
PERSISTENT_DHCLIENT="1"
EOF
# Create stub network config scripts
cat <<EOF > "${CHROOT}/etc/sysconfig/network"
NETWORKING="yes"
NETWORKING_IPV6="no"
NOZEROCONF="yes"
HOSTNAME="localhost.localdomain"
EOF
# Make ssh relax about root logins
cat <<EOF >> "${CHROOT}/etc/ssh/sshd_config"
UseDNS no
PermitRootLogin without-password
EOF
chroot "${CHROOT}" systemctl enable network