📄 astgenkey
字号:
#!/bin/sh## Usage: astgenkey [ -q ] [ -n ] [keyname]#DES3=-des3if [ "$1" = "-q" ]; then QUIET='y' if [ "$2" = "-n" ]; then DES3= KEY=$3 else KEY=$2 fielif [ "$1" = "-n" ]; then DES3= if [ "$2" = "-q" ]; then QUIET='y' KEY=$3 else KEY=$2 fielse KEY=$1fiif [ "$QUIET" != 'y' ]; then echo "" echo "This script generates an RSA private and public key pair" echo "in PEM format for use by Asterisk. You will be asked to" echo "enter a passcode for your key multiple times. Please" echo "enter the same code each time. The resulting files will" echo "need to be moved to /var/lib/asterisk/keys if you want" echo "to use them, and any private keys (.key files) will" echo "need to be initialized at runtime either by running" echo "Asterisk with the '-i' option, or with the 'init keys'" echo "command once Asterisk is running." echo "" echo "Press ENTER to continue or ^C to cancel." read BLAHfiwhile [ "$KEY" = "" ]; do echo -n "Enter key name: " read KEYdonerm -f ${KEY}.key ${KEY}.pubecho "Generating SSL key '$KEY': "openssl genrsa -out ${KEY}.key ${DES3} 1024openssl rsa -in ${KEY}.key -pubout -out ${KEY}.pubif [ -f "${KEY}.key" ] && [ -f "${KEY}.pub" ]; then if [ "$QUIET" != 'y' ]; then echo "Key creation successful." echo "Public key: ${KEY}.pub" echo "Private key: ${KEY}.key" fielse echo "Unknown error creating keys."fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -