2015年1月22日 星期四

之前我的朋友因為支付寶退款的問題,需要打電話到中國,而Hangout之前有推出撥打電話的服務,就試著撥過去看看,沒想到通話似乎完全沒有延遲,費用還非常低廉。

以台灣為例,手機撥市話以每分鐘計算,Hangout是0.6元,中華4G是6元,雖然中華是以秒計費,但是只要講超過6秒,就比Hangout貴了。 XD


Google Hangout calling rates
https://www.google.com/voice/b/0/rates?hl=en&p=hangout

中華4G費率
http://www.emome.net/data_plan/4g_rate

2015年1月5日 星期一

Roundcube使用password plugin (chpasswd driver)的方式

基本上參考這一篇
http://www.roundcubeforum.net/index.php?topic=21861.0
之前實作的時候一直碰到密碼更改失敗的情況,看log也看不出所以然,只看到Unable to execute sudo。原來sudoers裡頭預設有"Defaults    requiretty"這個設定,php在執行chpasswd是沒有console的,所以無法執行,照這篇文章修改就行。
1) enable password function

vi /var/www/html/roundcube/config/config.inc.php

- alter the following line as follows:

$config['plugins'] = array('password');

cd /var/www/html/roundcube/plugins/password
cp config.inc.php.dist config.inc.php

2) enable the password plugin

cd /var/www/html/roundcube/plugins/password
cp config.inc.php.dist config.inc.php

vi config.inc.php

- alter the following as follows:

$config['password_driver'] = 'chpasswd';

3) allow apache to run the script

visudo

- add to bottom

Defaults:apache !requiretty
apache ALL=(root) NOPASSWD: /usr/sbin/chpass-wrapper.py

4) add blacklisted users and minimum UID below

vi /var/www/html/roundcube/plugins/password/helpers/chpass-wrapper.py

BLACKLIST = (
    # add blacklisted users here comma separated
    'root'
)

if user.pw_uid < 494:
    sys.exit('Changing the password for user id < 494 is forbidden')

5) copy the helper to executable directory & set make it executable
   
cp /var/www/html/roundcube/plugins/password/helpers/chpass-wrapper.py /usr/sbin
chmod 755 /usr/sbin/chpass-wrapper.py

6) alter the driver to run the helper which in turn runs the driver (wraps it)

vi /var/www/html/roundcube/plugins/password/config.inc.php

old:
$config['password_chpasswd_cmd'] = 'sudo /usr/sbin/chpasswd 2> /dev/null';
new:
$config['password_chpasswd_cmd'] = 'sudo /usr/sbin/chpass-wrapper.py 2> /dev/null';