ページへ戻る

− Links

 印刷 

XOOPS サイトの IPv6 対応の私的メモ :: XOOPS マニア

UsersWiki:nao-pon/blog/2017-02-14


RSS of nao-pon/blog[5]
2017 2月 14 (火)
 
ページ内コンテンツ
  • XOOPS サイトの IPv6 対応の私的メモ
    • 施した対策
    • ToDo
    • 詳細メモ
      • class/protector.php ip_match()

XOOPS[6] サイトの IPv6 対応の私的メモ anchor.png[7]

Tag: IPv6[8] XOOPS[9] Webサーバー[10]

hypweb.net の Web サーバーを IPv6 対応しました。
IPv6 でアクセスすると左上に IPv6 の文字が表示されます。

hypweb_IPv6.png

しかし、XOOPS[6] 固有の問題がありちょこちょこ修正しています。

このページはその私的メモで、随時更新していきます。

Page Top

施した対策 anchor.png[11]

  • online テーブルの online_ip カラムの文字数拡張(39文字)
  • protector モジュールの class/protector.php ip_match() の IPv6 対応(後述)
  • protector モジュールの一般設定 信頼できる IP に ^::1$ と ^fe80:: を追加
  • protector モジュールの管理画面の BadIP のリストアップとその保存処理で、有効時間とIPのセパレーターを ":" から "-" に変更(trust/modules/protector/admin/index.php)
  • d3forum の posts テーブルの poster_ip, modifier_ip カラムの文字数拡張(39文字)
  • xpWiki[12] モジュールの counter, tb テーブルの ip カラムの文字数拡張(モジュールアップデートスクリプトにて対応完了)
Page Top

ToDo anchor.png[13]

  • protector の BadIP の登録で IPv6 のプレフィクス長を管理画面で指定できるようにする。
Page Top

詳細メモ anchor.png[14]

Page Top

class/protector.php ip_match() anchor.png[15]

366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
function ip_match( $ips )
{
    foreach( $ips as $ip => $info ) {
        if( $ip ) {
            $ip = strtolower($ip);
            switch( substr( $ip , -1 ) ) {
                case '.' :
                case ':' :
                    // foward match
                    if( substr( @$_SERVER['REMOTE_ADDR'] , 0 , strlen( $ip ) ) == $ip ) {
                        $this->ip_matched_info = $info ;
                        return true ;
                    }
                    break ;
                case '0' :
                case '1' :
                case '2' :
                case '3' :
                case '4' :
                case '5' :
                case '6' :
                case '7' :
                case '8' :
                case '9' :
                case 'a' :
                case 'b' :
                case 'c' :
                case 'd' :
                case 'e' :
                case 'f' :
                    // full match
                    if( @$_SERVER['REMOTE_ADDR'] == $ip ) {
                        $this->ip_matched_info = $info ;
                        return true ;
                    }
                    break ;
                default :
                    // perl regex
                    if( @preg_match( $ip , @$_SERVER['REMOTE_ADDR'] ) ) {
                        $this->ip_matched_info = $info ;
                        return true ;
                    }
                    break ;
            }
        }
    }
    $this->ip_matched_info = null ;
    return false ;
}


Last-modified: 2017-02-14 (火) 21:57:55 (JST) (2621d) by nao-pon