go1.6 + ssh script bsd support
This commit is contained in:
parent
c86cddea9f
commit
157885902b
2 changed files with 44 additions and 26 deletions
|
|
@ -11,7 +11,7 @@ GITHUB="https://github.com/golang/go/archive/"
|
||||||
V14="go1.4.3"
|
V14="go1.4.3"
|
||||||
TGZ14="${V14}.tar.gz"
|
TGZ14="${V14}.tar.gz"
|
||||||
|
|
||||||
Vnew="go1.5.2"
|
Vnew="go1.6"
|
||||||
TGZnew="${Vnew}.tar.gz"
|
TGZnew="${Vnew}.tar.gz"
|
||||||
|
|
||||||
INSTALL="/usr/local"
|
INSTALL="/usr/local"
|
||||||
|
|
@ -36,9 +36,9 @@ cd ${INSTALL}/${V14}/src
|
||||||
export GOROOT_BOOTSTRAP=${INSTALL}/${V14}
|
export GOROOT_BOOTSTRAP=${INSTALL}/${V14}
|
||||||
|
|
||||||
if [ "$(uname -m)" == "x86_64" ]; then
|
if [ "$(uname -m)" == "x86_64" ]; then
|
||||||
export GOARCH=386
|
|
||||||
else
|
|
||||||
export GOARCH=amd64
|
export GOARCH=amd64
|
||||||
|
else
|
||||||
|
export GOARCH=386
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ${INSTALL}/${Vnew}/src
|
cd ${INSTALL}/${Vnew}/src
|
||||||
|
|
@ -57,7 +57,7 @@ echo ""
|
||||||
echo "export CGO_ENABLED=0"
|
echo "export CGO_ENABLED=0"
|
||||||
echo "export GOPATH=~/go"
|
echo "export GOPATH=~/go"
|
||||||
echo "export GOROOT=/usr/local/go"
|
echo "export GOROOT=/usr/local/go"
|
||||||
echo "export PATH=\${PATH}:${GOROOT}"
|
echo "export PATH=\${PATH}:${GOROOT}/bin:~/go/bin"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
go version
|
go version
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,20 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
|
UNAME=$(uname)
|
||||||
|
case ${UNAME} in
|
||||||
|
Linux)
|
||||||
if [ ${EUID} -ne 0 ]; then
|
if [ ${EUID} -ne 0 ]; then
|
||||||
echo "error: this script must be run as root" 1>&2
|
echo "error: this script must be run as root" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
OpenBSD|FreeBSD)
|
||||||
|
if [ $(id -u) -ne 0 ]; then
|
||||||
|
echo "error: this script must be run as root" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo "warning: this script will disable ssh password authentication"
|
echo "warning: this script will disable ssh password authentication"
|
||||||
read -p "continue? [y/N] " answer
|
read -p "continue? [y/N] " answer
|
||||||
|
|
@ -41,29 +52,30 @@ HostKey /etc/ssh/ssh_host_rsa_key
|
||||||
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
|
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
|
||||||
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
|
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
|
||||||
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
|
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
|
||||||
UsePrivilegeSeparation yes
|
UsePrivilegeSeparation sandbox
|
||||||
SyslogFacility AUTH
|
|
||||||
LogLevel INFO
|
|
||||||
LoginGraceTime 120
|
|
||||||
PermitRootLogin no
|
PermitRootLogin no
|
||||||
StrictModes yes
|
|
||||||
RSAAuthentication no
|
RSAAuthentication no
|
||||||
PubkeyAuthentication yes
|
PubkeyAuthentication yes
|
||||||
AuthorizedKeysFile %h/.ssh/authorized_keys
|
|
||||||
IgnoreRhosts yes
|
|
||||||
RhostsRSAAuthentication no
|
|
||||||
HostbasedAuthentication no
|
|
||||||
PermitEmptyPasswords no
|
|
||||||
ChallengeResponseAuthentication no
|
ChallengeResponseAuthentication no
|
||||||
PasswordAuthentication no
|
PasswordAuthentication no
|
||||||
X11Forwarding no
|
|
||||||
PrintMotd no
|
PrintMotd no
|
||||||
PrintLastLog yes
|
EOF
|
||||||
TCPKeepAlive yes
|
|
||||||
AcceptEnv LANG LC_*
|
case ${UNAME} in
|
||||||
|
Linux)
|
||||||
|
cat << EOF >> /etc/ssh/sshd_config
|
||||||
|
AuthorizedKeysFile %h/.ssh/authorized_keys
|
||||||
Subsystem sftp /usr/lib/openssh/sftp-server
|
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||||
UsePAM yes
|
UsePAM yes
|
||||||
EOF
|
EOF
|
||||||
|
;;
|
||||||
|
OpenBSD|FreeBSD)
|
||||||
|
cat << EOF >> /etc/ssh/sshd_config
|
||||||
|
Subsystem sftp /usr/libexec/sftp-server
|
||||||
|
AuthorizedKeysFile .ssh/authorized_keys
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
read -p "enter your username " user
|
read -p "enter your username " user
|
||||||
|
|
||||||
|
|
@ -91,10 +103,16 @@ echo "${sshkey}" > /home/${user}/.ssh/authorized_keys
|
||||||
chmod 600 /home/${user}/.ssh/authorized_keys
|
chmod 600 /home/${user}/.ssh/authorized_keys
|
||||||
chown ${user}:root /home/${user}/.ssh/authorized_keys
|
chown ${user}:root /home/${user}/.ssh/authorized_keys
|
||||||
|
|
||||||
|
case ${UNAME} in
|
||||||
|
Linux)
|
||||||
service ssh restart
|
service ssh restart
|
||||||
|
;;
|
||||||
|
OpenBSD|FreeBSD)
|
||||||
|
/etc/rc.d/sshd restart
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
ssh=$(ps aux | awk '/\/usr\/s?bin\/sshd/')
|
if [ -z "$(ps aux | awk '/\/usr\/s?bin\/sshd/')" ]; then
|
||||||
if [ -z "${ssh}" ]; then
|
|
||||||
echo "error: ssh service failed to restart" 1>&2
|
echo "error: ssh service failed to restart" 1>&2
|
||||||
echo "please check for sshd config errors manually" 1>&2
|
echo "please check for sshd config errors manually" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue