forked from Freifunk-Nord/nord-puppet-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre-puppet.sh
executable file
·92 lines (77 loc) · 3.09 KB
/
pre-puppet.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
92
#!/bin/bash
#https://github.com/ffnord/ffnord-puppet-gateway
NAME="Freifunk Kiel"
OPERATOR="Max"
CHANGELOG="http://issues.freifunk.in-kiel.de/"
HOST_PREFIX="vpn"
MESH_CODE="ffki"
SUBDOMAIN_PREFIX=vpn
VPN_NUMBER=6
DOMAIN="freifunk.in-kiel.de"
SUDOUSERNAME="rubo77"
TLD=ffki
#backborts einbauen
echo "deb http://http.debian.net/debian jessie-backports main" >>/etc/apt/sources.list
#sysupgrade
apt-get update && apt-get dist-upgrade && apt-get upgrade
#add users:
useradd -U -G sudo -m $SUDOUSERNAME
#MOTD setzen
rm /etc/motd
echo "*********************************************************" >>/etc/motd
echo " $NAME - Gateway $SUBDOMAIN_PREFIX$VPN_NUMBER $NAME " >>/etc/motd
echo " Hoster: $OPERATOR *" >>/etc/motd
echo "*******************************************************" >>/etc/motd
echo " " >>/etc/motd
echo " Changelog: " >>/etc/motd
echo " $CHANGELOG " >>/etc/motd
echo " *" >>/etc/motd
echo " Happy Hacking! *" >>/etc/motd
echo "**********************************************************" >>/etc/motd
#Hostname setzen
#hostname $HOST_PREFIX$VPN_NUMBER
#echo "127.0.1.1 $SUBDOMAIN_PREFIX$VPN_NUMBER.$DOMAIN $HOST_PREFIX$VPN_NUMBER" >>/etc/hosts
#mv /etc/hostname /var/tmp/hostname-bak
#echo "$HOST_PREFIX$VPN_NUMBER" >>/etc/hostname
# install needed packages
apt-get -y install sudo apt-transport-https git
# optional pre installed to speed up the setup:
apt-get -y install bash-completion haveged sshguard tcpdump mtr-tiny vim nano unp mlocate screen tmux cmake build-essential libcap-dev pkg-config libgps-dev python3 ethtool lsb-release zip locales-all ccze ncdu
#not needed packages from standard OVH template
apt-get -y remove nginx nginx-full exim mutt
#puppet modules install
apt-get -y install --no-install-recommends puppet
puppet module install puppetlabs-stdlib --version 4.15.0 && \
puppet module install puppetlabs-apt --version 1.5.1 && \
puppet module install puppetlabs-vcsrepo --version 1.3.2 && \
puppet module install saz-sudo --version 4.1.0 && \
puppet module install torrancew-account --version 0.1.0
cd /etc/puppet/modules
git clone https://github.com/ffnord/ffnord-puppet-gateway ffnord
# symlink check-install script
ln -s /etc/puppet/modules/ffnord/files/usr/local/bin/check-services /root/check-services
# add aliases
cat <<-EOF>> /root/.bashrc
export LS_OPTIONS='--color=auto'
eval " \`dircolors\`"
alias ls='ls \$LS_OPTIONS'
alias ll='ls \$LS_OPTIONS -lah'
alias l='ls \$LS_OPTIONS -lA'
alias grep="grep --color=auto"
alias nano="nano -Si"
# let us only use aptitude on gateways
alias apt-get='sudo aptitude'
alias ..="cd .."
EOF
# back in /root
cd /root
echo load the ip_tables and ip_conntrack module
modprobe ip_conntrack
echo ip_conntrack >> /etc/modules
#USER TODO:
echo 'now copy the files manifest.pp and mesh_peerings.yaml to /root and make sure /root/fastd_secret.key exists'
echo '####################################################################################'
echo '########### don´t run the following scripts without screen sesssion!!! #############'
echo '####################################################################################'
cd -
cat $(dirname $0 )/README.md