无法使用 easy-rsa 为 openvpn 生成密钥

无法使用 easy-rsa 为 openvpn 生成密钥

我一直在遵循一个教程来设置我的 Raspberry Pi 来运行 OpenVPN(我对 Pi 和网络还很陌生,这似乎是一个有趣的介绍项目)。然而,当我尝试使用 easy-rsa 生成密钥时遇到了障碍。我已编辑该vars文件以指向该easy-rsa目录,但每当我尝试获取该vars文件时,都会收到以下消息:

-bash: /etc/openvpn/easy-rsa: Is a directory
-bash: /whichopensslcnf: No such file or directory
NOTE: If you run ./clean-all, I will be doing a rm -rf on /keys

/etc/openvpn/easy-rsa是目录的位置,所以我发现第一行有点多余。此外,该/whichopensslcnf文件显然就在目录内。

任何建议或指示将不胜感激。

更新#1

该教程可以在这里找到:https://readwrite.com/2014/04/10/raspberry-pi-vpn-tutorial-server-secure-web-browsing/

source ./vars是给出的导致错误的命令。

# easy-rsa parameter settings

# NOTE: If you installed from an RPM,
# don't edit this file in place in
# /usr/share/openvpn/easy-rsa --
# instead, you should copy the whole
# easy-rsa directory to another location
# (such as /etc/openvpn) so that your
# edits will not be wiped out by a future
# OpenVPN package upgrade.

# This variable should point to
# the top level of the easy-rsa
# tree.
export EASY_RSA="`/etc/openvpn/easy-rsa`"

#
# This variable should point to
# the requested executables
#

export OPENSSL="openssl"
export PKCS11TOOL="pkcs11-tool"
export GREP="grep"


# This variable should point to
# the openssl.cnf file included
# with easy-rsa.
export KEY_CONFIG=`$EASY_RSA/whichopensslcnf`

# Edit this variable to point to
# your soon-to-be-created key
# directory.
#
# WARNING: clean-all will do
# a rm -rf on this directory
# so make sure you define
# it correctly!
export KEY_DIR="$EASY_RSA/keys"

# Issue rm -rf warning
echo NOTE: If you run ./clean-all, I will be doing a rm -rf on $KEY_DIR

# PKCS11 fixes
export PKCS11_MODULE_PATH="dummy"
export PKCS11_PIN="dummy"

# Increase this to 2048 if you
# are paranoid.  This will slow
# down TLS negotiation performance
# as well as the one-time DH parms
# generation process.
export KEY_SIZE=2048

# In how many days should the root CA key expire?
export CA_EXPIRE=3650

# In how many days should certificates expire?
export KEY_EXPIRE=3650
# These are the default values for fields
# which will be placed in the certificate.
# Don't leave any of these fields blank.
export KEY_COUNTRY="US"
export KEY_PROVINCE="CA"
export KEY_CITY="SanFrancisco"
export KEY_ORG="Fort-Funston"
export KEY_EMAIL="[email protected]"
export KEY_OU="MyOrganizationalUnit"

# X509 Subject Field
export KEY_NAME="EasyRSA"

# PKCS11 Smart Card
# export PKCS11_MODULE_PATH="/usr/lib/changeme.so"
# export PKCS11_PIN=1234

# If you'd like to sign all keys with the same Common Name, uncomment the 
KEY_C$
# You will also need to make sure your OpenVPN server config has the 
duplicate-$
# export KEY_CN="CommonName"

第 14 行是我唯一修改过的。

更新#2

感谢 sim,我能够解决这个最初的问题,但现在当我尝试发出命令时./clean-all,我被告知要获取vars文件,即使我已经这样做了。

pi@cympi:/etc/openvpn/easy-rsa $ source ./vars
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy- 
rsa/keys
pi@cympi:/etc/openvpn/easy-rsa $ sudo ./clean-all
Please source the vars script first (i.e. "source ./vars")
Make sure you have edited it to reflect your configuration.

我已经绕了好几圈了,但我似乎无法超越这一点。

答案1

此行正在尝试运行以下命令:

export EASY_RSA="`/etc/openvpn/easy-rsa`"

注意后面的刻度线/etc/openvpn/easy-rsa。这些将尝试将其作为命令运行。查看指南,该行显示如下:

export EASY_RSA=”/etc/openvpn/easy-rsa” 

相关内容