abc
This commit is contained in:
parent
edfc455de4
commit
3d3d83ad07
|
@ -15,6 +15,11 @@ ssh_authorized_keys_path='/root/.ssh/authorized_keys'
|
||||||
ssh_config_path='/etc/ssh/ssh_config'
|
ssh_config_path='/etc/ssh/ssh_config'
|
||||||
sshd_config_path='/etc/ssh/sshd_config'
|
sshd_config_path='/etc/ssh/sshd_config'
|
||||||
|
|
||||||
|
# Show output of this script
|
||||||
|
if [[ ! -e /etc/conf.d/local ]] && ! grep -q "rc_verbose=yes" /etc/conf.d/local; then
|
||||||
|
echo "rc_verbose=yes" >> /etc/conf.d/local
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if rdnssd is installed, if not put ungleich DNS
|
# Check if rdnssd is installed, if not put ungleich DNS
|
||||||
# into /etc/resolv.conf and install rdnssd for the next time
|
# into /etc/resolv.conf and install rdnssd for the next time
|
||||||
if ! $(which rdnssd); then
|
if ! $(which rdnssd); then
|
||||||
|
@ -38,26 +43,31 @@ if [[ $(get_distro) = "alpine" ]]; then
|
||||||
echo "PasswordAuthentication no" >> $ssh_config_path
|
echo "PasswordAuthentication no" >> $ssh_config_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q "PermitRootLogin yes" $sshd_config_path; then
|
if ! grep -q "PermitRootLogin prohibit-password" $sshd_config_path; then
|
||||||
echo "PermitRootLogin yes" >> $sshd_config_path
|
echo "PermitRootLogin prohibit-password" >> $sshd_config_path
|
||||||
fi
|
fi
|
||||||
service sshd restart
|
service sshd restart
|
||||||
else
|
else
|
||||||
echo "Unsupported OS"
|
echo "Unsupported OS"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO: Try to replace the growpart to parted
|
||||||
|
|
||||||
wget https://git.launchpad.net/ubuntu/+source/cloud-utils/plain/bin/growpart
|
wget https://git.launchpad.net/ubuntu/+source/cloud-utils/plain/bin/growpart
|
||||||
if [ -e growpart ]; then
|
if [ -e growpart ]; then
|
||||||
sh ./growpart /dev/vda3; rm growpart
|
sh ./growpart /dev/vda3; rm growpart
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# TODO: Make sure to replace the following address with http://metadata
|
# TODO: Make sure to replace the following address with http://metadata
|
||||||
# whenever we got http://metadata resolving to url work successfully.
|
# whenever we got http://metadata resolving to url work successfully.
|
||||||
metadata=$(curl http://[2a0a:e5c1:144::]:5000)
|
metadata=$(curl http://[2a0a:e5c1:144::]:5000)
|
||||||
|
|
||||||
ssh_key=$(echo $metadata | jq '.["ssh-key"]')
|
ssh_key=$(echo $metadata | jq '.["ssh-key"]')
|
||||||
ssh_key="${ssh_key:1:-1}" # Removes quotation marks
|
ssh_key=echo $metadata | sed 's/"//g' # Removes quotation marks
|
||||||
|
|
||||||
|
# ssh_key="${ssh_key:1:-1}" # Removes quotation marks
|
||||||
|
|
||||||
if ! grep -q "$ssh_key" $ssh_authorized_keys_path; then
|
if ! grep -q "$ssh_key" $ssh_authorized_keys_path; then
|
||||||
echo $ssh_key >> $ssh_authorized_keys_path
|
echo $ssh_key >> $ssh_authorized_keys_path
|
||||||
|
|
Loading…
Reference in New Issue