手把手教你用亚马逊云搭建免费VPN服务器

第一步 注册亚马逊云(已注册直接进入第二步)

  1. 开始前需要准备好:有外币支付功能的信用卡一张(注册需要,不扣钱)、Email地址、电话(手机更方便一些)
  2. 访问 http://aws.amazon.com/
  3. 点击Sign Up按钮进入Sign In or Create an AWS Account页面
  4. 填入E-mail地址
  5. 单击I’m a new user单选框
  6. 单击Sign in using our secure server按钮进入Login Credentials页面
  7. My name is后面填写你的英文名
  8. E-mail地址自动从上个页面获取了,在Type it again后面再填一遍
  9. Enter a new password设置一个新密码
  10. Type it again再次输入新密码
  11. 单击Continue进入Contact Information页面
  12. 填写带*的部分即可:Full name全名(英文名+空格+姓氏的拼音就可以,如:Richard Zhao)、Country国家(选择China)、Address Line 1地址(用英文填写地址,瞎编即可)、City城市、State, Province or Region州,省或者地区、ZIP or Postal Code邮编、Phone Number电话号码
  13. 在Security Check部分填入Image后面显示的文字
  14. 勾选Check here to indicate that you have read and agree to the terms of the Amazon Web Services Customer Agreement.
  15. 单击Create Account and Continue按钮进入Payment Method页面
  16. 在Credit Card处根据你的外币信用卡上的信息选择信用卡类别,如Visa、MasterCard等,一般在信用卡正面右下角
  17. Card Number填入信用卡号
  18. Cardholder’s Name填入持卡人姓名,一般在卡片正面左下的英文名或拼音
  19. Expiration Date填入信用卡的有效期限,一般在卡片正面英文名上方
  20. 单击Continue按钮进入Identity Verification页面
  21. 验证分3步,第1步选择国家为China(+86),单击Call Me Now按钮,等待电话呼入
  22. 第2步,接到电话后,用电话的号码键盘输入页面上的4位PIN码
  23. 第3步,验证成功后,单击Continue按钮进入Support Plan页面
  24. 确保选择的是Basic(Free),然后单击Continue按钮
  25. 注册成功

第二步 新建EC2 instance(相当于一台服务器)

  1. 单击Launch the AWS Management Console进入操作台(如果没有登陆则输入用户名与密码登陆)
  2. 单击My Account/Console下拉菜单下的AWS Management Console,或者单击这个链接https://console.aws.amazon.com/console/home
  3. 在Amazon Web Services下的Compute & Networking下单击EC2链接
  4. 在右上角的Help左侧有个下拉菜单,用于选择数据中心所在地,据说选Tokyo会快一些,没有仔细对比过,不知道是否有大的区别。
  5. 单击页面中的蓝色Launch Instance按钮
  6. 选择带有Free tier eligible的镜像文件,本操作步骤以Ubuntu Server 12.04.3 LTS – ami-acf9cde9 (64-bit) 为例,找到这个镜像后单击其右侧的Select按钮
  7. 在这里先不做太多配置上的更改,直接单击Review and Launch按钮
  8. 再次确认一下所选镜像标有Free tier eligible或者Instance Type为t1.micro,然后单击右下角Launch按钮,弹出Key Pair生成窗口
  9. 在第一个下拉菜单下选择Create a new key pair
  10. 在Key pair name下起一个名字,简单点的就可以,例如vpnserver
  11. 单击Download Key Pair下载Key Pair文件(如果使用了上例的名字,文件名则是vpnserver.pem),一定记住保存到哪里了,这个文件不能丢失,不然新建的Instance就无法使用SSH或者FTP等工具连接了
  12. 下载并保存好了之后单击Launch Instances按钮
  13. 稍等几秒后,会看到Your instance is now launching字样,单击View Instances按钮进入Instances管理界面
  14. 为了方便识别,可以在刚建立的Instance的Name处单击输入一个名字,如VPNServer,回车后确认
  15. 当VPNServer的Status Checks变为绿色的对勾时,EC2 instance的搭建就成功了

第三步 远程连接你的EC2 instance

  1. 单击左侧NETWORK & SECURITY下的Security Groups
  2. 单击名称为launch-wizard-1的Security Group
  3. 在下面单击Inbound标签
  4. 在Port range后面输入1723,单击Add Rule按钮,然后单击Apply Rule Changes按钮
  5. 单击左侧NETWORK & SECURITY下的Elastic IPs
  6. 单击Allocate New Address按钮,弹出确认提示框,单击Yes, Allocate按钮
  7. 右键单击新分配的IP地址,在弹出菜单中单击Associate Address
  8. 在弹出框的第一个下拉菜单上选择上一步新建的EC2 instance(名称末尾为VPNServer或你自己起的名字)
  9. 勾选最下面的Allow Reassociation选项
  10. 单击Associate按钮,这样就把这个IP地址跟你的”服务器“(EC2 instance)绑定了,以后连接的时候就要用这个IP地址
  11. 单击左侧Instances回到Instances管理界面
  12. 选中VPNServer这个Instance,单击上方的Connect按钮
  13. 有两种方式来远程连接你的Instance,SSH客户端或者浏览器的Java客户端,如果你的系统安装了Java可以直接用后者,很方便。这里我们以第一种方式为例
  14. 如果你使用的电脑是Windows系统,则需要下载一个客户端http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html,安装并打开,具体的操作不做详述
  15. 如果你使用的Mac系统或者Linux系统就不需要额外下载客户端,直接进入Terminal进行下面的操作即可
  16. 在Terminal或者SSH客户端中浏览到之前下载的Key Pair目录下(使用cd命令浏览,如果不会用可自行搜索一下相关教程)
  17. 修改Key Pair文件的权限:
    chmod 400 myvpnserver.pem
  18. 使用刚才页面里的命令远程连接Instance,类似于:
    ssh -i myvpnserver.pem [email protected]
  19. 第一次连接会出现一个提示,带有(yes/no)字样的,这里输入yes回车即可
  20. 几秒之后提示符停留在~$后面闪烁,连接成功

第四步 搭建VPN服务

  1. 在终端里输入命令
    sudo apt-get install pptpd

    回车运行

  2. 出现确认提示后输入Y回车
  3. 安装完成后出现Starting PPTP Daemon: pptpd.字样,提示符停留在~$后闪烁
  4. 输入并运行
    sudo vi /etc/pptpd.conf
  5. 按i键,左下角出现– INSERT –字样,使用键盘的方向键把光标移到最后一行的末尾,按回车另起一行
  6. 输入以下两行:
    localip 192.168.0.1remoteip 192.168.0.234-238,192.168.0.245
  7. 按键盘上的ESC键,左下角的– INSERT —字样消失
  8. 按住SHIFT键的同时按一下;键,光标跳转到左下角的:号后面
  9. 输入wq并回车
  10. 输入并运行
    sudo vi /etc/ppp/pptpd-options
  11. 同上,在最后增加两行:
    ms-dns 8.8.4.4ms-dns 8.8.8.8
  12. 按键盘上的ESC键,然后SHIFT+;,输入wq并回车
  13. 输入并运行
    echo "richard     pptpd     password     *" | sudo tee -a /etc/ppp/chap-secrets
  14. 上面的richard是你的VPN用户名,password是你的VPN密码,可以修改成你自己想要的然后记录好
  15. 输入并运行
    sudo /etc/init.d/pptpd restartsudo netstat -ntpl
  16. 如果显示带有如下显示内容则说明到目前为止一切正常
    tcp        0      0 0.0.0.0:1723            0.0.0.0:*               LISTEN      958/pptpd 
  17. 输入并运行
    sudo vi /etc/sysctl.conf
  18. 使用键盘的方向键把光标移动 #net.ipv4.ip_forward=1这一行,按i键,左下角出现– INSERT —字样
  19. 删除这一行开头的#,使这一行变为
    net.ipv4.ip_forward=1
  20. 同上,ESC,SHIFT + ;,输入wq并回车
  21. 输入并运行
    sudo apt-get install iptablessudo iptables -t nat -A POSTROUTING -j MASQUERADE
  22. 输入并运行
    sudo vi /etc/rc.local
  23. 同上,在”exit 0″前面增加一行:
    sudo iptables -t nat -A POSTROUTING -j MASQUERADE
  24. 同上,ESC,SHIFT + ;,输入wq并回车
  25. 输入并运行
    sudo iptables -I INPUT -p tcp --dport 1723 -j ACCEPTsudo sysctl -p
  26. 大功告成,你的VPN服务器已经搭好了,下一步建立VPN连接时你需要用到:
    服务器地址:你的Elastic IP地址
    用户名:richard(或者你自己使用的用户名)
    密码:password(或者你自己设置的密码)
  27. 如果要给你的小伙伴朋送个VPN账户,只需要按照第13到15步的操作,增加新的用户名与密码即可

第五步 连接VPN(使用上一步生成的服务器及账户信息建立VPN连接即可,在ios、android、windows、linux等系统里建立VPN连接的教程太多了,具体操作步骤自行搜索吧)

完成,接下来就可以享受自由的互联网了!

(注意,使用了Free tier的EC2的免费期是1年,1年后就会正常收费。另外,如果你的使用量太大,用超了也有可能会扣费的,所以要注意不要给自己周围的伙伴开太多账号哦)

中本聪(Satoshi Nakamoto)关于比特币的那篇论文

今天上午在BTCChina上比特币一度涨到了2600多,一个多月前抱着试试看的心态,充了2500块钱开始玩,那时候才六百多一个比特币,虽然有点遗憾当初没多买点,但是也要保持理性,上午在2500的时候卖出一个之后把2500块钱提现。用帐户余额继续玩。这样即使将来亏完了,于我实际也没有什么影响,我的2500反正已经收回来了。

听说比特币多半年的时间了,但还没真正专心钻研过,所以先把这个发明的源头找到,一点点学习。搜到了比特币的发明者中本聪(Satoshi Nakamoto)的那篇论文,要是能弄明白,有空闲的话我试试看能不能把这篇论文给翻译一下。

Bitcoin: A Peer-to-Peer Electronic Cash System

Satoshi Nakamoto
[email protected]
www.bitcoin.org
Abstract. A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution. Digital signatures provide part of the solution, but the main benefits are lost if a trusted third party is still required to prevent double-spending. We propose a solution to the double-spending problem using a peer-to-peer network. The network timestamps transactions by hashing them into an ongoing chain of hash-based proof-of-work, forming a record that cannot be changed without redoing the proof-of-work. The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power. As long as a majority of CPU power is controlled by nodes that are not cooperating to attack the network, they’ll generate the longest chain and outpace attackers. The network itself requires minimal structure. Messages are broadcast on a best effort basis, and nodes can leave and rejoin the network at will, accepting the longest proof-of-work chain as proof of what happened while they were gone.

1. Introduction

Commerce on the Internet has come to rely almost exclusively on financial institutions serving as trusted third parties to process electronic payments. While the system works well enough for most transactions, it still suffers from the inherent weaknesses of the trust based model. Completely non-reversible transactions are not really possible, since financial institutions cannot avoid mediating disputes. The cost of mediation increases transaction costs, limiting the minimum practical transaction size and cutting off the possibility for small casual transactions, and there is a broader cost in the loss of ability to make non-reversible payments for non- reversible services. With the possibility of reversal, the need for trust spreads. Merchants must be wary of their customers, hassling them for more information than they would otherwise need. A certain percentage of fraud is accepted as unavoidable. These costs and payment uncertainties can be avoided in person by using physical currency, but no mechanism exists to make payments over a communications channel without a trusted party.
What is needed is an electronic payment system based on cryptographic proof instead of trust, allowing any two willing parties to transact directly with each other without the need for a trusted third party. Transactions that are computationally impractical to reverse would protect sellers from fraud, and routine escrow mechanisms could easily be implemented to protect buyers. In this paper, we propose a solution to the double-spending problem using a peer-to-peer distributed timestamp server to generate computational proof of the chronological order of transactions. The system is secure as long as honest nodes collectively control more CPU power than any cooperating group of attacker nodes.

2. Transactions

We define an electronic coin as a chain of digital signatures. Each owner transfers the coin to the next by digitally signing a hash of the previous transaction and the public key of the next owner and adding these to the end of the coin. A payee can verify the signatures to verify the chain of ownership.
Transactions
The problem of course is the payee can’t verify that one of the owners did not double-spend the coin. A common solution is to introduce a trusted central authority, or mint, that checks every transaction for double spending. After each transaction, the coin must be returned to the mint to issue a new coin, and only coins issued directly from the mint are trusted not to be double-spent. The problem with this solution is that the fate of the entire money system depends on the company running the mint, with every transaction having to go through them, just like a bank.
We need a way for the payee to know that the previous owners did not sign any earlier transactions. For our purposes, the earliest transaction is the one that counts, so we don’t care about later attempts to double-spend. The only way to confirm the absence of a transaction is to be aware of all transactions. In the mint based model, the mint was aware of all transactions and decided which arrived first. To accomplish this without a trusted party, transactions must be publicly announced [1], and we need a system for participants to agree on a single history of the order in which they were received. The payee needs proof that at the time of each transaction, the majority of nodes agreed it was the first received.

3. Timestamp Server

The solution we propose begins with a timestamp server. A timestamp server works by taking a hash of a block of items to be timestamped and widely publishing the hash, such as in a newspaper or Usenet post [2-5]. The timestamp proves that the data must have existed at the time, obviously, in order to get into the hash. Each timestamp includes the previous timestamp in its hash, forming a chain, with each additional timestamp reinforcing the ones before it.
TimestampServer

4. Proof-of-Work

To implement a distributed timestamp server on a peer-to-peer basis, we will need to use a proof- of-work system similar to Adam Back’s Hashcash [6], rather than newspaper or Usenet posts. The proof-of-work involves scanning for a value that when hashed, such as with SHA-256, the hash begins with a number of zero bits. The average work required is exponential in the number of zero bits required and can be verified by executing a single hash.
For our timestamp network, we implement the proof-of-work by incrementing a nonce in the block until a value is found that gives the block’s hash the required zero bits. Once the CPU effort has been expended to make it satisfy the proof-of-work, the block cannot be changed without redoing the work. As later blocks are chained after it, the work to change the block would include redoing all the blocks after it.
Proof-of-work
The proof-of-work also solves the problem of determining representation in majority decision making. If the majority were based on one-IP-address-one-vote, it could be subverted by anyone able to allocate many IPs. Proof-of-work is essentially one-CPU-one-vote. The majority decision is represented by the longest chain, which has the greatest proof-of-work effort invested in it. If a majority of CPU power is controlled by honest nodes, the honest chain will grow the fastest and outpace any competing chains. To modify a past block, an attacker would have to redo the proof-of-work of the block and all blocks after it and then catch up with and surpass the work of the honest nodes. We will show later that the probability of a slower attacker catching up diminishes exponentially as subsequent blocks are added.
To compensate for increasing hardware speed and varying interest in running nodes over time, the proof-of-work difficulty is determined by a moving average targeting an average number of blocks per hour. If they’re generated too fast, the difficulty increases.

5. Network

The steps to run the network are as follows:

  1. New transactions are broadcast to all nodes.
  2. Each node collects new transactions into a block.
  3. Each node works on finding a difficult proof-of-work for its block.
  4. When a node finds a proof-of-work, it broadcasts the block to all nodes.
  5. Nodes accept the block only if all transactions in it are valid and not already spent.
  6. Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.

Nodes always consider the longest chain to be the correct one and will keep working on extending it. If two nodes broadcast different versions of the next block simultaneously, some nodes may receive one or the other first. In that case, they work on the first one they received, but save the other branch in case it becomes longer. The tie will be broken when the next proof- of-work is found and one branch becomes longer; the nodes that were working on the other branch will then switch to the longer one.
New transaction broadcasts do not necessarily need to reach all nodes. As long as they reach many nodes, they will get into a block before long. Block broadcasts are also tolerant of dropped messages. If a node does not receive a block, it will request it when it receives the next block and realizes it missed one.

6. Incentive

By convention, the first transaction in a block is a special transaction that starts a new coin owned by the creator of the block. This adds an incentive for nodes to support the network, and provides a way to initially distribute coins into circulation, since there is no central authority to issue them. The steady addition of a constant of amount of new coins is analogous to gold miners expending resources to add gold to circulation. In our case, it is CPU time and electricity that is expended.
The incentive can also be funded with transaction fees. If the output value of a transaction is less than its input value, the difference is a transaction fee that is added to the incentive value of the block containing the transaction. Once a predetermined number of coins have entered circulation, the incentive can transition entirely to transaction fees and be completely inflation free.
The incentive may help encourage nodes to stay honest. If a greedy attacker is able to assemble more CPU power than all the honest nodes, he would have to choose between using it to defraud people by stealing back his payments, or using it to generate new coins. He ought to find it more profitable to play by the rules, such rules that favour him with more new coins than everyone else combined, than to undermine the system and the validity of his own wealth.

7. Reclaiming Disk Space

Once the latest transaction in a coin is buried under enough blocks, the spent transactions before it can be discarded to save disk space. To facilitate this without breaking the block’s hash, transactions are hashed in a Merkle Tree [7][2][5], with only the root included in the block’s hash. Old blocks can then be compacted by stubbing off branches of the tree. The interior hashes do not need to be stored.
ReclaimingDiskSpace
A block header with no transactions would be about 80 bytes. If we suppose blocks are generated every 10 minutes, 80 bytes * 6 * 24 * 365 = 4.2MB per year. With computer systems typically selling with 2GB of RAM as of 2008, and Moore’s Law predicting current growth of 1.2GB per year, storage should not be a problem even if the block headers must be kept in memory.

8. Simplified Payment Verification

It is possible to verify payments without running a full network node. A user only needs to keep a copy of the block headers of the longest proof-of-work chain, which he can get by querying network nodes until he’s convinced he has the longest chain, and obtain the Merkle branch linking the transaction to the block it’s timestamped in. He can’t check the transaction for himself, but by linking it to a place in the chain, he can see that a network node has accepted it, and blocks added after it further confirm the network has accepted it.
SimplifiedPaymentVerification
As such, the verification is reliable as long as honest nodes control the network, but is more vulnerable if the network is overpowered by an attacker. While network nodes can verify transactions for themselves, the simplified method can be fooled by an attacker’s fabricated transactions for as long as the attacker can continue to overpower the network. One strategy to protect against this would be to accept alerts from network nodes when they detect an invalid block, prompting the user’s software to download the full block and alerted transactions to confirm the inconsistency. Businesses that receive frequent payments will probably still want to run their own nodes for more independent security and quicker verification.

9. Combining and Splitting Value

Although it would be possible to handle coins individually, it would be unwieldy to make a separate transaction for every cent in a transfer. To allow value to be split and combined, transactions contain multiple inputs and outputs. Normally there will be either a single input from a larger previous transaction or multiple inputs combining smaller amounts, and at most two outputs: one for the payment, and one returning the change, if any, back to the sender.
CombiningAndSplittingValue
It should be noted that fan-out, where a transaction depends on several transactions, and those transactions depend on many more, is not a problem here. There is never the need to extract a complete standalone copy of a transaction’s history.

10. Privacy

The traditional banking model achieves a level of privacy by limiting access to information to the parties involved and the trusted third party. The necessity to announce all transactions publicly precludes this method, but privacy can still be maintained by breaking the flow of information in another place: by keeping public keys anonymous. The public can see that someone is sending an amount to someone else, but without information linking the transaction to anyone. This is similar to the level of information released by stock exchanges, where the time and size of individual trades, the “tape”, is made public, but without telling who the parties were.
Privacy
As an additional firewall, a new key pair should be used for each transaction to keep them from being linked to a common owner. Some linking is still unavoidable with multi-input transactions, which necessarily reveal that their inputs were owned by the same owner. The risk is that if the owner of a key is revealed, linking could reveal other transactions that belonged to the same owner.

11. Calculations

We consider the scenario of an attacker trying to generate an alternate chain faster than the honest chain. Even if this is accomplished, it does not throw the system open to arbitrary changes, such as creating value out of thin air or taking money that never belonged to the attacker. Nodes are not going to accept an invalid transaction as payment, and honest nodes will never accept a block containing them. An attacker can only try to change one of his own transactions to take back money he recently spent.
The race between the honest chain and an attacker chain can be characterized as a Binomial Random Walk. The success event is the honest chain being extended by one block, increasing its lead by +1, and the failure event is the attacker’s chain being extended by one block, reducing the gap by -1.
The probability of an attacker catching up from a given deficit is analogous to a Gambler’s Ruin problem. Suppose a gambler with unlimited credit starts at a deficit and plays potentially an infinite number of trials to try to reach breakeven. We can calculate the probability he ever reaches breakeven, or that an attacker ever catches up with the honest chain, as follows [8]:
p = probability an honest node finds the next block
q = probability the attacker finds the next block
qz = probability the attacker will ever catch up from z blocks behind
Calculations1
Given our assumption that p > q, the probability drops exponentially as the number of blocks the attacker has to catch up with increases. With the odds against him, if he doesn’t make a lucky lunge forward early on, his chances become vanishingly small as he falls further behind.
We now consider how long the recipient of a new transaction needs to wait before being sufficiently certain the sender can’t change the transaction. We assume the sender is an attacker who wants to make the recipient believe he paid him for a while, then switch it to pay back to himself after some time has passed. The receiver will be alerted when that happens, but the sender hopes it will be too late.
The receiver generates a new key pair and gives the public key to the sender shortly before signing. This prevents the sender from preparing a chain of blocks ahead of time by working on it continuously until he is lucky enough to get far enough ahead, then executing the transaction at that moment. Once the transaction is sent, the dishonest sender starts working in secret on a parallel chain containing an alternate version of his transaction.
The recipient waits until the transaction has been added to a block and z blocks have been linked after it. He doesn’t know the exact amount of progress the attacker has made, but assuming the honest blocks took the average expected time per block, the attacker’s potential progress will be a Poisson distribution with expected value:
Calculations2
To get the probability the attacker could still catch up now, we multiply the Poisson density for each amount of progress he could have made by the probability he could catch up from that point:
Calculations3
Rearranging to avoid summing the infinite tail of the distribution…
Calculations4
Converting to C code…

#include <math.h>   double AttackerSuccessProbability(double q, int z)   {
       double p = 1.0 - q;       double lambda = z * (q / p);       double sum = 1.0;       int i, k;       for (k = 0; k <= z; k++)       {
           double poisson = exp(-lambda);           for (i = 1; i <= k; i++)
poisson *= lambda / i;           sum -= poisson * (1 - pow(q / p, z - k));
       }
       return sum;
   }

Running some results, we can see the probability drop off exponentially with z.

   q=0.1   z=0    P=1.0000000   z=1    P=0.2045873   z=2    P=0.0509779   z=3    P=0.0131722   z=4    P=0.0034552   z=5    P=0.0009137   z=6    P=0.0002428   z=7    P=0.0000647   z=8    P=0.0000173   z=9    P=0.0000046   z=10   P=0.0000012
   q=0.3   z=0    P=1.0000000   z=5    P=0.1773523   z=10   P=0.0416605   z=15   P=0.0101008   z=20   P=0.0024804   z=25   P=0.0006132   z=30   P=0.0001522   z=35   P=0.0000379   z=40   P=0.0000095   z=45   P=0.0000024   z=50   P=0.0000006
Solving for P less than 0.1%…

   P < 0.001   q=0.10   z=5   q=0.15   z=8   q=0.20   z=11   q=0.25   z=15   q=0.30   z=24   q=0.35   z=41   q=0.40   z=89   q=0.45   z=340
12. Conclusion

We have proposed a system for electronic transactions without relying on trust. We started with the usual framework of coins made from digital signatures, which provides strong control of ownership, but is incomplete without a way to prevent double-spending. To solve this, we proposed a peer-to-peer network using proof-of-work to record a public history of transactions that quickly becomes computationally impractical for an attacker to change if honest nodes control a majority of CPU power. The network is robust in its unstructured simplicity. Nodes work all at once with little coordination. They do not need to be identified, since messages are not routed to any particular place and only need to be delivered on a best effort basis. Nodes can leave and rejoin the network at will, accepting the proof-of-work chain as proof of what happened while they were gone. They vote with their CPU power, expressing their acceptance of valid blocks by working on extending them and rejecting invalid blocks by refusing to work on them. Any needed rules and incentives can be enforced with this consensus mechanism.
References
[1] W. Dai, “b-money,” http://www.weidai.com/bmoney.txt, 1998.
[2] H. Massias, X.S. Avila, and J.-J. Quisquater, “Design of a secure timestamping service with minimal trust requirements,” In 20th Symposium on Information Theory in the Benelux, May 1999.
[3] S. Haber, W.S. Stornetta, “How to time-stamp a digital document,” In Journal of Cryptology, vol 3, no 2, pages 99-111, 1991.
[4] D. Bayer, S. Haber, W.S. Stornetta, “Improving the efficiency and reliability of digital time-stamping,” In Sequences II: Methods in Communication, Security and Computer Science, pages 329-334, 1993.
[5] S. Haber, W.S. Stornetta, “Secure names for bit-strings,” In Proceedings of the 4th ACM Conference on Computer and Communications Security, pages 28-35, April 1997.
[6] A. Back, “Hashcash – a denial of service counter-measure,” http://www.hashcash.org/papers/hashcash.pdf, 2002.
[7] R.C. Merkle, “Protocols for public key cryptosystems,” In Proc. 1980 Symposium on Security and Privacy, IEEE Computer Society, pages 122-133, April 1980.
[8] W. Feller, “An introduction to probability theory and its applications,” 1957.

BigBlueButton录像文件太多,Ubuntu Server硬盘不够怎么办?

使用BigBlueButton时开启了录制功能,时间一久就发现空间不够用了,于是先用最基本的操作,删掉已外理过的录音文件来清理出空间:

1. 清理Log
  sudo bbb-conf –clean
2.  删除旧的录像、文档、
   /etc/cron.daily/bigbluebutton
删除 `exit 0` 行来启用自动清理
清理项有:
find /var/bigbluebutton -maxdepth 1 -type d -name “*-*” -mtime +11 -exec rm -r ‘{}’ \;
find /usr/share/red5/webapps/video/streams -name “*.flv” -mtime +1 -exec rm ‘{}’ \;
find /var/bigbluebutton/deskshare -name “*.flv” -mtime +1 -exec rm ‘{}’ \;
find /var/freeswitch/meetings -name “*.wav” -mtime +1 -exec rm ‘{}’ \;
3.  删除已处理过的wav文件
sudo find /var/bigbluebutton/recording/process -name “*.wav” -exec rm ‘{}’ \;
这样做了之后能撑一段时间,可是时间久了又不够了,第一个念头就是加一块硬盘,然后把BigBlueButton默认的录像存放路径修改到新的硬盘上。
由于BigBlueButton本身没有提供修改录像文件路径的命令,于是我把BigBlueButton录制、处理、存储、回放的整个过程都详细研究了一遍,把这个过程中我认为所有涉及到路径的代码都给改了,可是最终还是不成功,实在找不出问题出在哪里,只能放弃了这个方案。不过可以把这个过程先记录下来,以做参考,想看较为可行的方案的可以跳过这部分:

录像与回放功能目录结构

/usr/local/bigbluebutton/└── core    ├── Gemfile    ├── Gemfile.lock    ├── lib    │   ├── recordandplayback    │   │   ├── audio_archiver.rb    │   │   ├── deskshare_archiver.rb    │   │   ├── events_archiver.rb    │   │   ├── generators    │   │   │   ├── audio_processor.rb    │   │   │   ├── audio.rb    │   │   │   ├── events.rb    │   │   │   ├── matterhorn_processor.rb    │   │   │   ├── presentation.rb    │   │   │   └── video.rb    │   │   ├── presentation_archiver.rb    │   │   └── video_archiver.rb    │   └── recordandplayback.rb    └── scripts        ├── archive        │   └── archive.rb        ├── bbb-rap.sh        ├── bigbluebutton.yml        ├── cleanup.rb        ├── process        │   ├── README        │   └── slides.rb        ├── publish        │   ├── README        │   └── slides.rb        ├── rap-worker.rb        └── slides.yml

最终录像回放存放目录

  • /var/bigbluebutton/published/slides/<meeting-id> 
修改录像与回放目录:
把原有的录像路径下所有文件与目录拷到目标路径,如/mnt下
sudo cp -a /var/bigbluebutton /mnt/
则新的录像与回放目录为:/mnt/bigbluebutton

sudo vi /usr/local/bigbluebutton/core/scripts/slides.yml

修改其中的publish_dir
sudo vi /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml
修改其中的recording_dir published_dir raw_deskshare_src raw_presentation_src
sudo vi /usr/local/bigbluebutton/core/scripts/cleanup.rb
修改其中的PUBLISHED_DIR UNPUBLISHED_DIR RECORDING_DIR
sudo vi /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties
修改其中的presentationDir BLANK_SLIDE BLANK_THUMBNAIL recordStatusDir publishedDir unpublishedDir
使用下面这条命令前先把地址修改为想要修改的地址,以便网络用户有权限访问该位置的内容
sudo chown -R tomcat6:tomcat6 /mnt/bigbluebutton/playback/
sudo vi /etc/bigbluebutton/nginx/slides.nginx
修改其中的地址
sudo chown tomcat6 /mnt/bigbluebutton
修改目录所有者
sudo bbb-conf –clean
折腾了半天,结果还是无法正常录像,重启服务器也没用,只能换个思路了。左思右想,想出了这么一个办法:
  1. 把 /var/bigbluebutton目录内的文件移动到别处
  2. 新增一块硬盘挂载到/var/bigbluebutton目录
  3. 用ls -ld /var/bigbluebutton查看一下目录权限,所有者是否为tomcat6
  4. 如果不是则修改为tomcat6
  5. 把移到别处的文件拷回/var/bigbluebutton下
  6. 在sudo vi /etc/fstab中新建条目以便每次重启时自动加载

附上挂新硬盘的方法:

查看移动硬盘
sudo fdisk -l
挂载
sudo mount -t ext4 /dev/sdb1 /var/bigbluebutton
注:如果是fat32格式的则用-t vfat参数,如果是ext3格式的则用-t ext3参数,/dev/sdb1改为你要挂载的硬盘的实际名称
设置重启后自动挂载
sudo vi /etc/fstab
在该文件中添加:
/dev/sdb1        /var/bigbluebutton       ext4    defaults        0       0

由于BigBlueButton当前版本对于录像的存储、发布等功能还是非常不完善,只能先这样处理了。

当硬盘再次满了的时候还会面临新的问题。再加一块的话要么加一块更大的硬盘,把原有的录像文件复制到新的硬盘上;要么就制定一个规则,把超过一定时间的录像文件删掉,腾出新的空间来用。

SOA参考资料

AgileEAS.NET SOA 中间件/敏捷软件开发平台

软件开发平台是企业信息化最佳模式?
企业管理软件平台架构内幕揭秘

http://blog.csdn.net/david_lv/article/details/2277084
基于SOA体系结构的未来软件开发方法

开源软件SOA解决方案对企业的三大好处
SOA国家标准将于2013年6月1日起正式实施
中间件因云、移动而改变
企业SOA平台 JBoss SOA
eBay开源软件站发布SOA平台:Turmeric项目
揭示企业部署SOA六个阶段的过程发展
Hinchcliffe首席技术官:开源软件是SOA的未来吗?
“开源”SOA正在改写IT规划方程式
ig_soa_before

四千多条短信啊,总算从iPhone成功转移到i9108了!

你是不是也弄不清楚G3与3G?你是不是也不知道移动的3G如何办理?你是不是也不知道3G、G3、GPRS的区别?你是不是也不知道iPhone里如何备份短信到网络上(云端)?你是不是也……?这些问题我都产生过,下面就分享一下我的探索过程吧:

2008年初买的iPhone一直用到现在。从一拿出来人们就投来好奇的眼光,直到现在拿出来人们都不认识,说你这是山寨的吧。最终下定决心了,要换个新手机。iPhone 4S呢不太想买,有点期望iPhone 5,但iPhone 5还不知道什么时候才会有呢。另外在现在智能手机的大潮中,另外半壁江山我不能一无所知啊,得用个Android的手机才行。我可不是果粉,非要追着苹果才行。于是周六晚上三星Galaxy S II(i9108)到手上了。折腾了两天,目前感受是硬件比iPhone好,系统比iPhone差远了(主要指用户友好方面)。这里主要记录期间的两大事件吧。

第一是搞清楚了一个很小白的问题。我一直没弄清楚3G与GPRS的关系。网上搜也没有太多这方面的问题。有网友问了之后甚至被很多人嘲笑。上移动的网站看(我的号是移动的),竟然也没有这些基础知识的资料。我从最早使用手机开始就一直觉得移动的网站太垃圾,几乎都不上。这么多年过去了,移动的网站依旧是风采不减。
上了移动的网站后,我更晕了,出现了另一个词“G3”。我的直觉告诉我这就是移动的3G了。然后看到有广告语说是不用换卡也不用换号,就可以使用移动的G3。于是我就试了一下,用我的S2直接上网,果然没问题,并且速度很快。原来不用设置什么啊!
但又一个问题浮现在我的脑海里了,费用怎么算啊,我可没办理G3业务啊,我可不想跟当年刚使用iPhone时那样,没有办理GPRS套餐,结果一两天就把几百块钱用没了。又上移动的网站打算办G3的套餐,结果怎么都找不到,也没有说明。再次感叹,移动的网站真垃圾,我就不相信像我这样想的人全世界就我一个!
最后,把移动的网站翻烂了都没找到办G3的地方。无可奈何,打10086问吧。话务小姐的一句话立马让我顿悟了:“3G与GPRS的区别就是一个快一个慢,用的都是GPRS的套餐。”唉,我真无语了,你把这句话放在你的网站上能费多大劲啊?我觉着吧,这些其实应该算中国移动的产品优势啊,从2G到3G,什么都不用做,换个3G的手机就可以了,如果以前上过网,连套餐都不用重新申请,多好啊。结果让我没念它的好。还搞个“G3”出来把搞晕客户更上了一层楼。

第二就是通讯录、邮箱、日历、短信的转移。前三样都很简单了,用Google的帐户在Exchange里设置同步就可以了。设置方法呢参考这里:Setting up Google Sync with your iOS device
短信的事情又颇费了一些周折。找了好多工具都是只能备份与恢复通讯录的。QQ同步助手可以导出通讯录、短信、通话记录到网络上,然后又能在别的设备里进行恢复。
先在S2上面装的,原以为没什么问题了。结果在iPhone里安装了之后发现只能同步通讯录。安装的时候明明看到说明里是能同步短信的啊。搜了一下原来Apple不允许应用程序进行这样的操作。虽然表示理解吧,但我iPhone里有四千多条短信可怎么办啊?
试过了找别的软件,都没有这个功能。
最后终于找到了一个方法,还是用QQ同步助手,但不是通过App Store安装。这个方法适用于越狱与破解了的iPhone:

1. 在Cydia里添加源:http://www.qcydia.com
2. 完成之后再找到并安装QQ同步助手

装完后一看界面,心里咯噔一下,因为跟之前看着一样,只有同步通讯录的按钮。幸好没马上退出,用手往左一划,同步短信的界面出来了。这时仔细看才发现原来有两个小点在下面,这个应用有两页。真险。设置好帐号登录后先备份,然后在S2里选择恢复。恢复完成后打开短信,没反应了,重启一下手机,终于成功了,四千多条短信成功转移到我的新手机上了!
不过这个版本的没有同步通话记录的,想了想这个无所谓了。不管了。

59259567