如果您对react-router组件渲染在AWSs3存储桶中不起作用感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于react-router组件渲染在AWSs3存储桶中不起作
如果您对react-router 组件渲染在 AWS s3 存储桶中不起作用感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于react-router 组件渲染在 AWS s3 存储桶中不起作用的详细内容,我们还将为您解答react组件渲染机制的相关问题,并且为您提供关于''react-router-redux''到''connected-react-router''、./node_modules/react-router-dom/react-router-dom.js尝试导入错误:未从“ react-router”导出“ Navigate”、AWS SAM Lambda 应用程序开发 + AWS 开发工具包——无法得到一个工作示例 构建错误在本地运行使用 vscode 中的“Invoke on AWS”在 AWS 控制台中运行 Lambda 函数、AWS VPN:如何使用 Powershell 创建和导入自签名证书 1.创建证书2.使用以下方法将根证书导入 AWS Certificate Manager:3.使用 AWS Client VPN Endpoints4.使用 AWS 客户端 VPN 终端节点5.修改客户端配置 (ovpn) 文件6.将修改后的 ovpn 文件和客户端分发给用户7.参考资料的有价值信息。
本文目录一览:- react-router 组件渲染在 AWS s3 存储桶中不起作用(react组件渲染机制)
- ''react-router-redux''到''connected-react-router''
- ./node_modules/react-router-dom/react-router-dom.js尝试导入错误:未从“ react-router”导出“ Navigate”
- AWS SAM Lambda 应用程序开发 + AWS 开发工具包——无法得到一个工作示例 构建错误在本地运行使用 vscode 中的“Invoke on AWS”在 AWS 控制台中运行 Lambda 函数
- AWS VPN:如何使用 Powershell 创建和导入自签名证书 1.创建证书2.使用以下方法将根证书导入 AWS Certificate Manager:3.使用 AWS Client VPN Endpoints4.使用 AWS 客户端 VPN 终端节点5.修改客户端配置 (ovpn) 文件6.将修改后的 ovpn 文件和客户端分发给用户7.参考资料
react-router 组件渲染在 AWS s3 存储桶中不起作用(react组件渲染机制)
如何解决react-router 组件渲染在 AWS s3 存储桶中不起作用
我目前一直在研究使用 react-router 在 AWS s3 存储桶中渲染反应组件的问题。我在我的 React 应用程序中创建了一个导航标题,并根据单击的按钮路由到不同的“页面”。下面是一个例子:
在我的标题组件中,我有以下按钮和功能路由到适当的位置
<button id="navButton" onClick={this.linkManagerDashboard}>Dashboard</button>
linkManagerDashboard = (event) => {
window.location = ''https://ledgerly.s3.amazonaws.com/ManagerDashboard''
}
我也将 window.location 切换到 /index.html/ManagerDashboard 无济于事。 这当然在我的本地测试环境中工作正常。然后,我继续通过我的主应用程序组件(在我的本地测试环境中也能正常工作)呈现管理器仪表板组件:
<Route path="/ManagerDashboard" render={() => (<ManagerDashboard></ManagerDashboard>)} />
一切正常,直到我将代码上传到 AWS s3 存储桶。 (我确实运行了 build 命令来创建构建文件)。我将文件添加到 s3 存储桶,启用静态网络托管,并将 index.html 作为我的默认页面和错误文档包含在 s3 设置中的静态网站托管选项下。但是,当我单击任何按钮时,出现以下错误:
This XML file does not appear to have any style information associated with it. The document tree is show below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>267DAD08ABA2000B</RequestId>
<HostId>A+VvgfKAMKb2AvtAARx2PtGiSjx7FG57c7DrzrwtRmQZF81YQfdwGrETZ43ihXoWKXAhf41iI0c=</HostId>
</Error>
初始页面呈现正确。当我尝试单击导航按钮之一时会发生此错误。我找到了一些有关创建允许公共交通的政策的信息。这是该政策:
{
"Version": "2012-10-17","Statement": [
{
"Sid": "AddPerm","Effect": "Allow","Principal": "*","Action": "s3:Getobject","Resource": "arn:aws:s3:::ledgerly/*"
}
]
}
这让我感到困惑,因为包含“ledgerly/”的资源行向我表明,任何跟在主页 url (/index.html) 之后的 url 子名称都是可以接受的……我想不通找出导航不起作用的原因。为什么我的策略中的 / 不允许渲染所有项目资源和位置?请帮忙!!
解决方法
AWS S3 不提供开箱即用的 SPA 重定向规则。您需要在 Static Website Hosting
部分下添加重定向规则。
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>index.html</ReplaceKeyWith>
</Redirect>
</RoutingRule>
</RoutingRules>
现在,所有 404
都将根据 SPA 的需要重定向到 index.html
。
''react-router-redux''到''connected-react-router''
背景:
redux和react-router两者协同工作会出现,路由变化而store无法感知到,的问题。
react-router-redux :
一. 作用:
react-router-redux 是 redux 的一个中间件,加强了React Router库中history这个实例,以允许将history中接受到的变化反应到state中去。
使用方法1:
使用syncHistoryWithStore包裹browserHistory,当url改变时,会自动触发 LOCATION_CHANGE action,更改store中维护的 locationBeforeTransitions 状态对象,实现store状态的更新。
// 只需要传入react-router中的history以及redux中的store,就可以获得一个增强后的history对象。
// 将这个history对象传给react-router中的Router组件作为props,就给应用提供了观察路由变化并改变store的能力。
import { syncHistoryWithStore, routerReducer } from ''react-router-redux''
const store = createStore(
combineReducers({
...reducers,
routing: routerReducer
})
)
const history = syncHistoryWithStore(browserHistory, store)
ReactDOM.render(
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App} />
</Router>
</Provider>,
document.getElementById(‘app'')
)
// 对应的reducer.js
export const LOCATION_CHANGE = ''@@router/LOCATION_CHANGE''
const initialState = {
locationBeforeTransitions: null
}
使用方法2:
手动触发路由的跳转,同时需要。
直接store.dispatch(push(''/foo'')),会触发 CALL_HISTORY_METHOD 这个action,调用中间件,等同于调用 browserHistory上相应的push方法。
// 触发路由跳转(使用redux action的方式来触发)
import { createStore, combineReducers, applyMiddleware } from ''redux'';
import { routerMiddleware, push } from ''react-router-redux''
// Apply the middleware to the store
const middleware = routerMiddleware(browserHistory)
const store = createStore(
reducers,
applyMiddleware(middleware)
)
// 使用dispatch手动触发 push 等操作
store.dispatch(push(''/foo''))
源码的具体实现:
// import 的 push, replace, go, goBack, goForward之类的方法出自: action.js
export const push = updateLocation(''push'')
function updateLocation(method) {
return (...args) => ({
type: CALL_HISTORY_METHOD,
payload: { method, args }
})
}
//中间件代码
export default function routerMiddleware(history) {
return () => next => action => {
if (action.type !== CALL_HISTORY_METHOD) {
return next(action)
}
const { payload: { method, args } } = action
history[method](...args) //这里直接改变browserHistory
}
}
二. react-router-redux原理图
CALL_HISTORY_METHOD,这类 action 一般会在组件内派发,它不负责 state 的修改,通过 routerMiddleware 后,会被转去调用 history。
面临的问题:
react-router-redux 只兼容 react-router 2.x and 3.x,所以要改成使用 connected-react-router 来兼容 react-router 4.x。
解决:
把之前 react-router-redux 中 store.dispatch(push(''/foo'')) 这么使用的,直接改成 history.push(''/foo'') 之类的。
参考文章:
https://blog.csdn.net/weixin_... React 的路由状态管理
./node_modules/react-router-dom/react-router-dom.js尝试导入错误:未从“ react-router”导出“ Navigate”
如何解决./node_modules/react-router-dom/react-router-dom.js尝试导入错误:未从“ react-router”导出“ Navigate”
./node_modules/react-router-dom/react-router-dom.js Attempted import error: ''Navigate'' is not exported from ''react-router''.
react-router-dom的版本是6.0.0-alpha.2,而react-router是5.2.0。 两者均已正确安装。我不确定如何解决此错误。有人可以给我任何可能的解决方法吗?
我的代码中甚至没有<Navigate to=?>
行。
解决方法
为什么只安装两个都需要,这可以工作
- 执行npm删除react-router
- 删除node_modules
- 纱线安装或npm安装和
- 启动纱线或启动npm
AWS SAM Lambda 应用程序开发 + AWS 开发工具包——无法得到一个工作示例 构建错误在本地运行使用 vscode 中的“Invoke on AWS”在 AWS 控制台中运行 Lambda 函数
如何解决AWS SAM Lambda 应用程序开发 + AWS 开发工具包——无法得到一个工作示例 构建错误在本地运行使用 vscode 中的“Invoke on AWS”在 AWS 控制台中运行 Lambda 函数
我对 AWS Lambda 还很陌生,我正在尝试设置我的环境,以便能够使用 vscode 开发 Lambda 函数并能够使用调试器。这样做的方法似乎是开发一个包含 lambda 函数的 SAM(无服务器应用程序模型)应用程序。所以我已经按照 AWS tutorial 中的“hello world”示例设置了所有内容,并且一切似乎都正常。 我还创建了一个独立的 Lambda 函数,它可以成功访问 AWS-SDK 以显示一些 EC2 实例信息(见下文)。
// Standalone Lambda Function that Works OK
const AWS = require(''aws-sdk'')
AWS.config.update({region: ''eu-west-2''});
const ec2 = new AWS.EC2();
exports.handler = async function(event) {
return ec2.describeInstances().promise();
}
我遇到的问题是将两者结合起来:即从 SAM 应用程序访问 aws-sdk。没有帮助的是,当我尝试使用可以访问 aws-sdk 的预先提供的 SAM 模板之一(例如 S3 模板)时,它们甚至不会构建。 所以我想我有两个基本问题:
- SAM 是能够在本地运行和调试 Node.js 应用程序的答案吗?
- 如果是这样,我如何获得使用“aws-sdk”的有效 SAM 应用程序?
我使用的是最新版本的所有内容。 Node.js、SAM CLI 等。 开发机器是运行在 ubuntu 主机上的 ubuntu VM。但是非 aws-sdk 示例似乎工作正常。
未构建的示例 SAM 应用程序示例。
$ sam init
Which template source would you like to use?
1 - AWS Quick Start Templates
2 - Custom Template Location
Choice: 1
What package type would you like to use?
1 - Zip (artifact is a zip uploaded to S3)
2 - Image (artifact is an image uploaded to an ECR image repository)
Package type: 1
Which runtime would you like to use?
1 - nodejs14.x
2 - python3.8
3 - ruby2.7
4 - go1.x
5 - java11
6 - dotnetcore3.1
7 - nodejs12.x
8 - nodejs10.x
9 - python3.7
10 - python3.6
11 - python2.7
12 - ruby2.5
13 - java8.al2
14 - java8
15 - dotnetcore2.1
Runtime: 1
Project name [sam-app]: sam-app-sdk-test
cloning app templates from https://github.com/aws/aws-sam-cli-app-templates
AWS quick start application templates:
1 - Hello World Example
2 - Step Functions Sample App (Stock Trader)
3 - Quick Start: From Scratch
4 - Quick Start: Scheduled Events
5 - Quick Start: S3
6 - Quick Start: SNS
7 - Quick Start: SQS
8 - Quick Start: Web Backend
Template selection: 5
-----------------------
Generating application:
-----------------------
Name: sam-app-sdk-test
Runtime: nodejs14.x
Dependency Manager: npm
Application Template: quick-start-s3
Output Directory: .
Next steps can be found in the README file at ./sam-app-sdk-test/README.md
构建错误
sam build
Building codeuri: /media/sf_Virtual-machine-shr/DEV-Projects/OaC/sam-app-sdk-test runtime: nodejs14.x Metadata: {} functions: [''S3Json
LoggerFunction'']
Running NodejsNpmBuilder:NpmPack
Running NodejsNpmBuilder:copyNpmrc
Running NodejsNpmBuilder:copySource
Running NodejsNpmBuilder:NpmInstall
Build Failed
Error: NodejsNpmBuilder:NpmInstall - NPM Failed: npm WARN deprecated request@2.88.2: request has been deprecated,see https://github.c
om/request/request/issues/3142
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the Now deprecated req
uest package,see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {
"os":"linux","arch":"x64"})
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR! /home/peter/.npm/_logs/2021-04-25T14_35_13_711Z-debug.log
将工作中的 Lambda 函数转换为 SAM 应用程序
如果我使用我的工作 Lambda 函数并尝试将其部署为 SAM 应用程序,该应用程序构建和部署正常,但无法运行。
在本地运行
$ sam local invoke
Invoking app.lambdaHandler (nodejs14.x)
Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-nodejs14.x:rapid-1.22.0.
Mounting /media/sf_Virtual-machine-shr/DEV-Projects/OaC/backups/nc-sam-awsbackup-snapshots/.aws-sam/build/ShareSnapshotsFunction as /var/task:ro,delegated inside runtime container
START RequestId: bf15ac81-7d54-48ad-bbb7-df5e196c09f0 Version: $LATEST
2021-04-25T14:28:27.244Z undefined ERROR Uncaught Exception {"errorType":"Runtime.HandlerNotFound","errorMessage":"app.lambdaHandler is undefined or not exported","stack":["Runtime.HandlerNotFound: app.lambdaHandler is undefined or not exported"," at Object.module.exports.load (/var/runtime/UserFunction.js:144:11)"," at Object.<anonymous> (/var/runtime/index.js:43:30)"," at Module._compile (internal/modules/cjs/loader.js:1063:30)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)"," at internal/main/run_main_module.js:17:47"]}
time="2021-04-25T14:28:27.252" level=panic msg="ReplyStream not available"
2021/04/25 14:28:27 http: panic serving 127.0.0.1:44020: &{0xc0000f4000 map[] 2021-04-25 14:28:27.252909676 +0000 UTC m=+0.322609308 panic <nil> ReplyStream not available <nil> <nil> }
goroutine 30 [running]:
<Stuff Cut Out>
2021-04-25T14:28:27.266Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"socket hang up","code":"ECONNRESET","stack":["Error: socket hang up"," at connResetException (internal/errors.js:607:14)"," at Socket.socketonEnd (_http_client.js:493:23)"," at Socket.emit (events.js:327:22)"," at Socket.EventEmitter.emit (domain.js:467:12)"," at endReadableNT (internal/streams/readable.js:1327:12)"," at processticksAndRejections (internal/process/task_queues.js:80:21)"]}
time="2021-04-25T14:28:27.288" level=error msg="Init Failed" InvokeID= error="Runtime exited with error: exit status 129"
time="2021-04-25T14:28:27.288" level=error msg="INIT DONE Failed: Runtime.ExitError"
使用 vscode 中的“Invoke on AWS”。
正在加载响应...
Invocation result for arn:aws:lambda:eu-west-2:428829672862:function:nc-sam-awsbackup-snapshots-ShareSnapshotsFunction-Z9A1RR2GCQ9F
Logs:
START RequestId: f7a7d779-8ebd-4dde-987e-775f6116c2d4 Version: $LATEST
2021-04-25T14:21:24.159Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"EACCES: permission denied,open ''/var/task/app.js''","code":"EACCES","errno":-13,"syscall":"open","path":"/var/task/app.js","stack":["Error: EACCES: permission denied," at Object.openSync (fs.js:476:3)"," at Object.readFileSync (fs.js:377:35)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1090:18)"," at Module.require (internal/modules/cjs/loader.js:952:19)"," at require (internal/modules/cjs/helpers.js:88:18)"," at _tryRequire (/var/runtime/UserFunction.js:75:12)"," at _loadUserApp (/var/runtime/UserFunction.js:95:12)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
END RequestId: f7a7d779-8ebd-4dde-987e-775f6116c2d4
REPORT RequestId: f7a7d779-8ebd-4dde-987e-775f6116c2d4 Duration: 1439.52 ms Billed Duration: 1440 ms Memory Size: 128 MB Max Memory Used: 14 MB
UnkNown application error occurred
Error
Payload:
{"errorType":"Error","trace":["Error: EACCES: permission denied," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
Loading response...
Invocation result for arn:aws:lambda:eu-west-2:428829672862:function:nc-sam-awsbackup-snapshots-ShareSnapshotsFunction-Z9A1RR2GCQ9F
Logs:
START RequestId: 779c6351-0775-4f04-8a5e-987791b027bf Version: $LATEST
2021-04-25T14:31:26.397Z undefined ERROR Uncaught Exception {"errorType":"Error"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
END RequestId: 779c6351-0775-4f04-8a5e-987791b027bf
REPORT RequestId: 779c6351-0775-4f04-8a5e-987791b027bf Duration: 1449.59 ms Billed Duration: 1450 ms Memory Size: 128 MB Max Memory Used: 14 MB
UnkNown application error occurred
Error
Payload:
{"errorType":"Error"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
在 AWS 控制台中运行 Lambda 函数
给出相同的 EACCES:权限被拒绝
AWS VPN:如何使用 Powershell 创建和导入自签名证书 1.创建证书2.使用以下方法将根证书导入 AWS Certificate Manager:3.使用 AWS Client VPN Endpoints4.使用 AWS 客户端 VPN 终端节点5.修改客户端配置 (ovpn) 文件6.将修改后的 ovpn 文件和客户端分发给用户7.参考资料
如何解决AWS VPN:如何使用 Powershell 创建和导入自签名证书 1.创建证书2.使用以下方法将根证书导入 AWS Certificate Manager:3.使用 AWS Client VPN Endpoints4.使用 AWS 客户端 VPN 终端节点5.修改客户端配置 (ovpn) 文件6.将修改后的 ovpn 文件和客户端分发给用户7.参考资料
我正在尝试使用 Powershell 创建用于 AWS VPN 和 OpenVPN 的证书。 我发现文档不太有用。有没有好的网站?
解决方法
使用 CreateCertificate.ps1 脚本,然后按照以下说明进行操作:
创建证书.ps1
#Run as Administrator
function PSScriptRoot()
{
$ScriptRoot = ""
Try
{
$ScriptRoot = Get-Variable -Name PSScriptRoot -ValueOnly -ErrorAction Stop
}
Catch
{
$ScriptRoot = Split-Path $script:MyInvocation.MyCommand.Path
}
return $ScriptRoot
}
Install-Module -Name PSPKI -Scope AllUsers
Import-Module PSPKI
$PSScriptPath = PSScriptRoot
$certPassword = ConvertTo-SecureString -String "touchworks.VPN" -Force -AsPlainText
# Create a self-signed root certificate
$exp = (Get-Date).AddYears(5)
$rootCert = New-SelfSignedCertificate `
-DnsName self-service.root.clientvpn.amazonaws.com `
-Subject "CN=AWS.VPN.Root" `
-CertStoreLocation "cert:\\LocalMachine\\My" `
-HashAlgorithm sha256 -KeyLength 2048 `
-NotAfter $exp `
-KeyExportPolicy Exportable -KeySpec Signature -KeyProtection None -KeyUsageProperty All
# Create a client certificate based on the Root
$clientCert = New-SelfSignedCertificate -Type Custom -DnsName P2SChildCert `
-Subject "CN=AWS.VPN.Client" `
-HashAlgorithm sha256 -KeyLength 2048 `
-CertStoreLocation "Cert:\\CurrentUser\\My" `
-Signer $rootCert -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2") `
-KeyExportPolicy Exportable -KeySpec Signature -KeyProtection None -KeyUsageProperty All
#Export the Root certificate with Private Key
$rootCert.PSPath
$pfxFilePath = "$PSScriptPath\\" + $rootCert.Subject + ".pfx"
$pemFilePath = "$PSScriptPath\\" + $rootCert.Subject + ".pem"
Export-PfxCertificate -Cert $rootCert.PSPath -FilePath $pfxFilePath -Password $certPassword
Convert-PfxToPem -InputFile $pfxFilePath -Outputfile $pemFilePath -Password $certPassword -OutputType Pkcs1
# Export the client certificate
$rootCert.PSPath
$pfxFilePath = "$PSScriptPath\\" + $clientCert.Subject + ".pfx"
$pemFilePath = "$PSScriptPath\\" + $clientCert.Subject + ".pem"
Export-PfxCertificate -Cert $clientCert.PSPath -FilePath $pfxFilePath -Password $certPassword -ChainOption BuildChain -CryptoAlgorithmOption AES256_SHA256
Convert-PfxToPem -InputFile $pfxFilePath -Outputfile $pemFilePath -Password $certPassword -OutputType Pkcs1
1.创建证书
Run CreateCertificate.ps1
生成以下文件: 根:CN=AWS.VPN.Root.pem
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAscrFXB0k4vVt2+4WX2f67ceWW8bL/Zxwj8VboOucAiy2RtUV
...
Pdo5MeLbJCYjZwMxZ0KuLybyl0OxkYnhYT7UNExJYgz0E87fJIFN
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIIDQDCCAiigAwIBAgIQaBfHrrrdALtOxYJsf+N4UzANBgkqhkiG9w0BAQsFADAX
...
HmuJiV7KTDWGkmTVfgxP1coMr7M=
-----END CERTIFICATE-----
客户端:CN=AWS.VPN.Client.pem
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAq6MdA2PWfsR6k2r1rT7EFgN4fGgKvRIFpTE5K7WmUDBxqSL/
...
eEM5vupZfK5F2LW4cqkFFamv93+gcgWqVo/7U9rxwQbMdBj9v2bMWQ==
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIIDOzCCAiOgAwIBAgIQWzHJgWjQhoJKcnXOLno1fTANBgkqhkiG9w0BAQsFADAX
...
ORyAIYAJd3P2MIecP+NR
-----END CERTIFICATE-----
2.使用以下方法将根证书导入 AWS Certificate Manager:
使用CertificateManager|导入证书
证书主体 ==> 使用根证书
证书私钥 ==> 使用根 RS 私钥
证书链 ==> 留空
3.使用 AWS Client VPN Endpoints
将 AWS Certificate Manager 证书应用到 VPN使用按钮客户端 VPN 端点|操作|修改客户端 VPN 端点
4.使用 AWS 客户端 VPN 终端节点
下载客户端配置 (ovpn) 文件使用按钮客户端 VPN 端点|下载客户端配置
5.修改客户端配置 (ovpn) 文件
- Open VPN 客户端中存在一个错误,该错误会忽略 ovpn 文件中的 remote-random-hostname 设置。
- VPN 的自助服务门户不会生成可用的 ovpn 文件。
修改ovpn文件如下:
- 在 url 前添加一个随机字符串
- 添加客户端证书和密钥
示例 OVPN 文件
client
dev tun
proto udp
>>> remote qwerty.cvpn-endpoint-0aae...680bf.prod.clientvpn.us-east-1.amazonaws.com 443
remote-random-hostname
resolv-retry infinite
nobind
remote-cert-tls server
cipher AES-256-GCM
verb 3
<ca>
-----BEGIN CERTIFICATE-----
MIIDQDCCAiigAwIBAgIQdn3tb5/zQJJCitV4XSxmmTANBgkqhkiG9w0BAQsFADAX
...
tx2txb5TvvJnEoRkEFlnpxmXd5U=
-----END CERTIFICATE-----
</ca>
>>> <cert>
>>> -----BEGIN CERTIFICATE-----
>>>
>>> ***CLIENT CERTIFICATE***
>>>
>>> -----END CERTIFICATE-----
>>>
>>>
>>> </cert>
>>> <key>
>>> -----BEGIN RSA PRIVATE KEY-----
>>>
>>> ***CLIENT RSA PRIVATE KEY***
>>>
>>> -----END RSA PRIVATE KEY-----
>>>
>>> </key>
auth-user-pass
reneg-sec 0
6.将修改后的 ovpn 文件和客户端分发给用户。
- AWS VPN 客户端在此配置中无法使用。
- 用户将需要Open VPN Client: https://openvpn.net/download-open-vpn/
7.参考资料
如何配置 Windows VPN 服务器
https://www.wintips.org/how-to-setup-vpn-server-on-windows-server-2016-pptp/
https://acloudxpert.com/generate-and-export-certificates-for-point-to-site-using-powershell/
如何使用 AWS VPN 锁定对您服务器的访问
https://www.cloudsavvyit.com/3270/how-to-use-aws-vpn-to-lock-down-access-to-your-servers/
使用 PowerShell 创建自签名证书
https://4sysops.com/archives/create-a-self-signed-certificate-with-powershell/
我们今天的关于react-router 组件渲染在 AWS s3 存储桶中不起作用和react组件渲染机制的分享已经告一段落,感谢您的关注,如果您想了解更多关于''react-router-redux''到''connected-react-router''、./node_modules/react-router-dom/react-router-dom.js尝试导入错误:未从“ react-router”导出“ Navigate”、AWS SAM Lambda 应用程序开发 + AWS 开发工具包——无法得到一个工作示例 构建错误在本地运行使用 vscode 中的“Invoke on AWS”在 AWS 控制台中运行 Lambda 函数、AWS VPN:如何使用 Powershell 创建和导入自签名证书 1.创建证书2.使用以下方法将根证书导入 AWS Certificate Manager:3.使用 AWS Client VPN Endpoints4.使用 AWS 客户端 VPN 终端节点5.修改客户端配置 (ovpn) 文件6.将修改后的 ovpn 文件和客户端分发给用户7.参考资料的相关信息,请在本站查询。
本文标签: