-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-install.sh
executable file
·91 lines (86 loc) · 1.91 KB
/
post-install.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
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
#!/bin/sh
exec >/root/post-install.log 2>&1
set -x
# set authorized keys
rm -rf /root/.ssh
mkdir -p /root/.ssh
chmod 700 /root/.ssh
cat >/root/.ssh/authorized_keys <<EOF
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBM0p8Db5YkBi/nGHgSOMp9Q1+aw5ivuwYhz+FjTeFe+ZP7fSNRNmxnRlFS9zBKrcbrjgKb0WariArCKAsNe3TUY= root@6wind
EOF
chmod 600 /root/.ssh/authorized_keys
# update ssh config
cat >/tmp/sshd_config <<EOF
Port 22
Port 29678
Subsystem sftp /usr/lib/openssh/sftp-server
GSSAPIAuthentication no
UsePAM no
UseDNS no
PasswordAuthentication no
PermitRootLogin without-password
AllowUsers root
Match Host 127.0.0.0/8,10.0.0.0/8,185.13.181.2
PasswordAuthentication yes
AllowUsers *
EOF
sshd -T -f /tmp/sshd_config &&
mv -f /tmp/sshd_config /etc/ssh/sshd_config &&
systemctl restart sshd.service
# upgrade system
cat > /etc/apt/sources.list <<EOF
deb http://httpredir.debian.org/debian stretch main non-free contrib
deb http://httpredir.debian.org/debian stretch-updates main non-free contrib
deb http://httpredir.debian.org/debian stretch-backports main non-free contrib
deb http://httpredir.debian.org/debian-security stretch/updates main non-free contrib
EOF
export DEBIAN_FRONTEND=noninteractive
cat >/etc/apt/apt.conf.d/00InstallRecommends <<EOF
APT::Install-Recommends "false";
EOF
cat >/etc/apt/apt.conf.d/99DpkgForceConf <<EOF
Dpkg::Options::="--force-confdef --force-confold";
EOF
apt-get update -qy
apt-get dist-upgrade -qy
apt-get autoremove --purge ovhkernel* ipmitool
apt-get install -qy linux-image-amd64
packages='
bash-completion
build-essential
curl
dbus
default-jre-headless
diffstat
ethtool
git
gzip
htop
libbz2-dev
libffi-dev
liblzma-dev
libssl-dev
libtool
netfilter-persistent
python-apt
python-dev
python-pip
python-setuptools
python-virtualenv
python-wheel
qemu-kvm
rsync
screen
ssh
strace
strongswan
sudo
tcpdump
telnet
tree
unattended-upgrades
wget
xz-utils
zip
'
apt-get install -qy $packages