V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
jacy
V2EX  ›  问与答

能否将自己的 vps 变为 ggc?

  •  
  •   jacy · 2014-06-15 11:40:37 +08:00 · 5896 次点击
    这是一个创建于 3608 天前的主题,其中的信息可能已经有所发展或是发生改变。
    今天发现sinaapp.co都用不了了,这网站原理简单暴力,就是自动尝试gcc的大量ip,终于在今天全废了,想用搜索都得翻越长城了。
    https://peering.google.com/about/getting_ggc.html
    https://peering.google.com/iwantggc/
    发现是可以向谷歌申请搭建ggc的,但个人申请估计无望了。我想能否将自己的vps转发谷歌的80和443端口的服务,然后自己电脑的hosts把谷歌服务的域名设为自己vps的ip,有没有什么方案可以实现呢?
    第 1 条附言  ·  2014-06-15 18:55:32 +08:00
    已经通过nginx反向代理实现了转发http的服务,但是https没有谷歌的私钥,用自己的效果不好,怎么办呢
    第 2 条附言  ·  2014-06-16 10:20:24 +08:00
    已经换成debian用sniproxy了,解决了https的问题。唯一的不足是匿名代理,谷歌账户经常被安全拦截。不知道能否设置成透明的。
    21 条回复    2014-06-17 10:43:04 +08:00
    lanbing
        1
    lanbing  
       2014-06-15 11:46:03 +08:00 via Android   ❤️ 1
    反向代理。
    jacy
        2
    jacy  
    OP
       2014-06-15 11:50:40 +08:00
    @lanbing 反向代理后用hosts方式能使谷歌不同域名的服务正常工作吗?
    wwqgtxx
        3
    wwqgtxx  
       2014-06-15 12:13:43 +08:00 via Android   ❤️ 1
    可以呀,直接用nginx端口转发,本地改一下hosts即可
    但只能是https
    jacy
        4
    jacy  
    OP
       2014-06-15 12:51:43 +08:00
    @wwqgtxx http测试成功了,https有个问题,没有谷歌的证书,用自己的证书因为是Hosts了谷歌的域名,不能被信任,如何解决?
    xxr3376
        5
    xxr3376  
       2014-06-15 13:25:25 +08:00
    @jacy 在国内的一台机器上再做一次http -> https的转发
    v3aqb
        6
    v3aqb  
       2014-06-15 14:07:48 +08:00
    sni代理
    phyng
        7
    phyng  
       2014-06-15 14:43:39 +08:00
    @v3aqb 这个 https://github.com/dlundquist/sniproxy ? 好像支持HTTPS不需要证书
    O21
        8
    O21  
       2014-06-15 14:55:50 +08:00 via iPhone
    国外一台vps 国内的话用树媒派 在家做个http转发 就可以了 这就是所谓apn 在配置个pac 那是相当方便
    billlee
        9
    billlee  
       2014-06-15 15:14:43 +08:00
    @jacy 可以直接从网络层转发
    iptables -t nat -A PREROUTING -p tcp --dport https -d 转发服务器的IP -j DNAT --to-destination Google的IP
    iptables -t nat -A POSTROUTING -p tcp --dport https -d Google的IP -j SNAT --to-source 转发服务器的IP
    iptables -t filter -P FORWARD DROP
    iptables -t filter -A FORWARD -p tcp --dport https -d Google的IP -j ALLOW
    sysctl net.ipv4.ip_forward = 1

    注意这种配置是开放代理
    v3aqb
        10
    v3aqb  
       2014-06-15 17:39:08 +08:00
    @phyng 不需要。从ssl握手包里找主机名,然后把握手包转发过去
    jacy
        11
    jacy  
    OP
       2014-06-15 17:46:48 +08:00
    @billlee vps不支持ALLOW啊,郁闷
    iptables v1.4.7: Couldn't load target `ALLOW':/lib/xtables/libipt_ALLOW.so: cann
    ot open shared object file: No such file or directory
    jacy
        12
    jacy  
    OP
       2014-06-15 17:51:28 +08:00
    @v3aqb centos6 下编译报错
    billlee
        13
    billlee  
       2014-06-15 18:26:52 +08:00   ❤️ 1
    @jacy 我的笔误,应该是 -j ACCEPT
    jacy
        14
    jacy  
    OP
       2014-06-15 18:40:59 +08:00
    @billlee 已经设置好了,不过没访问https://我的vps 没有反应。。

    [root@default]iptables -L
    Chain INPUT (policy ACCEPT)
    target prot opt source destination

    Chain FORWARD (policy DROP)
    target prot opt source destination
    ACCEPT tcp -- anywhere sea09s02-in-f18.1e100.net tcp dpt:https

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination
    billlee
        15
    billlee  
       2014-06-15 19:10:41 +08:00   ❤️ 1
    @jacy 额,还少了一条规则允许从服务器返回的数据,总的是

    iptables -t nat -A PREROUTING -p tcp --dport https -d 转发服务器的IP -j DNAT --to-destination Google的IP
    iptables -t nat -A POSTROUTING -p tcp --dport https -d Google的IP -j SNAT --to-source 转发服务器的IP
    iptables -t filter -P FORWARD DROP
    iptables -t filter -A FORWARD -p tcp --dport https -d Google的IP -j ACCEPT
    iptables -t filter -A FORWARD -p tcp --sport https -s Google的IP -j ACCEPT # 刚才少了这条
    sysctl net.ipv4.ip_forward=1
    jacy
        16
    jacy  
    OP
       2014-06-15 21:16:02 +08:00
    @billlee 非常感谢。看起来没问题,但是设置好了确实不能工作,443端口连接超时,不知道怎么回事。
    kqz901002
        17
    kqz901002  
       2014-06-16 08:35:11 +08:00 via Android
    用google给官方的ggc
    czyhd
        18
    czyhd  
       2014-06-16 14:14:50 +08:00
    这样会不会被gfw当成google的新ip给封了?
    jacy
        19
    jacy  
    OP
       2014-06-16 18:30:00 +08:00
    @czyhd 不知道,不过我处理过了,直接访问我的ip不会显示google,必须hosts过去。
    shierji
        20
    shierji  
       2014-06-16 19:45:31 +08:00
    lehui99
        21
    lehui99  
       2014-06-17 10:43:04 +08:00
    /t/117794 这样就完全解决你的问题了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2094 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 01:54 · PVG 09:54 · LAX 18:54 · JFK 21:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.