#ssh

SSHException: not a valid RSA private key file

Published at September 26, 2019 ·  1 min read

在使用 paramiko 或 fabric2 通过 private key 连接服务器时会遇到 SSHException: not a valid RSA private key file 的报错,此类问题一般是 private key 的格式,在 macOS 可以使用 brew install puttygen centos/ubuntu 中使用 apt-get install putty-tools or yum install putty 安装 putty ,并通过 puttygen id_rsa -O private-openssh -o new.key 将其转换成 private-openssh 格式,即可按照常规方式使用。...


通过 Golang 学习 http 协议,如何用 Golang 实现 https 代理

Published at August 31, 2019 ·  1 min read

在 http.HandlerFunc 中检查 r.Method 为 Connect 后及将请求交给 handleTunneling,其中关键的是将 http.ResponseWriter 转换为 http.Hijacker 接管连接,并通过两个 goroutine transfer 复制请求。 func handleTunneling(w http.ResponseWriter, r *http.Request) { dst, err := net.DialTimeout("tcp", r.Host, 10*time.Second) if err != nil { http.Error(w, err.Error(), http.StatusServiceUnavailable) return } w.WriteHeader(http.StatusOK) hijacker, ok := w.(http.Hijacker) if !ok { http.Error(w, "Hijacking not supported", http.StatusInternalServerError) return } conn, _, err := hijacker.Hijack() if err != nil { http.Error(w, err.Error(), http.StatusServiceUnavailable) } go transfer(dst, conn) go transfer(conn, dst) } func transfer(dst io....


在长城宽带等某些垃圾宽带的网络环境下,通过 ssh 连接某些服务器经常会出现 timeout 的解决方法

Published at August 30, 2019 ·  1 min read

可在 .ssh/config 中配置以下命令,通过 ssh q 连接服务器。 HostName 为目标服务器 ip, -X 5 为 socks5 代理, localhost:6153 为 socks5 代理地址。 Host q HostName 47.240.33.24 User root ProxyCommand nc -X 5 -x localhost:6153 %h %p 与此方法类似的是,可以配置通过跳板机,在客户端直接访问内网服务器。jumper server 为跳板机,在正常情况下,处于内网环境的 target 服务器无法直接从客户端访问,需经过跳板机访问,此时,则可通过如下配置,在 Terminal 中运行 ssh target 访问跳板机后面的目标服务器。 Host target HostName 172.16.6.2 Port 35000 User root IdentityFile /Users/tonywang/target.key ProxyCommand ssh -q -W %h:%p jumperserver Host jumperserver HostName 192.168.1.2 Port 35000 IdentityFile /Users/tonywang/js.key User root ...


How to Access a Remote Server Using a Jump Host

Published at June 19, 2019 ·  1 min read

通过配置 ssh config ,实现在本地快捷通过跳板机登陆目标服务器,与配置 ssh proxy 较为类似 How to Access a Remote Server Using a Jump Host...



Tags

abcs accept acid activemq affinity algorithm allocation android array async aws b+tree b-tree backoff benchmark best-practices bfs big-o bigquery bind bitcount blog break broker bubble buffer cache cap cert cgroups channel citus class classmethod closure closures cluster concurrency config consistency consumer container context cookie cors crawler cronjob csrf ctr data-science data-structure database datadog dataflow datascience decorator deepcopy defer dfs distributed django dns docker double-shipping drf ecosia elastic-search enumerate epoll equal errgroup escaping event extra fabric2 facebook-pixel financial-report flask flutter forward-proxy freelance frontend frp garbage-collector gc gcp generator gesture get gil git golang goroutine graphql ha handbook haproxy hash hash-slot hashring hashtable hpa http http-auth http-proxy http_proxy https index init innodb instagram intention-lock intergration interview ios is javascript jinja2 jobboard json jwt k8s kafka kibana kqueue label lambda layer4 layer7 lean levels.io linked-list linux list listen loadbalancer lock logs long-tail lru marketing master matplotlib memory merge metaclass metaprogramming metrics metrics-server microservices mitm mobile model mongo mongoose mq myisam mysql namespace nat netflix network network-extension nginx nodejs nomad nosql notification npm oodesign openssl optimization orm osi pandas parallelism paramiko parkinglot patroni permission pg pipeline pixelme post postgresql postresql prefetch_related prerender private-key process proxy proxycommand put pvm python queue rabbitmq rbac react-native reactive reactjs rebase redis redis-cluster replication resource rest restfulapi retargeting retry revenue reverse-proxy rocketmq rsa rxswift saas scaffold scaleable search-engine security select seo serverless service session set shadosocks shadowsocks shard sharding shell shopify sigint signal sigterm singleton slack slave slow-query sniper sns socket socks5 source-code spa sql sqlalchemy sqs ssh ssl ssl-pinning stack startup state stateful stateless staticmethod string struct swift swiftui switch syscall system-design systemctl tcp tcp-proxy thread tmpreaper token traefik trustkit tunning type typeform udp userdefaults variable vc voidcallback vpn vuejs weak web web-development where widget with yarn zset 削峰 单例模式 宽索引 异步 看源码学-golang 窄索引 解耦 跨域 跳板机


Archives

2020 (6)
2019 (157)
0001 (5)