IPC ko KR - Rudokhvist/ArchiSteamFarm GitHub Wiki
ASF๋ ์ ์ผํ ์์ฒด IPC ์ธํฐํ์ด์ค๋ฅผ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ, ์ด๋ก ์ธํด ํ๋ก์ธ์ค์ ๋ ์ํธ์์ฉํ ์ ์์ต๋๋ค. IPC ํ๋ก์ธ์ค ๊ฐ ํต์ (inter-process communication) ์ ๋ปํ๋ฉฐ, ๊ฐ์ฅ ๊ฐ๋จํ ์ ์๋ก Kestrel HTTP ์๋ฒ ๊ธฐ๋ฐ์ "ASF ์น ์ธํฐํ์ด์ค" ์ ๋๋ค. ์ด๋ ์ต์ข ์ฌ์ฉ์์ฉ ํ๋ก ํธ์๋(ASF-ui)์ ์๋ํํฐ ํตํฉ์ฉ ๋ฐฑ์๋(ASF API)๋ก์จ ํ๋ก์ธ์ค์ ๋ ํตํฉ๋ ์ ์์ต๋๋ค.
IPC๋ ์ฐ๋ฆฌ์ ํ์์ ๋ฅ๋ ฅ์ ๋ฐ๋ผ ์๋ง์ ๋ค๋ฅธ ๊ฒ๋ค๋ก ์ฌ์ฉ๋ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ASF์ ๋ชจ๋ ๋ด์ ์ํ๋ฅผ ๊ฐ์ ธ์ค๊ณ , ASF์ ๋ช ๋ น์ด๋ฅผ ๋ณด๋ด๊ณ , ์ผ๋ฐ/๋ด ํ๊ฒฝ์ค์ ์ ๊ฐ์ ธ์์ ์์ ํ๊ณ , ์๋ก์ด ๋ด์ ์ถ๊ฐํ๊ณ , ๊ธฐ์กด์ ๋ด์ ์ญ์ ํ๊ณ , ๋ฐฑ๊ทธ๋ผ์ด๋ ๊ฒ์ ๋ฑ๋ก๊ธฐ ์ ํค๋ฅผ ๋ณด๋ด๊ณ , ASF์ ๋ก๊ทธํ์ผ์ ์ ๊ทผํ ์ ์์ต๋๋ค. ์ด ๋ชจ๋ ์์ ์ API๋ก ์ ๊ณต๋ฉ๋๋ค. ์ฆ, ๋น์ ์ด ์์ ์ ๋๊ตฌ์ ์คํฌ๋ฆฝํธ๋ฅผ ์ง์ ASF ์คํ์ค์ ASF์ ํต์ ํ๊ณ ์ํฅ์ ๋ฏธ์น ์ ์๋ค๋ ๋ป์ ๋๋ค. ์ถ๊ฐ๋ก, ๋ช ๋ น์ด ์ ์ก๊ฐ์ ์ ํ๋ ์์ ์ ASF-ui์ ๊ตฌํ๋์ด ์์ผ๋ฉฐ ์น์ํ ์น ์ธํฐํ์ด์ค๋ก ์ฝ๊ฒ ์ ๊ทผํ ์ ์์ต๋๋ค.
Unless you manually disabled IPC through IPC
global configuration property, it's enabled by default. ASF๋ IPC์ ์คํ์ ๋ก๊ทธ์์ ํ์ํ์ฌ IPC ์ธํฐํ์ด์ค๊ฐ ์ ๋๋ก ์์๋์๋์ง ํ์ธํ ์ ์์ต๋๋ค.
INFO|ASF|Start() Starting IPC server...
INFO|ASF|Start() IPC server ready!
ASF์ http ์๋ฒ๊ฐ ์ด์ ์ ํํ ๋จ๋ง์์ ์์ ์ค์
๋๋ค. IPC์ ์ฌ์ฉ์ ์ง์ ํ๊ฒฝ์ค์ ํ์ผ์ ๋ฃ์ง ์์๋ค๋ฉด, ์ด๋ IPv4-๊ธฐ๋ฐ์ 127.0.0.1 ์ IPv6-๊ธฐ๋ฐ์ [::1] ์ด๋ฉฐ ํฌํธ ๊ธฐ๋ณธ๊ฐ์ 1242
์
๋๋ค. ASF ํ๋ก์ธ์ค๊ฐ ์คํ์ค์ธ ๋์ผํ ๊ธฐ๊ธฐ์์ ์์ ๋งํฌ๋ก IPC์ ์ ์ํ ์ ์์ต๋๋ค.
ASF์ IPC ์ธํฐํ์ด์ค๋ ์ฌ์ฉ๊ณํ์ ๋ฐ๋ผ ์ธ๊ฐ์ง์ ๋ค๋ฅธ ์ ๊ทผ๋ฐฉ๋ฒ์ ์ ๊ณตํฉ๋๋ค.
๊ฐ์ฅ ๋ฎ์ ๋จ๊ณ๋ก IPC ์ธํฐํ์ด์ค์ ํต์ฌ์ด๋ฉฐ ๋ค๋ฅธ ๋ชจ๋ ๊ฒ์ด ๋์ํ๋๋ก ํ๋ ASF API ๊ฐ ์์ต๋๋ค. ์์ ๋ง์ ๋๊ตฌ๋ ์ ํธ๋ฆฌํฐ, ํ๋ก์ ํธ์์ ASF์ ์ง์ ์ ์ผ๋ก ํต์ ํ๊ธฐ ์ํด ์ด๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
์ค๊ฐ ๋จ๊ณ๋ก ASF API์ ํ๋ก ํธ์๋ ์ญํ ์ ํ๋ Swagger documentation ์ด ์์ต๋๋ค. ์ด๊ฒ์ ASF API์ ์์ ํ ๋ฌธ์๋ฅผ ์ ๊ณตํ๊ณ ๋ ์ฝ๊ฒ ์ ๊ทผํ ์ ์๊ฒ ํด์ค๋๋ค. ๋ง์ฝ API๋ฅผ ํตํด ASF์ ํต์ ํ๋ ค๋ ๋๊ตฌ, ์ ํธ๋ฆฌํฐ ํน์ ๋ค๋ฅธ ํ๋ก์ ํธ๋ฅผ ์์ฑํ๋ ค๋ฉด Swagger ๋ฌธ์๋ฅผ ํ์ธํด๋ณด๋ ๊ฒ์ด ์ข์ต๋๋ค.
๊ฐ์ฅ ๋์ ๋จ๊ณ๋ก ASF API์ ๊ธฐ๋ฐํ ASF-ui ๊ฐ ์์ผ๋ฉฐ, ASF ์์
์ ์ํ๊ฐ๋ฅํ ์ฌ์ฉ์ ์นํ์ ์ธ ๋ฐฉ๋ฒ์ ์ ๊ณตํฉ๋๋ค. ์ด๊ฒ์ ์ต์ข
์ฌ์ฉ์๋ฅผ ์ํ ๊ธฐ๋ณธ IPC ์ธํฐํ์ด์ค์ด๋ฉฐ, ASF API๋ก ๋ง๋ค์ ์๋ ์๋ฒฝํ ์์ ์
๋๋ค. ์ํ๋ค๋ฉด --path
๋ช
๋ น์ค ์ธ์ ๋ฅผ ์ง์ ํ๊ณ , ๊ทธ๊ณณ์ ์์นํ ์ฌ์ฉ์ ์ง์ www
๋๋ ํ ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ฌ ์์ ๋ง์ ์ฌ์ฉ์ ์ง์ ์น UI๋ฅผ ์ฌ์ฉํ ์๋ ์์ต๋๋ค.
ASF-ui๋ ์ต์ข ์ฌ์ฉ์์๊ฒ ์ฌ์ฉ์ ์นํ์ ์ธ ๊ทธ๋ํฝ ์น ์ธํฐํ์ด์ค๋ฅผ ๋ง๋ค์ด์ฃผ๋ ๊ฒ์ ๋ชฉํ๋ก ํ๋ ์ปค๋ฎค๋ํฐ ํ๋ก์ ํธ์ ๋๋ค. ์ด๋ฅผ ๋ฌ์ฑํ๊ธฐ ์ํด ASF API ์ ํ๋ก ํธ์๋๋ก ๋์ํ์ฌ ์ฌ์ฉ์๊ฐ ๋ค์ํ ์์ ์ ์ฝ๊ฒ ํ ์ ์์ต๋๋ค. ์ด๊ฒ์ ASF์ ํจ๊ป ์ ๊ณต๋๋ ๊ธฐ๋ณธ UI ์ ๋๋ค.
์์์ ์ค๋ช ํ๋ฏ์ด ASF-ui๋ ASF ํต์ฌ ๊ฐ๋ฐ์๋ค์ด ์ ์ง๊ด๋ฆฌํ์ง ์๋ ์ปค๋ฎค๋ํฐ ํ๋ก์ ํธ์ ๋๋ค. ASF-ui ๋ฆฌํฌ ์ ์๋ ์์ฒด ํ๋ฆ์ ๋ฐ๋ผ๊ฐ๋ฉฐ, ์ด๊ณณ์์ ๋ชจ๋ ๊ด๋ จ๋ ์ง๋ฌธ, ์ด์, ๋ฒ๊ทธ ๋ณด๊ณ ๋ฐ ์ ์์ด ์ด๋ฃจ์ด์ง๋๋ค.
You can use ASF-ui for general management of ASF process. It allows for example to manage bots, modify settings, send commands, and achieve selected other functionality normally available through ASF.
ASF API๋ ๊ธฐ๋ณธ ๋ฐ์ดํฐ ํ์์ธ JSON์ ๊ธฐ๋ฐํ ์ ํ์ ์ธ REST ์๋ฆฌ๋ฅผ ๋ฐ๋ฅด๋ ์น API ์ ๋๋ค. ์๋ฆฌ๋ HTTP ์ํ์ฝ๋(ํด๋นํ๋ ๊ฒฝ์ฐ)์, ์ง์ ํ์ฑํด์ ์์ฒญ์ด ์ฑ๊ณตํ๋์ง ํน์ ์ ์คํจํ๋์ง๋ฅผ ์ ์ ์๋ ์๋ต์ ๋ชจ๋ ์ฌ์ฉํ์ฌ ์๋ต์ ์ ํํ๊ฒ ์ค๋ช ํ๊ธฐ ์ํด ์ต์ ์ ๋คํ๊ณ ์์ต๋๋ค.
ASF API๋ ์ ์ ํ /Api
๋จ๋ง์ ์ ์ ํ ์์ฒญ์ ๋ณด๋ด์ ์ ๊ทผ์ด ๊ฐ๋ฅํฉ๋๋ค. ์ด API ๋จ๋ง์ ์ฌ์ฉํด์ ์์ ๋ง์ ๋์ฐ๋ฏธ ์คํฌ๋ฆฝํธ, ๋๊ตฌ, GUI ๋ฑ๋ฑ์ ๋ง๋ค์ ์์ต๋๋ค. ์ด๊ฒ์ด ๋ฐ๋ก ASF-ui์ ๋น๊ฒฐ์ด๊ณ , ๋ค๋ฅธ ๋ชจ๋ ๋๊ตฌ๋ ๋์ผํฉ๋๋ค. ASF API๋ ๊ณต์์ ์ผ๋ก ์ง์๋๋ฉฐ ASF ํต์ฌ ํ์ด ์ ์ง๊ด๋ฆฌํฉ๋๋ค.
์ด์ฉ๊ฐ๋ฅํ ๋จ๋ง, ์ค๋ช , ์์ฒญ, ์๋ต, http ์ํ์ฝ๋์ ASF API์ ๋ํ ๋ค๋ฅธ ๋ชจ๋ ๊ฒ์ ๋ํ ์์ ํ ๋ฌธ์๋**swagger ๋ฌธ์**๋ฅผ ์ฐธ๊ณ ํ์๊ธฐ ๋ฐ๋๋๋ค.
IPC ์ธํฐํ์ด์ค๋ ์ถ๊ฐ ํ๊ฒฝ์ค์ ํ์ผ์ ์ง์ํฉ๋๋ค.IPC.config
ํ์ผ์ ํ์ค ASF config
๋๋ ํ ๋ฆฌ์ ๋ฃ์ผ์ญ์์ค.
์ฌ์ฉ๊ฐ๋ฅํ ๊ฒฝ์ฐ ์ด ํ์ผ์ ASF Kestrel http ์๋ฒ์ ๊ณ ๊ธ ํ๊ฒฝ์ค์ ๊ณผ ๋ค๋ฅธ IPC ๊ด๋ จ ์กฐ์ ์ฌํญ์ ์ ์ํฉ๋๋ค. ํน์ ํ ํ์๊ฐ ์๋ค๋ฉด ์ด ํ์ผ์ ์ฌ์ฉํ ์ด์ ๋ ์์ต๋๋ค. ASF๋ ์ด ๊ฒฝ์ฐ ํฉ๋ฆฌ์ ์ธ ๊ธฐ๋ณธ๊ฐ์ ์ฌ์ฉํฉ๋๋ค.
ํ๊ฒฝ์ค์ ํ์ผ์ ๋ค์์ JSON ๊ตฌ์กฐ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํฉ๋๋ค.
{
"Kestrel": {
"Endpoints": {
"example-http4": {
"Url": "http://127.0.0.1:1242"
},
"example-http6": {
"Url": "http://[::1]:1242"
},
"example-https4": {
"Url": "https://127.0.0.1:1242",
"Certificate": {
"Path": "/path/to/certificate.pfx",
"Password": "passwordToPfxFileAbove"
}
},
"example-https6": {
"Url": "https://[::1]:1242",
"Certificate": {
"Path": "/path/to/certificate.pfx",
"Password": "passwordToPfxFileAbove"
}
}
},
"KnownNetworks": [
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
],
"PathBase": "/"
}
}
Endpoints
- ์ด๊ฒ์ ๋จ๋ง์ ์งํฉ์
๋๋ค. ๋ชจ๋ ๋จ๋ง์ example-http4
์ ๊ฐ์ ์ ์ผํ ์ด๋ฆ์ ๊ฐ์ง๊ณ ์์ด์ผ ํ๋ฉฐ, Url
์์ฑ๊ฐ์ Protocol://Host:Port
์์ ์ฃผ์๋ฅผ ํน์ ํฉ๋๋ค. ๊ธฐ๋ณธ์ ์ผ๋ก ASF๋ IPv4์ IPv6 http ์ฃผ์๋ฅผ ์์ ํ์ง๋ง, ํ์ํ ์ง ๋ชฐ๋ผ ์ฌ์ฉํ ์ ์๋ https ์์๋ฅผ ์ถ๊ฐํด ๋์์ต๋๋ค. ํ์ํ ๋จ๋ง ๋ง์ ์ ์ธํด์ผ ํฉ๋๋ค. ๋น์ ์ด ์์ ํ๊ธฐ ์ฝ๋๋ก ์์ 4๊ฐ์ ์์๋ฅผ ๋ค์ด๋์์ต๋๋ค.
Host
accepts either localhost
, a fixed IP address of the interface it should listen on (IPv4/IPv6), or *
value that binds ASF's http server to all available interfaces. Using other values like mydomain.com
or 192.168.0.*
acts the same as *
, there is no IP filtering implemented, therefore be extremely careful when you use Host
values that allow remote access. ๊ทธ๋ ๊ฒ ํ๋ฉด ASF IPC ์ธํฐํ์ด์ค๋ ๋ค๋ฅธ ๊ธฐ๊ธฐ์์์ ์ ๊ทผ์ ํ์ฉํ๊ณ , ๋ณด์ ์ํ์ด ๋ ์ ์์ต๋๋ค. ์ด ๊ฒฝ์ฐ ์ต์ํ IPCPassword
, ๊ทธ๋ฆฌ๊ณ ๋ฐฉํ๋ฒฝ์ ์ฌ์ฉ์ ๊ฐ๋ ฅํ๊ฒ ๊ถ์ฅํฉ๋๋ค.
KnownNetworks
- This optional variable specifies network addresses which we consider trustworthy. By default, ASF is configured to trust loopback interface (localhost
, same machine) only. This property is used in two ways. Firstly, if you omit IPCPassword
, then we'll allow only machines from known networks to access ASF's API, and deny everybody else as a security measure. Secondly, this property is crucial in regards to reverse-proxies accessing ASF, as ASF will honor its headers only if the reverse-proxy server is from within known networks. Honoring the headers is crucial in regards to ASF's anti-bruteforce mechanism, as instead of banning the reverse-proxy in case of a problem, it'll ban the IP specified by the reverse-proxy as the source of the original message. Be extremely careful with the networks you specify here, as it allows a potential IP spoofing attack and unauthorized access in case the trusted machine is compromised or wrongly configured.
PathBase
- This is optional base path that will be used by IPC interface. Defaults to /
and shouldn't be required to modify for majority of use cases. ์ด ์์ฑ๊ฐ์ ๋ณ๊ฒฝํ๋ฉด ์ ์ฒด IPC ์ธํฐํ์ด์ค๋ฅผ ์ฌ์ฉ์ ์ง์ ์ ๋์ฌ์์ ํธ์คํ
ํ๊ฒ ๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด http://localhost:1242
๊ฐ ์๋๋ผ http://localhost:1242/MyPrefix
๊ฐ ๋ฉ๋๋ค. ์ฌ์ฉ์ ์ง์ PathBase
๋ ํน์ ํ URL๋ง ํ๋ก์ํ๊ธฐ ์ํ๋ ์ญ๋ฐฉํฅ ํ๋ก์์ ํน์ ์ค์น์์ ์กฐํฉ์ผ๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ์ ์ฒด mydomain.com
๋๋ฉ์ธ์ด ์๋mydomain.com/ASF
๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. Normally that would require from you to write a rewrite rule for your web server that would map mydomain.com/ASF/Api/X
-> localhost:1242/Api/X
, but instead you can define a custom PathBase
of /ASF
and achieve easier setup of mydomain.com/ASF/Api/X
-> localhost:1242/ASF/Api/X
.
๋น์ ์ด ์ฌ์ฉ์ ์ง์ ๊ธฐ๋ณธ ๊ฒฝ๋ก๋ฅผ ์ง์ ํ ํ์๊ฐ ์๋ค๊ณ ์ง์ฌ์ผ๋ก ๋ฏฟ์ง ์๋ ํ, ๊ธฐ๋ณธ๊ฐ์ผ๋ก ๋๋ ๊ฒ์ด ์ต์ ์ ๋๋ค.
The following config simply changes default ASF listening port from 1242
to 1337
. You can pick any port you like, but we recommend 1024-32767
range, as other ports are typically registered, and may for example require root
access on Linux.
{
"Kestrel": {
"Endpoints": {
"HTTP4": {
"Url": "http://127.0.0.1:1337"
},
"HTTP6": {
"Url": "http://[::1]:1337"
}
}
}
}
The following config will allow remote access from all sources, therefore you should ensure that you read and understood our security notice about that, available above.
{
"Kestrel": {
"Endpoints": {
"HTTP": {
"Url": "http://*:1242"
}
}
}
}
If you do not require access from all sources, but for example your LAN only, then it's much better idea to check local IP address of the machine hosting ASF, for example 192.168.0.10
and use it instead of *
in example config above.
ASF IPC ์ธํฐํ์ด์ค๋ ๊ธฐ๋ณธ์ ์ผ๋ก IPCPassword
๊ฐ null
๋ก ์ค์ ๋์ด ์์ผ๋ฏ๋ก ์ด๋ ํ ์ข
๋ฅ์ ์ธ์ฆ๋ ์๊ตฌํ์ง ์์ต๋๋ค. ํ์ง๋ง IPCPassword
๊ฐ ๋น ๊ฐ์ด ์๋๊ฒ์ผ๋ก ์ค์ ๋์ด ํ์ฑํ๋๋ฉด, ๋ชจ๋ ASF API ํธ์ถ์ IPCPassword
์ ๋ง๋ ์ํธ๋ฅผ ์๊ตฌํ ๊ฒ์
๋๋ค. ์ธ์ฆ์ ์๋ตํ๊ฑฐ๋ ์๋ชป๋ ์ํธ๋ฅผ ์
๋ ฅํ๋ฉด 401 - Unauthorized
์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. After 5 failed authentication attempts (wrong password), you'll get temporarily blocked with 403 - Forbidden
error.
์ธ์ฆ์ ๋๊ฐ์ง ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก ๊ฐ๋ฅํฉ๋๋ค.
์ผ๋ฐ์ ์ผ๋ก๋ Authentication
ํญ๋ชฉ์ ์ํธ๋ฅผ ๊ฐ์ผ๋ก ๋ฃ์ด์ HTTP ์์ฒญ ํค๋๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค. ์ด ๋ฐฉ๋ฒ์ ASF IPC ์ธํฐํ์ด์ค์ ์ ๊ทผํ๋ ์ค์ ๋๊ตฌ์ ๋ฐ๋ผ ๋ค๋ฆ
๋๋ค. ์๋ฅผ ๋ค์ด curl
์ ์ฌ์ฉํ๋ค๋ฉด -H 'Authentication: MyPassword'
๋ฅผ ์ธ์๋ก ๋ฃ์ด์ผ ํฉ๋๋ค. ์ด ๋ฐฉ๋ฒ์ผ๋ก ์ค์ ์ธ์ฆ์ด ์ผ์ด๋์ผ ํ๋ ์์ฒญ์ ํค๋ ๋ถ๋ถ์์ ์ธ์ฆ์ด ํต๊ณผ๋ฉ๋๋ค.
๋๋ password
๋งค๊ฐ๋ณ์๋ฅผ ํธ์ถํ๋ ค๋ URL์ ๋ง์ง๋ง์ ์ถ๊ฐํ ์๋ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด /Api/ASF
๋์ ์ /Api/ASF?password=MyPassword
๋ก ํธ์ถํฉ๋๋ค. ์ด ์ ๊ทผ๋ฐฉ๋ฒ๋ ์ถฉ๋ถํ ์ข์ง๋ง ๋ช
๋ฐฑํ๊ฒ ์ํธ๋ฅผ ์ด๋ฆฐ ๊ณณ์ ๋
ธ์ถํ๋ฏ๋ก ํญ์ ์ ์ ํ์ง๋ ์์ต๋๋ค. ๊ฒ๋ค๊ฐ ์ฟผ๋ฆฌ๋ฌธ์ ์ถ๊ฐ ์ธ์์ด๋ฏ๋ก URL์ด ๋ณต์กํด๋ณด์ด๊ณ , ์ํธ๊ฐ ASF API ํต์ ์ ์ฒด์ ์ ์ฉ๋๋๋ฐ๋ ๋ง์น ๊ทธ URL ์ ์ฉ์ธ ๊ฒ ๊ฐ์ ๋๋์ ์ค๋๋ค.
๋ ๋ฐฉ๋ฒ ๋ชจ๋ ์ง์๋๋ฉฐ ์ด๋ ๊ฒ์ ์ฌ์ฉํ ์ง๋ ๋น์ ์ ์ ํ์ ๋๋ค. ์ฐ๋ฆฌ๋ ๊ฐ๋ฅํ ๋ชจ๋ ๊ณณ์ HTTP ํค๋๋ฅผ ์ฌ์ฉํ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค. ์๋ฅผ ๋ค์๋ฏ์ด HTTP ํค๋๊ฐ ์ฟผ๋ฆฌ๋ฌธ๋ณด๋ค ๋ ์ ํฉํฉ๋๋ค. ํ์ง๋ง ํค๋ ์์ฒญ๊ณผ ๊ด๋ จ๋ ๋ค์ํ ์ ํ์ด ์๊ธฐ ๋๋ฌธ์ ์ฐ๋ฆฌ๋ ์ฟผ๋ฆฌ๋ฌธ๋ ์ง์์ ํฉ๋๋ค. RFC์ ๋ฐ๋ฅด๋ฉด ์์ ํ ์ ํจํฉ๋๋ค๋ง, ์๋ฐ์คํฌ๋ฆฝํธ์์ ์น์์ผ ์ฐ๊ฒฐ ์์์ ์ฌ์ฉ์ ์ง์ ํค๋์ ๋ถ์ฌ๋ ์ข์ ์์ ์ ๋๋ค. ์ด ๊ฒฝ์ฐ ์ฟผ๋ฆฌ๋ฌธ์ ์ ์ผํ ์ธ์ฆ๋ฐฉ๋ฒ์ ๋๋ค.
IPC ์ธํฐํ์ด์ค์๋ ASF API, ASF-ui์ ๋๋ถ์ด swagger ๋ฌธ์๊ฐ ์์ผ๋ฉฐ /swagger
URL ๋ก ์ ๊ทผ์ด ๊ฐ๋ฅํฉ๋๋ค. Swagger ๋ฌธ์๋ API ๊ตฌํ๊ณผ ์ด๋ฅผ ์ฌ์ฉํ๋ ASF-ui ๋ฑ ๋ค๋ฅธ ๋๊ตฌ๊ฐ์ ์ค๊ฐ๋ค๋ฆฌ ์ญํ ์ ํฉ๋๋ค. ์ด๊ฒ์ OpenAPI ์ฌ์์ ๋ชจ๋ API ๋จ๋ง์ ์์ ํ ๋ฌธ์์ด๋ฉฐ ๊ฐ๋ฅ์ฑ์
๋๋ค. ๋ค๋ฅธ ํ๋ก์ ํธ๋ ์ด๋ฅผ ์ฝ๊ฒ ์๋นํ ์ ์์ผ๋ฉฐ ASF API๋ฅผ ์ฝ๊ฒ ์์ฑํ๊ณ ํ
์คํธํ ์ ์์ต๋๋ค.
Swagger ๋ฌธ์๋ฅผ ASF API์ ์์ ํ ์ฌ์์ผ๋ก ์ฌ์ฉํ๋ ๊ฒ๊ณผ ๋ณ๊ฐ๋ก ์ฃผ๋ก ASF-ui์ ๊ตฌํ๋์ง ์์ ๋ค์ํ API ๋จ๋ง์ ์คํํ๋ ์ฌ์ฉ์ ์นํ์ ์ธ ๋ฐฉ๋ฒ์ผ๋ก ์ฌ์ฉํ ์๋ ์์ต๋๋ค. Swagger ๋ฌธ์๋ ASF ์ฝ๋์์ ์๋์ผ๋ก ์์ฑ๋๋ฏ๋ก ์ฌ์ฉ์ค์ธ ASF๊ฐ ํฌํจํ๋ API ๋จ๋ง๊ณผ ๋ฌธ์๊ฐ ํญ์ ์ต์ ์์ ๋ณด์ฅํฉ๋๋ค.
ASF๋ ๊ธฐ๋ณธ์ ์ผ๋ก localhost
์ฃผ์๋ฅผ ์์ ํฉ๋๋ค. ์ฆ ๋น์ ์์ ์ ๊ธฐ๊ธฐ๊ฐ ์๋ ๋ค๋ฅธ ๊ธฐ๊ธฐ๋ ASF IPC์ ์ ์ํ๋ ๊ฒ์ ๋ถ๊ฐ๋ฅํฉ๋๋ค. ๋น์ ์ด ๊ธฐ๋ณธ ๋จ๋ง์ ๋ณ๊ฒฝํ์ง ์๋ ํ, ๊ณต๊ฒฉ์๋ ASF IPC์ ์ ๊ทผํ๋ ค๋ฉด ๋น์ ์ ๊ธฐ๊ธฐ์ ์ง์ ์ ๊ทผํ ํ์๊ฐ ์์ต๋๋ค. ๋ฐ๋ผ์ ๊ฐ์ฅ ์์ ํ๋ฉฐ LAN์ ์ ์๋ ์ด๋ฅผ ํฌํจํ ๋ค๋ฅธ ๋๊ตฐ๊ฐ์ ์ ๊ทผ ๊ฐ๋ฅ์ฑ์ ์์ต๋๋ค.
ํ์ง๋ง ๊ธฐ๋ณธ localhost
ํ ๋น ์ฃผ์๋ฅผ ๋ค๋ฅธ ๋ฌด์ธ๊ฐ๋ก ๋ฐ๊พธ๊ธฐ๋ก ํ๋ค๋ฉด ๊ณต์ธ๋ IP๋ง ASF IPC ์ธํฐํ์ด์ค์ ์ ๊ทผํ๋๋ก ์ ์ ํ ๋ฐฉํ๋ฒฝ ๊ท์น์์ง์ ์ค์ ํด์ผ ํฉ๋๋ค. In addition to doing that, you will need to set up IPCPassword
, as ASF will refuse to let other machines access ASF API without one, which adds another layer of extra security. ์ด ๊ฒฝ์ฐ ASF IPC ์ธํฐํ์ด์ค๋ฅผ ์ญ๋ฐฉํฅ ํ๋ก์ ๋ค์์ ์คํํ๊ณ ์ถ์์๋ ์์ต๋๋ค. ์ด๋ ์๋์์ ์ถ๊ฐ๋ก ์ค๋ช
ํฉ๋๋ค.
์. ์ด๊ฒ์ ASF API๊ฐ ์ค๊ณ๋ ์ด์ ์ด๋ฉฐ ์ ๊ทผ์ ์ํ HTTP ์์ฒญ์ ๋ณด๋ด๋ ๊ฒ์ผ๋ก ๋ฌด์์ด๋ ํ ์ ์์ต๋๋ค. ๋ก์ปฌ ์ฌ์ฉ์์คํฌ๋ฆฝํธ๋ ๊ต์ฐจ ์ถ์ฒ ๋ฆฌ์์ค ๊ณต์ (CORS, Cross-origin resource sharing) ๋
ผ๋ฆฌ ๊ตฌ์กฐ๋ฅผ ๋ฐ๋ฅด๋ฏ๋ก, ์ถ๊ฐ ๋ณด์ ์กฐ์น๋ก IPCPassword
๊ฐ ์ค์ ๋์ด ์๋ค๋ฉด ์ฐ๋ฆฌ๋ ์ด๋ฅผ ์ํด ๋ชจ๋ ๊ณณ(*
)์์์ ์ ๊ทผ์ ํ์ฉํฉ๋๋ค. ์ด๋ ๊ฒ ํด์ ์ ์ฌ์ ์ผ๋ก ์
์์ ์ธ ์คํฌ๋ฆฝํธ๊ฐ ์๋์ผ๋ก ์์ฒญ์ ์คํํ๋ ๊ฒ์ ๋ง์ผ๋ฉด์ ๋ค์ํ ์ธ์ฆ๋ฐ์ ASF API ์์ฒญ์ ์คํํ ์ ์์ต๋๋ค.(์
์์ ์ธ ์คํฌ๋ฆฝํธ๋ ์์ฒญ ์คํ์ ์ํด IPCPassword
๋ฅผ ์์์ผ๋ง ํฉ๋๋ค.)
Yes, we recommend to use a reverse proxy for that. ์ด๋ ๊ฒ ํด์ ์น์๋ฒ์ ์ ํ์ ์ธ ๋ฐฉ๋ฒ์ผ๋ก ์ ๊ทผํ ์ ์๊ณ ASF IPC๋ฅผ ๋์ผํ ๊ธฐ๊ธฐ์์ ์ ๊ทผํ ์ ์์ต๋๋ค. ๋๋, ์ญ๋ฐฉํฅ ํ๋ก์๋ฅผ ์คํํ์ง ์์ผ๋ ค๋ฉด ์ ์ ํ URL์ ๊ฐ์ง ์ฌ์ฉ์ ์ง์ ํ๊ฒฝ์ค์ ์ ์ฌ์ฉํ ์๋ ์์ต๋๋ค. For example, if your machine is in a VPN with 10.8.0.1
address, then you can set http://10.8.0.1:1242
listening URL in IPC config, which would enable IPC access from within your private VPN, but not from anywhere else.
์. IPC๋ ๊ทธ๋ฐ ์ค์น์ ์์ ํ ํธํ๋๋ฏ๋ก ์ํ๋ค๋ฉด ์ถ๊ฐ ๋ณด์๊ณผ ํธํ์ฑ์ ์ํด ๋น์ ์ ๋๊ตฌ ์์์ ํธ์คํ ํด๋ ์ข์ต๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ASF์ Kestrel http ์๋ฒ๋ ์ธํฐ๋ท์ ์ง์ ์ฐ๊ฒฐ๋์์ ๋ ๋งค์ฐ ์์ ํ๊ณ ์ํ์ด ์์ต๋๋ค. ํ์ง๋ง Apache๋ Nginx ๊ฐ์ ์ญ๋ฐฉํฅ ํ๋ก์ ๋ค์ ๋์ผ๋ฉด ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก๋ ํ ์ ์๋ ์ถ๊ฐ ๊ธฐ๋ฅ๋ค, ์๋ฅผ ๋ค๋ฉด ASF ์ธํฐํ์ด์ค๋ฅผ ๊ธฐ์ด ์ธ์ฆ(Basic auth) ์ผ๋ก ์์ ํ๊ฒ ํ๋ ๊ฒ ๊ฐ์ ๊ธฐ๋ฅ๋ค์ ์ ๊ณตํ ์ง๋ ๋ชจ๋ฆ ๋๋ค.
Nginx ํ๊ฒฝ์ค์ ์ ์์๋ ์๋์ ์์ต๋๋ค. We've included full server
block, although you're interested mainly in location
ones. ๋ ์์ธํ ์ค๋ช
์ด ํ์ํ๋ฉด nginx ๋ฌธ์(์๋ฌธ) ๋ฅผ ์ฐธ๊ณ ํ์ญ์์ค.
server {
listen *:443 ssl;
server_name asf.mydomain.com;
ssl_certificate /path/to/your/certificate.crt;
ssl_certificate_key /path/to/your/certificate.key;
location ~* /Api/NLog {
proxy_pass http://127.0.0.1:1242;
# Only if you need to override default host
# proxy_set_header Host 127.0.0.1;
# X-headers should always be specified when proxying requests to ASF
# They're crucial for proper identification of original IP, allowing ASF to e.g. ban the actual offenders instead of your nginx server
# Specifying them allows ASF to properly resolve IP addresses of users making requests - making nginx work as a reverse proxy
# Not specifying them will cause ASF to treat your nginx as the client - nginx will act as a traditional proxy in this case
# If you're unable to host nginx service on the same machine as ASF, you most likely want to set KnownNetworks appropriately in addition to those
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
# We add those 3 extra options for websockets proxying, see https://nginx.org/en/docs/http/websocket.html
proxy_http_version 1.1;
proxy_set_header Connection "Upgrade";
proxy_set_header Upgrade $http_upgrade;
}
location / {
proxy_pass http://127.0.0.1:1242;
# Only if you need to override default host
# proxy_set_header Host 127.0.0.1;
# X-headers should always be specified when proxying requests to ASF
# They're crucial for proper identification of original IP, allowing ASF to e.g. ban the actual offenders instead of your nginx server
# Specifying them allows ASF to properly resolve IP addresses of users making requests - making nginx work as a reverse proxy
# Not specifying them will cause ASF to treat your nginx as the client - nginx will act as a traditional proxy in this case
# If you're unable to host nginx service on the same machine as ASF, you most likely want to set KnownNetworks appropriately in addition to those
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
๋ค์์ ์ํ์น ํ๊ฒฝ์ค์ ์ ์์์ ๋๋ค. Please refer to apache documentation if you need further explanation.
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName asf.mydomain.com
SSLEngine On
SSLCertificateFile /path/to/your/fullchain.pem
SSLCertificateKeyFile /path/to/your/privkey.pem
# TODO: Apache can't do case-insensitive matching properly, so we hardcode two most commonly used cases
ProxyPass "/api/nlog" "ws://127.0.0.1:1242/api/nlog"
ProxyPass "/Api/NLog" "ws://127.0.0.1:1242/Api/NLog"
ProxyPass "/" "http://127.0.0.1:1242/"
</VirtualHost>
</IfModule>
Yes, you can achieve it through two different ways. A recommended way would be to use a reverse proxy for that, where you can access your web server through https like usual, and connect through it with ASF's IPC interface on the same machine. ์ด ๋ฐฉ๋ฒ์ ํธ๋ํฝ์ด ์์ ํ ์ํธํ๋๋ฏ๋ก ์ด๋ฐ ์ค์น๋ฅผ ์ํด IPC๋ฅผ ์ด๋ค ๋ฐฉ์์ผ๋ก๋ ์์ ํ ํ์๊ฐ ์์ต๋๋ค.
Second way includes specifying a custom config for ASF's IPC interface where you can enable https endpoint and provide appropriate certificate directly to our Kestrel http server. ์ด ๋ฐฉ๋ฒ์ ๋ค๋ฅธ ์น์๋ฒ๋ฅผ ์คํํ์ง ์๊ณ ์์ผ๋ฉฐ ์ค์ง ASF๋ฅผ ์ํด์ ์น์๋ฒ๋ฅผ ์ถ๊ฐ๋ก ์คํํ๊ณ ์ถ์ง ์์ ๊ฒฝ์ฐ ์ถ์ฒํฉ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ์ญ๋ฐฉํฅ ํ๋ก์ ๊ตฌ์กฐ๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ์ค์นํ๋๋ฐ ํจ์ฌ ์ฌ์ธ ๊ฒ์ ๋๋ค.
During startup of IPC I'm getting an error: System.IO.IOException: Failed to bind to address, An attempt was made to access a socket in a way forbidden by its access permissions
This error indicates that something else on your machine is either already using that port, or reserved it for future use. This could be you if you're attempting to run second ASF instance on the same machine, but most often that's Windows excluding port 1242
from your usage, therefore you'll have to move ASF to another port. In order to do that, follow example config above, and simply try to pick another port, such as 12420
.
Of course you could also try to find out what is blocking port 1242
from ASF usage, and remove that, but that's usually far more troublesome than simply instructing ASF to use another port, so we'll skip elaborating further on that here.
Starting with ASF V5.1.2.1, we've added additional security measure that, by default, allows only loopback interface (localhost
, your own machine) to access ASF API without IPCPassword
set in the config. This is because using IPCPassword
should be a minimum security measure set by everybody who decides to expose ASF interface further.
The change was dictated by the fact that massive amount of ASFs hosted globally by unaware users were being taken over for malicious intents, usually leaving people without accounts and without items on them. Now we could say "they could read this page before opening ASF to the entire world", but instead it makes more sense to disallow insecure ASF setups by default, and require from users an action if they explicitly want to allow it, which we elaborate about below.
In particular, you're able to override our decision by specifying the networks which you trust to reach ASF without IPCPassword
specified, you can set those in KnownNetworks
property in custom config. However, unless you really know what you're doing and fully understand the risks, you should instead use IPCPassword
as declaring KnownNetworks
will allow everybody from those networks to access ASF API unconditionally. We're serious, people were already shooting themselves in the foot believing their reverse proxies and iptables rules were secure, but they weren't, IPCPassword
is the first and sometimes the last guardian, if you decide to opt out of this simple, yet very effective and secure mechanism, you'll have only yourself to blame.