Bladeren bron

Ensure that there is a security repo

Bob Mottram 10 jaren geleden
bovenliggende
commit
04e4d301eb
1 gewijzigde bestanden met toevoegingen van 31 en 18 verwijderingen
  1. 31
    18
      install-freedombone.sh

+ 31
- 18
install-freedombone.sh Bestand weergeven

52
 KERNEL_VERSION="v3.15.10-bone7"
52
 KERNEL_VERSION="v3.15.10-bone7"
53
 USE_HWRNG="yes"
53
 USE_HWRNG="yes"
54
 
54
 
55
+# The Debian package repository to use.
56
+DEBIAN_REPO="ftp.de.debian.org"
57
+
58
+DEBIAN_VERSION="jessie"
59
+
55
 # Directory where source code is downloaded and compiled
60
 # Directory where source code is downloaded and compiled
56
 INSTALL_DIR=/root/build
61
 INSTALL_DIR=/root/build
57
 
62
 
98
   echo 'remove_proprietary_repos' >> $COMPLETION_FILE
103
   echo 'remove_proprietary_repos' >> $COMPLETION_FILE
99
 }
104
 }
100
 
105
 
101
-function https_repos {
102
-  # The lack of https repos by default is I think a significant security
103
-  # problem, potentially allowing an adversary to modify package downloads,
104
-  # checksums or gpg public keys in transit and also to know what is installed
105
-  # on your system
106
-  # See http://forums.debian.net/viewtopic.php?f=10&t=74444
107
-  # https://wiki.debian.org/SecureApt
108
-  if grep -Fxq "https_repos" $COMPLETION_FILE; then
106
+function change_debian_repos {
107
+  if grep -Fxq "change_debian_repos" $COMPLETION_FILE; then
109
 	  return
108
 	  return
110
   fi
109
   fi
111
-  apt-get -y update
112
-  # Since at the present time this does not work it's commented out
113
-  #apt-get -y --force-yes install apt-transport-https
114
-  #sed -i 's/http:/https:/g' /etc/apt/sources.list
115
-  echo 'https_repos' >> $COMPLETION_FILE
110
+  rm -rf /var/lib/apt/lists/*
111
+  apt-get clean
112
+  sed -i "s/ftp.us.debian.org/$DEBIAN_REPO/g" /etc/apt/sources.list
113
+
114
+  # ensure that there is a security repo
115
+  if ! grep -q "security" /etc/apt/sources.list; then
116
+      if grep -q "jessie" /etc/apt/sources.list; then
117
+          echo "deb http://security.debian.org/ jessie/updates main contrib" >> /etc/apt/sources.list
118
+          echo "#deb-src http://security.debian.org/ jessie/updates main contrib" >> /etc/apt/sources.list
119
+	  else
120
+          if grep -q "wheezy" /etc/apt/sources.list; then
121
+              echo "deb http://security.debian.org/ wheezy/updates main contrib" >> /etc/apt/sources.list
122
+              echo "#deb-src http://security.debian.org/ wheezy/updates main contrib" >> /etc/apt/sources.list
123
+		  fi
124
+	  fi
125
+  fi
126
+
127
+  apt-get update
128
+  echo 'change_debian_repos' >> $COMPLETION_FILE
116
 }
129
 }
117
 
130
 
118
 function initial_setup {
131
 function initial_setup {
137
   if grep -Fxq "enable_backports" $COMPLETION_FILE; then
150
   if grep -Fxq "enable_backports" $COMPLETION_FILE; then
138
 	  return
151
 	  return
139
   fi
152
   fi
140
-  if ! grep -Fxq "deb http://ftp.us.debian.org/debian jessie-backports main" /etc/apt/sources.list; then
141
-    echo "deb http://ftp.us.debian.org/debian jessie-backports main" >> /etc/apt/sources.list
153
+  if ! grep -Fxq "deb https://$DEBIAN_REPO/debian jessie-backports main" /etc/apt/sources.list; then
154
+    echo "deb https://$DEBIAN_REPO/debian jessie-backports main" >> /etc/apt/sources.list
142
   fi
155
   fi
143
   echo 'enable_backports' >> $COMPLETION_FILE
156
   echo 'enable_backports' >> $COMPLETION_FILE
144
 }
157
 }
573
 	  return
586
 	  return
574
   fi
587
   fi
575
   apt-get -y remove postfix
588
   apt-get -y remove postfix
576
-  apt-get -y install exim4-daemon-heavy sasl2-bin swaks libnet-ssleay-perl procmail
589
+  apt-get -y install exim4 sasl2-bin swaks libnet-ssleay-perl procmail
577
   echo 'dc_eximconfig_configtype="internet"' > /etc/exim4/update-exim4.conf.conf
590
   echo 'dc_eximconfig_configtype="internet"' > /etc/exim4/update-exim4.conf.conf
578
   echo "dc_other_hostnames='$DOMAIN_NAME'" >> /etc/exim4/update-exim4.conf.conf
591
   echo "dc_other_hostnames='$DOMAIN_NAME'" >> /etc/exim4/update-exim4.conf.conf
579
   echo "dc_local_interfaces=''" >> /etc/exim4/update-exim4.conf.conf
592
   echo "dc_local_interfaces=''" >> /etc/exim4/update-exim4.conf.conf
965
 configure_firewall_for_ftp
978
 configure_firewall_for_ftp
966
 configure_firewall_for_web
979
 configure_firewall_for_web
967
 remove_proprietary_repos
980
 remove_proprietary_repos
968
-https_repos
981
+change_debian_repos
982
+enable_backports
969
 configure_dns
983
 configure_dns
970
 initial_setup
984
 initial_setup
971
 install_editor
985
 install_editor
972
 change_login_message
986
 change_login_message
973
-enable_backports
974
 update_the_kernel
987
 update_the_kernel
975
 enable_zram
988
 enable_zram
976
 random_number_generator
989
 random_number_generator