我正在尝试通过curl命令认证到我的openvpn-as服务器。我的最终目标是能够像通过浏览器那样通过cli下载ovpn文件。我可以从浏览器中获得cURL命令,但我得到了403。
我的curl命令如下所示:
curl -iL 'https://192.168.35.229:943/?src=connect' \
-H 'Connection: keep-alive' \
-H 'Accept: text/plain, */*; q=0.01' \
-H 'X-OpenVPN: 1' \
-H 'X-Requested-With: XMLHttpRequest' \
-H 'X-CWS-Proto-Ver: 2' \
-H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36 OPR/70.0.3728.178' \
-H 'Origin: https://192.168.35.229:943' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Accept-Language: en-US,en;q=0.9' \
--data-raw 'username=dummy&password=dummy' \
--compressed \
--insecure 响应如下所示:
HTTP/1.1 302 Found
Transfer-Encoding: chunked
Set-Cookie: openvpn_sess_c6bec1b42f39a6d1034a54580d5422dc=36bce77626a6e403eb6ae9f02576d460; Expires=Wed, 16 Sep 2020 05:15:12 GMT; Path=/; Secure; HttpOnly
Server: OpenVPN-AS
Location: https://192.168.35.229:943/__session_start__/
Date: Wed, 16 Sep 2020 04:45:12 GMT
X-Frame-Options: SAMEORIGIN
Content-Type: text/html; charset=utf-8
HTTP/1.1 403 Forbidden
Transfer-Encoding: chunked
Date: Wed, 16 Sep 2020 04:45:12 GMT
X-Frame-Options: SAMEORIGIN
Content-Type: text/html; charset=UTF-8
Server: OpenVPN-AS
<html><head><title>Forbidden</title></head><body><h1>Forbidden</h1>Request was forbidden.</body></html>#我在文档中找不到任何关于这方面的示例或说明。有没有办法通过CLI -通过bash脚本实现这一点?
发布于 2020-09-17 09:29:36
我找到了一个基于this article的解决方案。curl命令将如下所示:
curl -u dummy:dummy -k https://192.168.35.229:943/rest/GetUserlogin
https://stackoverflow.com/questions/63913347
复制相似问题