一键查询服务器地理位置

在浏览网站时,经常会有看一下网站服务器放在地球那个角落的需求,再顺便看一下whois信息…当然你可以登录一些专门的whois等工具类网站进行查询,这里介绍一个简便的方法。

其实浏览器地址栏可以直接运行javascript,把这些js代码保存为书签,就可以达到上述要求。

直接上代码

javascript:
url=’https://223.5.5.5/resolve?name=’+top.location.hostname+’&type=A&short=1′;
console.log(url);
fetch(url)
.then(response=>response.json())
.then(json=>{
console.log(json);
console.log(‘json.length=’+json.length);
for(var i=0;i<json.length;i++)
{
window.open(‘https://db-ip.com/’+json[i],’_blank’)
}
}
)
.catch(err=>console.log(‘Request Failed’,err));

解释一下,首先top.location.hostname获取域名,通过阿里的公共DNS API('https://223.5.5.5/resolve?name='+top.location.hostname+'&type=A&short=1')查询域名对应ip地址,为什么通过第三方服务呢?因为js是直接获取不了服务器ip的,API返回一个ip地址json数组,分别取出在db-ip.com进行查询。将下面的代码保存为书签地址点击试一下。

javascript:url=’https://223.5.5.5/resolve?name=’+top.location.hostname+’&type=A&short=1′;console.log(url);fetch(url) .then(response=>response.json()) .then(json=>{console.log(json);console.log(‘json.length=’+json.length);for(var i=0;i<json.length;i++){window.open(‘https://db-ip.com/’+json[i],’_blank’)}}) .catch(err=>console.log(‘Request Failed’,err));

注意:1、如果服务器对应多个ip地址,你需要关闭浏览器的防弹出窗口,否则默认查询第一个。

2、代码里加了一些控制台输出,你也可以删除掉。

3、必须以”javascript:”开头,上述代码保存时需写在一行里,这里是为了浏览方便。

其他,比如直接查询网站whois,代码如下:

javascript:window.open('http://whois.chinaz.com/?DomainName='+top.location.hostname,'_blank');

为apache提供http2支持

截至2015年末,主要的浏览器的最新版本已经支持HTTP/2协议。其中:Google Chrome、Mozilla Firefox、Microsoft Edge和Opera已支持HTTP/2,并默认启用。Internet Explorer自IE 11开始支持HTTP/2,并预设启用。
下面简述ubuntu16.04 下apache下开启http2的几种方法。

1、使用ppa:ondrej
UBUNTU 16.04默认源里的APACHE为2.4.18版,没有HTTP2模块,直接启用HTTP2会找不到模块。

a2enmod http2
ERROR: Module http2 does not exist!

ppa:ondrej是一个比较知名的源,最新的apache版本是2.4.38

sudo add-apt-repository ppa:ondrej/apache2
sudo apt update
sudo apt install apache2
a2enmod http2

安装Let’s Encrypt,在默认配置文件的SERVERNAME下添加一行:

<VirtualHost x.x.x.x:443>
Protocols h2 http/1.1


</VirtualHost>

重启apache

service apache2 restart

2、编译apache 2.4.41
我们需要安装 nghttp2(http2 的 C 语言库)

#安装编译工具等
sudo apt-get install git g++ make binutils autoconf automake autotools-dev libtool pkg-config \
zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev \
libjemalloc-dev cython python3-dev python-setuptools libpcre3 libpcre3-dev openssl

#编译安装nghttp2
git clone https://github.com/tatsuhiro-t/nghttp2.git
cd nghttp2
autoreconf -i
automake
autoconf
./configure
make
make install

安装PRCE

#apt-get install libpcre3 libpcre3-dev

#已经安装

编译apache

cd ~
wget http://archive.apache.org/dist/httpd/httpd-2.4.18.tar.gz
wget https://www-us.apache.org/dist/apr/apr-1.7.0.tar.gz
wget https://www-us.apache.org/dist/apr/apr-util-1.6.1.tar.gz
tar xzf httpd-2.4.18.tar.gz
tar xzf apr-1.7.0.tar.gz
tar xzf apr-util-1.6.1.tar.gz
mv apr-1.7.0 httpd-2.4.18/srclib/apr
mv apr-util-1.6.1 httpd-2.4.18/srclib/apr-util
cd httpd-2.4.18

./configure –prefix=/usr/local/apache2.4.18 –enable-so –enable-deflate=shared –enable-ssl=shared –enable-expires=shared –enable-headers=shared –enable-rewrite=shared –enable-static-support –with-included-apr –with-mpm=event –enable-http2

make && make install

#添加启动脚本apache2到service

sudo cp /usr/local/apache2.4.18/bin/apachectl /etc/init.d/apache2

cd ..

#添加apache2到环境变量
sudo echo ‘export PATH=$PATH:/usr/local/apache2.4.18/bin’ > ./apache2.sh
sudo chmod a+x apache2.sh

# 拷贝脚本至目录
sudo cp apache2.sh /etc/profile.d

# 更新脚本状态
source /etc/profile.d/apache2.sh
#添加apache2到开机启动项
sudo nano /etc/rc.local

#将/etc/profile.d/apache2.sh添加到exit 0之前

/etc/profile.d/apache2.sh

exit 0

#启动apache2

sudo systemctl start apache2

不过因为编译安装的apache2设置文件集中放在httpd.conf,使用起来不是很方便,还要一堆设置,不推荐使用,重点是利用编译好的http2.so模块。

以上在linode编译成功,不同IDC可能稍有不同,请自行甄别。

3、直接使用上一步编译好的http2.so模块,推荐

sudo cp /usr/local/apache2.4.18/modules/mod_http2.so /usr/lib/apache2/modules/

然后为HTTP2模块编写一个配置文件:

sudo nano /etc/apache2/mods-available/http2.load

在其中写入以下:

LoadModule http2_module /usr/lib/apache2/modules/mod_http2.so

LogLevel http2:info

注意:

nghttp2还是要安装的,要不apache2重启会报错。同时不要忘记设置VirtualHost

<VirtualHost x.x.x.x:443>
Protocols h2 http/1.1


</VirtualHost>

最后启用HTTP2模块:

sudo service apache2 restart
sudo a2enmod http2

sudo service apache2 restart

大功告成。

4、参见

https://new.blog.cloudflare.com/tools-for-debugging-testing-and-using-http-2/

Let’s Encrypt推迟一年用他的CA根直接签发证书

Let’s Encrypt目前已经为超过1.5亿个网站签发了证书,每天发布数百万个证书,现在机房占用大约55个机架空间。自从Let’s Encrypt启动以来,浏览器通过来自另一个名为IdenTrust的证书颁发机构(DST ROOT)的交叉签名来信任Let’s Encrypt签发的证书。来自IdenTrust的交叉签名是必要的,因为Let’s Encrypt自己的根尚未得到广泛信任。

现在Let’s Encrypt自己的根ISRG Root X1已经被浏览器广泛信任,在2020年7月8日将直接使用自己的root,而不需要交叉签名。

behindgfw.com用的也是Let’s Encrypt,7月12日renew了一下,还是IdenTrust签发的。

 

ISRG根可以在这个测试站看到。

 

引申阅读:交叉签名

1、https://yq.aliyun.com/articles/703706

2、https://www.twblogs.net/a/5b88b7102b71775d1cddf921/zh-cn

试下vultr

试用下了下东京vultr节点,发现速度比linode有优势,可能后者口碑宣传、投放广告在国内用户多有关系。选用了$3.50/mo、1 CPU 512MB Memory、500GB Bandwidth这款,送ip4地址,有兴趣的可以试用,支持支付宝付款。预付了$10,可以使用3个月,搭个wp或者ocserv毫无压力,用ocserv看油管1080pHD可以达到800kBps。

如何在frp上实现pptp、l2tp?

现在电信公网IP地址越来越难搞到,因为局域网内部署了一台IIS webservser,通过frp实现了内网穿透,设置远程桌面也实现了,但是pptp和l2tp怎么也搞不定,没有办法了吗?

QQ租用了Amazon云?

一、服务器突然down了,以为折腾的将iptables整错,最后突然想到可能最近开会的缘故中招ip被墙。过了几天又莫名其妙ok了,可是已经把系统重做了一遍,顺便升到16.04。

重装了postfix,在做dmarc检查时候发现貌似腾讯QQ邮箱也租用了Amazon的服务器,如下。

QQ邮箱在海外部署服务器估计一是为了翻^墙,再者提供更快的速度优化路由。

<record>
<row>
<source_ip>54.204.34.130</source_ip>
<count>1</count>
<policy_evaluated>
<disposition>none</disposition>
<dkim>pass</dkim>
<spf>fail</spf>
</policy_evaluated>
</row>
<identifiers>
<header_from>behindgfw.com</header_from>
</identifiers>
<auth_results>
<dkim>
<domain>behindgfw.com</domain>
<result>pass</result>
<selector>201803</selector>
</dkim>
<spf>
<domain>qq.com</domain>
<result>pass</result>
</spf>
</auth_results>
</record>

您查询的 IP:54.204.34.130

所在地理位置:美国 Amazon

GeoIP: Ashburn, Virginia, United States

Amazon.com

2.但是怎么和Hurricane Electric扯上关系了?Hurricane Electric就是号称提供永远免费dns解析的he.net

<record>
<row>
<source_ip>184.105.206.29</source_ip>
<count>1</count>
<policy_evaluated>
<disposition>none</disposition>
<dkim>pass</dkim>
<spf>fail</spf>
</policy_evaluated>
</row>
<identifiers>
<header_from>behindgfw.com</header_from>
</identifiers>
<auth_results>
<dkim>
<domain>behindgfw.com</domain>
<result>pass</result>
<selector>201803</selector>
</dkim>
<spf>
<domain>qq.com</domain>
<result>pass</result>
</spf>
</auth_results>
</record>

您查询的 IP:184.105.206.29

所在地理位置:美国

GeoIP: Chico, California, United States

Hurricane Electric

超过14K的Let’s Encrypt加密SSL证书发给了PayPal钓鱼网站

在过去的2016年中,Let’s Encrypt共发出了15,270个域名或证书身份中包含“PayPal”的SSL证书,其中大约14,766(96.7%)是网络钓鱼网站。钓鱼网站滥用Let’s Encrypt的基础设施,Let’s Encrypt正在改名为“Let’s Phish”!

HTTPS意味着“加密的通信渠道”,而不一定是目的地网站是安全的。回到2015年,Let’s Encrypt在一篇博文中明确表示,它不打算成为互联网的HTTPS看门狗,您将paypal.com与playpal.com混淆的事实不是SSL加密的问题。

安全专家Eric Lawrence认为浏览器厂商也造成了一些责任:例如,Internet Explorer 不主动检查证书撤销,Chrome不关心网站上的内容或证书类型。如果站点已经以正确的方式安装了SSL证书,它将以绿色显示“安全”指示,无论其目的如何。

from:Slashdot