Categories
07/01/2015
WordPress Permalinks on LEMP
By dch1 in Life No Comments Tags: LEMP, Linode, Nginx, VPS
最近一个工程项目涉及到网站搬迁,从虚拟主机搬到VPS上,当然使用的是我最喜爱的LEMP精简方案(LAMP太吃内存,多占的内存都可以够我装一个主机控制面板了),虽然LEMP功能实用稳定,美中不足便是设置极为繁琐(想完美不容易)。
这不,主机假设轻车熟路,解决了一系列的小问题,网站上线之后发现伪静态协议失效,只有主页能够显示。
首先,想到了可以更新网站静态链接格式(变成类似本网站的?p=xxx的格式),但这属于避开问题,而且会影响收录,所以放弃。
之后就开始想办法手动解决伪静态的问题,终于在一个网站找到一篇非常详细的设置文章,经过实际测试成功!
下面只粘贴认为最核心的代码,phpmyadmin之类的设置可以参考以前的文章。
server {
listen 80;
server_name www.bjdch.org bjdch.org;
access_log /srv/www/bjdch.org/logs/access.log;
error_log /srv/www/bjdch.org/logs/error.log;
root /srv/www/bjdch.org/public_html;
index index.html index.htm index.php;#PHP Settings
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
if ($uri !~ “^/uploads/”) {
fastcgi_pass 127.0.0.1:9000;
}
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/bjdch.org/public_html$fastcgi_script_name;
}location / {
# Deny access to any files with a .php extension in the uploads directory
# Works in sub-directory installs and also in multisite network
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}# Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS!
location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_
{
return 444;
}
#nocgi
location ~* \.(pl|cgi|py|sh|lua)\$ {
return 444;
}
#disallow
location ~* (roundcube|webdav|smtp|http\:|soap|w00tw00t) {
return 444;
}location ~ /(\.|wp-config.php|readme.html|license.txt) { deny all; }
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;try_files $uri $uri/ /index.php?q=$request_uri;
}#Error outputs:
error_page 400 /400.shtml;
error_page 401 /401.shtml;
error_page 403 /403.shtml;
error_page 404 /404.shtml;
error_page 500 502 503 504 /500.shtml;}
Thanks: http://centminmod.com/nginx_configure_wordpress.html
11/01/2015
Cisco PIX-515 PIX-515E Unrestricted (UR) License Keygen Algorithm
By dch1 in Just Notes, Life No Comments Tags: ASA, CCNA, Cisco, PIX
=====WARNING: This article is for Academic purposes ONLY and not with intention to make profits or resell.=====
As an engineer myself, I am always curious about how the things work. I could even remember when I was in high school, I used my pocket money to buy a book titled Applied Cryptography, of course it is a Chinese version. I was amazed by the encryption algorithm, such as MD5, RSA, SHA, etc. I bought a DLL plug-in to make my home-brewed software have registration functionality. (I should have studied IT security, shouldn’t I?)
Time flies, I choose Mechanical Engineering to be my major in University but it did not change my ambitious as well as my field of interest. I remembered the first few days I bought my Arduino kit, I was trying to dig some interesting protocols for encryptions using that microcontroller. Well, it’s a 8-bit MCU so it is not likely possible to implement strong algorithms like RSA and MD5. I found someone making CRC32 and SHA on that platform but it will take a few seconds to get the work done.
Anyway, I am talking too much about the past so let’s get into this topic.
Just a couple of days ago, I was given 3 Cisco PIX-515E firewall with Unrestricted (UR) License. To be honest, I had really no idea with these firewalls and only know about the Cisco ISR series during that time (Yes, I am studying CCNA at the moment and the PIX firewalls are unwanted free gift from one eBay seller.). Soon after, I found the ASA could be a very useful equipment in networking as they are capable of doing not only the fire fighters job, but also be NAT/PAT tasks.
I watched a youtube video and the instructor tried to use valid Serial Number and Activation Keys to activate the “virtual” PIX-515E in GNS3 software. As a result, I was getting much more interested in the activation key algorithms than ever! I had a brief look on the eBay.com.au, there were couple of sellers who were selling UR Licenses at a premium price and it looked like a must have (handy) bundle for CCNP students.
I was accidentally got an article on one Russia website, and one of the ‘hacker’ revealed the software algorithm for the UR license key so I would like to write an English version to make it clearer.
======Please ignore above paragraphs if you are above the CCNA level :-).======
I need to grab a working SN and Key to verify the process is all working. So I grabbed a victim on eBay:
Firstly, we need to convert the Serial Number from DEC to HEX. Just use the calculator to conduct the conversion.
DEC(809112952)=HEX(0x 30 3A 15 78)
Secondly, we need to make the inversion of the digits.
30 3A 15 78 => 78 15 3A 30 => 78153A30
Refer to the original discussion, we need to put inverted value of the license type mark (AES+DES+UR = 0x00000039) to the beginning of the SN we have just converted.
“39000000” + “78153A30” = 3900000078153A30
Then we needs a MD5 conversion using a perl syntax:
If you are running or having a Mac or Linux based O/S, just using the following command:
If you cannot have access to the Linux or Unix based PC, you can use online compiler, such as: http://www.tutorialspoint.com/execute_perl_online.php. You need to remember that the command will be slightly different:
You will get the following result:
Last step, we need to separate the result to 4 groups (shown above), and make the inversion AGAIN to get the final result! You’ll get the same result with our victim’s answer:
Not that bad!