|  | @@ -47,6 +47,9 @@ NAMESERVER2='85.214.20.141'
 | 
	
		
			
			| 47 | 47 |  # optional configuration file containing freedombone settings
 | 
	
		
			
			| 48 | 48 |  CONFIG_FILENAME=
 | 
	
		
			
			| 49 | 49 |  
 | 
	
		
			
			|  | 50 | +# Optional ssh public key to allow
 | 
	
		
			
			|  | 51 | +SSH_PUBKEY="no"
 | 
	
		
			
			|  | 52 | +
 | 
	
		
			
			| 50 | 53 |  enable_eatmydata_override() {
 | 
	
		
			
			| 51 | 54 |      chroot $rootdir apt-get install --no-install-recommends -y eatmydata
 | 
	
		
			
			| 52 | 55 |      if [ -x $rootdir/usr/bin/eatmydata ] && \
 | 
	
	
		
			
			|  | @@ -149,6 +152,20 @@ To complete the installation run the following:
 | 
	
		
			
			| 149 | 152 |  ' > $rootdir/etc/init.d/motd
 | 
	
		
			
			| 150 | 153 |  }
 | 
	
		
			
			| 151 | 154 |  
 | 
	
		
			
			|  | 155 | +configure_ssh {
 | 
	
		
			
			|  | 156 | +    if [[ "$SSH_PUBKEY" != "no" ]]; then
 | 
	
		
			
			|  | 157 | +        if [ ! -d $rootdir/home/$MY_USERNAME/.ssh ]; then
 | 
	
		
			
			|  | 158 | +            mkdir $rootdir/home/$MY_USERNAME/.ssh
 | 
	
		
			
			|  | 159 | +        fi
 | 
	
		
			
			|  | 160 | +        echo "$SSH_PUBKEY" > $rootdir/home/$MY_USERNAME/.ssh/authorized_keys
 | 
	
		
			
			|  | 161 | +        chroot $rootdir chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
 | 
	
		
			
			|  | 162 | +        sed -i 's|PasswordAuthentication.*|PasswordAuthentication no|g' $rootdir/etc/ssh/sshd_config
 | 
	
		
			
			|  | 163 | +        echo "Using ssh public key:"
 | 
	
		
			
			|  | 164 | +        echo $SSH_PUBKEY
 | 
	
		
			
			|  | 165 | +        echo 'Password ssh authentication turned off'
 | 
	
		
			
			|  | 166 | +    fi
 | 
	
		
			
			|  | 167 | +}
 | 
	
		
			
			|  | 168 | +
 | 
	
		
			
			| 152 | 169 |  continue_installation {
 | 
	
		
			
			| 153 | 170 |      # If a configuration file exists then run with it
 | 
	
		
			
			| 154 | 171 |      # otherwise the interactive installer can be used
 | 
	
	
		
			
			|  | @@ -252,6 +269,7 @@ fi
 | 
	
		
			
			| 252 | 269 |  set_apt_sources $MIRROR
 | 
	
		
			
			| 253 | 270 |  chroot $rootdir apt-get update
 | 
	
		
			
			| 254 | 271 |  
 | 
	
		
			
			|  | 272 | +configure_ssh
 | 
	
		
			
			| 255 | 273 |  configure_networking
 | 
	
		
			
			| 256 | 274 |  continue_installation
 | 
	
		
			
			| 257 | 275 |  
 |