Recent updates seemed to stop rake task themes:update to use a proxy server에서 이어지는 토론입니다:
그 타임아웃 오류 때문에 테마 컴포넌트를 가져오거나 업데이트할 수 없었습니다. 마침내 원인을 파악했습니다. <Discourse>/lib/theme_store/git_importer.rb 파일에서 -로 시작하는 아래 줄들을 삭제하면 됩니다:
def clone_http!
uri = redirected_uri
raise_import_error! if %w[http https].exclude?(@uri.scheme)
- addresses = FinalDestination::SSRFDetector.lookup_and_filter_ips(uri.host)
- raise_import_error! if addresses.empty?
env = { "GIT_TERMINAL_PROMPT" => "0" }
args =
clone_args(
uri.to_s,
- "http.followRedirects" => "false",
- "http.curloptResolve" => "#{uri.host}:#{uri.port}:#{addresses.join(",")}",
)
begin
Discourse::Utils.execute_command(env, *args, timeout: COMMAND_TIMEOUT_SECONDS)
rescue RuntimeError
raise_import_error!
end
end
이 코드 부분은 DNS를 사전에 해석(pre-resolve)한 후 git이 해당 사전 해석에서 얻은 IP 주소를 사용하도록 강제합니다. 제 서버에서 이것이 왜 항상 실패하는지 모르겠으므로, 해당 로직을 제거했습니다.
사실 이 로직이 존재하는 이유에 대해 질문이 있습니다. git 자체도 DNS 해석을 수행하는데, 왜 이 로직이 필요한가요? 명확하지 않은 부분인데, 일종의 MITM(인접 공격) 방지 조치인가요?