(1) Added MACHINE_ID in private SSH key (2) removed update/install at boot (only first time)

This commit is contained in:
xdrm-brackets 2017-07-18 17:18:30 +02:00
parent 1506364b93
commit ad8fa10d98
3 changed files with 10 additions and 10 deletions

View File

@ -195,14 +195,14 @@ step6(){
# (1) Create ssh key pair # # (1) Create ssh key pair #
echo " (.) Create ssh key [ecdsa:521]"; echo " (.) Create ssh key [ecdsa:521]";
ssh-keygen -t ecdsa -b 521 -C "[ECDSA:521] SATS" -f ./tmp/id_ecdsa -P "" 2> /dev/null > /dev/null; ssh-keygen -t ecdsa -b 521 -C "[ECDSA:521] SATS@$MACHINE_ID" -f ./tmp/id_ecdsa -P "" 2> /dev/null > /dev/null;
# (2) Add public key to server's `authorized_keys` file # # (2) Add public key to server's `authorized_keys` file #
echo " (.) Add public key to server's list"; echo " (.) Add public key to server's list";
test ! -e ./server/authorized_keys && touch ./server/authorized_keys; test ! -e ./server/authorized_keys && touch ./server/authorized_keys;
cat ./tmp/id_ecdsa.pub >> ./server/authorized_keys; cat ./tmp/id_ecdsa.pub >> ./server/authorized_keys;
# (3) Create ssh file system # # (3) Create ssh file system #
echo " (.) Init ssh folder (/home/sats/.ssh)"; echo " (.) Init ssh folder (/home/sats/.ssh)";
sudo mkdir -p /mnt/home/sats/.ssh; sudo mkdir -p /mnt/home/sats/.ssh;

View File

@ -15,7 +15,7 @@ export SERVER_HOSTNAME="xdrm.io";
export SERVER_USERNAME="satsd"; export SERVER_USERNAME="satsd";
# DEFAULT SATS SETTINGS # DEFAULT SATS SETTINGS
export MACHINE_ID="127"; export MACHINE_ID="126";
export MACHINE_BRANCH="1.0"; export MACHINE_BRANCH="1.0";
export MACHINE_STATE="000"; export MACHINE_STATE="000";
export API_URL="https://logauth.xdrm.io/api/machineDefault"; export API_URL="https://logauth.xdrm.io/api/machineDefault";

View File

@ -24,12 +24,6 @@ RANDOM_PASS=$(tr -cd A-Za-z0-9_ < /dev/urandom | head -c 256);
echo "$RANDOM_PASS\n$RANDOM_PASS\n" | sudo passwd pi; echo "$RANDOM_PASS\n$RANDOM_PASS\n" | sudo passwd pi;
echo "pi password changed" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null; echo "pi password changed" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
# [5] Try to install necessary packages
sudo apt-get update;
echo "package update done" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
sudo apt-get -y install git php5 php5-cli php5-curl python-dev;
echo "package install done" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
@ -38,11 +32,17 @@ echo "package install done" | sudo -u sats tee -a /home/sats/satsd/log/install.l
################################################ ################################################
if [ ! -e /target/install ]; then if [ ! -e /target/install ]; then
# (1) Try to install necessary packages
sudo apt-get update;
echo "package update done" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
sudo apt-get -y install git php5 php5-cli php5-curl python-dev;
echo "package install done" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;
dpkg -s git 2>/dev/null >/dev/null && gitinstalled=1 || gitinstalled=0; dpkg -s git 2>/dev/null >/dev/null && gitinstalled=1 || gitinstalled=0;
BRANCH=$(sudo cat /home/sats/satsd/conf/machine.branch) > /dev/null; BRANCH=$(sudo cat /home/sats/satsd/conf/machine.branch) > /dev/null;
# (1) With git if installed # # (2) With git if installed #
if [ $gitinstalled -eq 1 ]; then if [ $gitinstalled -eq 1 ]; then
echo "cloning source.." | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null; echo "cloning source.." | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;