2016/06/14

インターネットからの開発者サイトへのアクセスを禁止する - APEX

  • 状況
    インターネットからの開発者サイトへのアクセス時、ログイン画面が表示される。そのアクセスに対して、403エラーを返す。
    また、イントラ向けアプリとインターネット向けアプリが混在している場合、インターネットからのイントラ向けアプリへのアクセスに対して、403エラーを返す。

    以下の画面をインターネットから表示させない。
  • Solution
    mod_rewrite でコントロールする。

    (例) - APEX 4.2.x + OHS を想定
    開発者向け画面(アプリケーション番号は、四千番台:4xxx)と1で始まるアプリケーション番号(1xxx)へのインターネットからのアクセスを403リダイレクトする。

    1. HTTP 接続の場合 - httpd.conf ファイルに以下を追記する

    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^p=1 [OR]
    RewriteCond %{QUERY_STRING} ^p=4
    RewriteRule ^(.*) - [F]


    2. HTTPS接続の場合 - ssl.conf ファイルのvirtualhost内に上記を追記する。
       (注) mod_osslが利用できるようになっていることを確認する。

    ssl.conf のサンプル
    ###################################################################
    # Oracle HTTP Server mod_ossl configuration file: ssl.conf #
    ###################################################################
    # OHS Listen Port
    Listen 4443
    <IfModule ossl_module>
    ##
    ## SSL Global Context
    ##
    ## All SSL configuration in this context applies both to
    ## the main server and all SSL-enabled virtual hosts.
    ##
    #
    # Some MIME-types for downloading Certificates and CRLs
    AddType application/x-x509-ca-cert .crt
    AddType application/x-pkcs7-crl .crl
    # Pass Phrase Dialog:
    # Configure the pass phrase gathering process.
    # The filtering dialog program (`builtin' is a internal
    # terminal dialog) has to provide the pass phrase on stdout.
    SSLPassPhraseDialog builtin
    # Inter-Process Session Cache:
    # Configure the SSL Session Cache: First the mechanism
    # to use and second the expiring timeout (in seconds).
    SSLSessionCache "shmcb:${ORACLE_INSTANCE}/diagnostics/logs/${COMPONENT_TYPE}/${COMPONENT_NAME}/ssl_scache(512000)"
    SSLSessionCacheTimeout 300
    # Semaphore:
    # Configure the path to the mutual exclusion semaphore the
    # SSL engine uses internally for inter-process synchronization.
    <IfModule mpm_winnt_module>
    SSLMutex "none"
    </IfModule>
    <IfModule !mpm_winnt_module>
    SSLMutex pthread
    </IfModule>
    ##
    ## SSL Virtual Host Context
    ##
    <VirtualHost *:4443>
    <IfModule ossl_module>
    # SSL Engine Switch:
    # Enable/Disable SSL for this virtual host.
    SSLEngine on
    # Client Authentication (Type):
    # Client certificate verification type and depth. Types are
    # none, optional and require.
    SSLVerifyClient None
    # SSL Protocol Support:
    # List the supported protocols.
    SSLProtocol nzos_Version_1_0 nzos_Version_3_0
    # SSL Cipher Suite:
    # List the ciphers that the client is permitted to negotiate.
    SSLCipherSuite SSL_RSA_WITH_RC4_128_MD5,SSL_RSA_WITH_RC4_128_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_RSA_WITH_DES_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA
    # SSL Certificate Revocation List Check
    # Valid values are On and Off
    SSLCRLCheck Off
    #Path to the wallet
    #SSLWallet "${ORACLE_INSTANCE}/config/${COMPONENT_TYPE}/${COMPONENT_NAME}/keystores/default"
    SSLWallet file:/u01/app/oracle/product/ohs_apxd1/owm/wallets/oraapxd1
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory "${ORACLE_INSTANCE}/config/${COMPONENT_TYPE}/${COMPONENT_NAME}/cgi-bin">
    SSLOptions +StdEnvVars
    </Directory>
    BrowserMatch ".*MSIE.*" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
    </IfModule>
    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^p=1 [OR]
    RewriteCond %{QUERY_STRING} ^p=4
    RewriteRule ^(.*) - [F]
    </VirtualHost>
    </IfModule>

    変更後 のイメージ

0 件のコメント:

コメントを投稿