Skip to content

Instantly share code, notes, and snippets.

@dongfg
Last active April 3, 2023 08:10
Show Gist options
  • Save dongfg/e2f93851c0cc2769e36f8f37795da911 to your computer and use it in GitHub Desktop.
Save dongfg/e2f93851c0cc2769e36f8f37795da911 to your computer and use it in GitHub Desktop.
iOS iSH init
#!/bin/sh
# ios ish setup
# wget -qO - http://10.64.60.244:9000/setup.sh | sh
# 文件/文本加密:
# echo "this is a secret." | openssl enc -e -des3 -base64 -pbkdf2 -A
# cat ~/.ssh/id_rsa_vps | openssl enc -e -des3 -base64 -pbkdf2 -A
printf "1. 更换镜像源...\n"
mirror=$(sed -e 's/https:\/\/\(.*\)\/alpine.*/\1/' /etc/apk/repositories | uniq)
newMirror="mirrors.tuna.tsinghua.edu.cn"
printf "当前镜像源: $mirror\n"
sed -i "s/$mirror/$newMirror/g" /etc/apk/repositories
printf "切换到镜像源: $newMirror\n"
apk update && apk upgrade
printf "\n"
printf "2. 安装常用软件...\n"
apk add openssh-client zsh git openssl
printf "\n"
printf "3. 写入配置文件...\n"
mkdir -p ~/.ssh && chmod 700 ~/.ssh
printf "输入配置解密密码\n"
configEnc="U2FsdGVkX1/otumhqIa41/Cj5ThfSxT1l7G9Fv0gbWzZfIpPj2KJrzoCTLrMLR7BuVu6QwUzR2BjZ1NzzP+q87ke7TkGYStulGDoNDPlVn/CGL9b5B0B4Nu57LOMXiOFnm5S65932KJs9433HL73iAEpzjlomE89ofQzWjfSiJSFGDPHfp2ClX87TE5iH6plZ8UG01ZAL1mrYrK7rM3a0W+YnkI8tglLbccGhed9BWRKxQ5I45rUZkeIFCTzsAXYNcdHGoxFVi0zEQrVNrMp9HfcTEL5DNovl+AD2I4MgBpQFIaC/bxATWiPeF15g8A9SUnQJYqsYWwtjewVH9rPPV1e0gTheeVXTQcONPr/Sd7jDl4c0p2dThoPHxeQV/svYYwz19SNEhvvdWGYFtmyTs91WXvvwUq0kh1LRzNwpM+Vq03OlzSp75vhr1PrDrkcMRtgYy5ezJ4v1kbHYbY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lkpPTSy1lF8yuAUXqzrhY0o+t92pa1/OAz0C/QqOwgGBX+e7hfeGo57KvfOWmgxMDwT+Gsoga4Rxe0UgjrhA5++deQpJQsJjHSC8zDCtU08Ar2/1peFWwoh7lxd8j2Iymc/IJCydH2QxeAO0G550QRrGSXd6PBRfpD+prdZ7ggUpefwBXHv1iqNJB8BRKuZ3KkKgZMYMoHFLvCXGy0ORMyE3BaSpMHR0wtxhrjQH0loZAUaiEtJ99r7+uryRze0/CMKzajxGbyuHai7tn3enU+R/u7dulntNjvnKC45bo67qXTJkmLWyZKCJ8GpLNvylhTU6Jg39a1JF5uiM6OCqtIDw3Mho0vGYsL4/9Q71R23J6L5u8D+gZGnDkcQ+EvAjmxv5CA0WVCja/SGS2LG1jDQ3io/VyIPbahcSu5NMgKnpgLP2GrZMxaRC7gGUaI4KsGT2AIYxjnLHHIVLkHLqDIb+Q4bv/7eCHNdRwAA2UyU4Vrg54IAKGI0l+F5PL3Q87xtvO3XByuOcT+w07d1ZztA514239d3Ss816VzX5JeHQPFaT3qlvwzYxsCoXJy0rNvQ0XAW9Xb/Fllk8ixdQQxmElpmfA4FvlkOE6mTLQ4ufGCGNnqVE7erK+8cO2+9QXOlEbqylZW4rR4jXHUzz91EXMSNyY5uxptNji5xzB6DpY8V5ZakXPMl/qggqP7HXX75IrGOATp/QJip/2YzkhV8gUzk4Sdt+0QKFBO9zhRugiPLWYIG2Zy1kspAOm3GGIJH/MsKE0cyUF/zEeO6ZrD2gyiVCnKouEkXdephWXsebAhLuXMSe9qBYCpDTdQ5xu4ANsK/BnlVMLVzF16M0cGyPUT+KC8y+7eDKUOQWBNKxgWLjFOzA8F5aO6VA=="
echo $sshDevEnc | openssl enc -d -des3 -base64 -pbkdf2 -A > ~/.ssh/dev.pem
chmod 600 ~/.ssh/dev.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment