使用SpringBoot、Java1.8、云配置服务器
我试图使用这个application.yml片段访问git回购。但是找不到主机密钥。
spring:
cloud:
config:
allowOverride: true
failFast: true
overrideNone: true
overrideSystemProperties: false
server:
git:
uri: ssh://git@10.4.31.179:7999/project/name.git
地址在我的knowHosts文件中:
10.4.31.179:7999,10.4.31.179 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1UF27s4svxRyc3eQVq67hOhl9szwXy15oaUmo5Ndtk9DP5QEvstSA1MR0JotcKrhEHb4FA8a06oRvkyj55zfvr9t96O/sva+66TegPGjiWZNU75LSEKhA8EZ+/VEKVA2Pk1iUEYbtFZZ+SuTKtikXQt0EjghHpx66mWEJU11911+quCfjOIL74tz96IoXBfTZJmhiUQN+SC4UG3bCnha3mMlCnb1/0BkX+YuAy3GN+UTSxCqeEHuwhN8+DsPhVgTKx/YVbhZUPlGlYEUZjjXk6RnyhQr32Jwzv4WpeVu943e2UzlUFMMorl+usur7bSAZWsQWyz6MfjYUyKZkdZYjQ==
堆栈跟踪:
com.jcraft.jsch.JSchException: UnknownHostKey: 10.4.31.179. RSA key fingerprint is 9e:6a:f1:59:98:59:e4:f8:ac:39:e7:02:07:d8:4f:58
at com.jcraft.jsch.Session.checkHost(Session.java:786)
at com.jcraft.jsch.Session.connect(Session.java:342)
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116)
at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:136)
at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262)
at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161)
at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1115)
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:178)
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:125)
at org.springframework.cloud.config.server.JGitEnvironmentRepository.cloneToBasedir(JGitEnvironmentRepository.java:269)
at org.springframework.cloud.config.server.JGitEnvironmentRepository.copyRepository(JGitEnvironmentRepository.java:241)
at org.springframework.cloud.config.server.JGitEnvironmentRepository.createGitClient(JGitEnvironmentRepository.java:226)
at org.springframework.cloud.config.server.JGitEnvironmentRepository.findOne(JGitEnvironmentRepository.java:114)
at org.springframework.cloud.config.server.MultipleJGitEnvironmentRepository.findOne(MultipleJGitEnvironmentRepository.java:87)
at org.springframework.cloud.config.server.EnvironmentController.labelled(EnvironmentController.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:775)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:856)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:841)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:300)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:103)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
你知道为什么这样不行吗?
我认为在您的knowHosts
文件中,应该使用如下格式的[host]:port
格式:
[10.4.31.179]:7999,10.4.31.179 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1UF27s4svxRyc3eQVq67hOhl9szwXy15oaUmo5Ndtk9DP5QEvstSA1MR0JotcKrhEHb4FA8a06oRvkyj55zfvr9t96O/sva+66TegPGjiWZNU75LSEKhA8EZ+/VEKVA2Pk1iUEYbtFZZ+SuTKtikXQt0EjghHpx66mWEJU11911+quCfjOIL74tz96IoXBfTZJmhiUQN+SC4UG3bCnha3mMlCnb1/0BkX+YuAy3GN+UTSxCqeEHuwhN8+DsPhVgTKx/YVbhZUPlGlYEUZjjXk6RnyhQr32Jwzv4WpeVu943e2UzlUFMMorl+usur7bSAZWsQWyz6MfjYUyKZkdZYjQ==
sshd手册页上写着:
主机名或地址可以选择包含在[和]括号内,然后在后面加上:和非标准端口号。
或
你可以从命令行ssh
ssh 10.4.31.179 -p 7999
然后接受公钥,然后将正确设置knowHosts
文件。
如果仍然不起作用,则显式设置知道主机
文件。
jsch.setKnownHosts(knowHostsFileName)
这就是我的解决方案:
>
创建一个~/. ssh/config
如下,不要忘记添加StrictHostKeyChecking到false
:
Host git
HostName 10.4.31.179
StrictHostKeyChecking no
Port 7999
User git
IdentityFile ~/.ssh/id_rsa
在应用程序中。yml
通过git:/project/name更改uri。git
spring:
cloud:
config:
allowOverride: true
failFast: true
overrideNone: true
overrideSystemProperties: false
server:
git:
uri: git:/project/name.git
这是一个相关的GitHub问题和评论。
TL; DR在尝试连接到存储库服务器之前,需要使用非散列格式更新~/. ssh/known_hosts
。
一艘班轮,
ssh-keyscan -t rsa {hostname or IP} >> ~/.ssh/known_hosts
我试图在多台服务器上运行ansible角色,但出现错误: 致命:[192.168.0.10]:无法到达= 我的/etc/ansible/hosts文件如下所示: 我不知道发生了什么-一切看起来都很好-我可以通过SSH登录,但ansible ping返回相同的错误。 详细执行的日志: 你能帮我个忙吗?如果我必须在本地模式(-c local)下使用ansible,那么它是无用的。 我试图删除ansib
我在连接到存储配置的存储库时,在Spring云配置服务器(Spring引导)日志中看到问题。我不确定它是否由于凭据或其他原因而无法克隆(不允许git-upload-pack)。任何指向此的指针都将很棒。 配置服务器应用程序的Spring启动应用程序属性如下所示 - endpoint返回以下响应:
我试图使用远程SSH扩展来编辑Debian服务器上的文件。SSH连接已正确建立,但随后我收到一条错误消息: 和日志: 我在其他几个服务器上使用远程ssh连接,从来没有出现过这个错误。我已经测试了从网络上收集的一些东西,但到目前为止没有任何效果。 有人能告诉我问题的原因或可能的解决方案吗?谢谢
当我击球时http://localhost:8888/limits-服务/默认设置: 这是我的应用程序属性文件: 这是我的本地git回购文件: 这是我的主要课程: 请帮我解决这个问题。
我得到权限拒绝(公钥)。在Windows 7 x64上 我所做的是: 1)也更新了我的git openSSH 2) 使用ssh keygen生成的密钥-t rsa-b 4096-C“myemail@gmailcom" 3) 把它们命名为“hub”,所以我有hub-hub。酒吧。ssh文件夹 4) 运行ssh代理 5) 运行ssh代理sh-c“ssh add”/hub’it said identit
我正在尝试创建一个简单的Spring Cloud Config服务器/客户端设置,并松散地遵循留档: https://cloud.spring.io/spring-cloud-config/reference/html/ 到目前为止,我已经实现了一个似乎工作正常的服务器,即在调用相应endpoint时返回正确的属性值: 然而,我没有任何运气让客户端连接到服务器。我做了以下工作: 添加了依赖项: 但