コードブロックのエラー: 403 Forbidden

ディスコースサーバーの管理を引き継いだばかりですが、いくつか問題があります。

  1. コードブロックを含む投稿の作成または編集を試みると、常に問題が発生します。コードブロックを含む投稿の作成または編集を試みると、
(access node)$ spack list openfoam@2306
...
Variants:
    Name [Default]            When    Allowed values    Description
    ======================    ====    ==============    ==================================================

    build_system [generic]    --      generic           Build systems supported by the package
    int64 [off]               --      on, off           With 64-bit labels
    kahip [off]               --      on, off           With kahip decomposition
    knl [off]                 --      on, off           Use KNL compiler settings
    metis [off]               --      on, off           With metis decomposition
    mgridgen [off]            --      on, off           With mgridgen support
    paraview [off]            --      on, off           Build paraview plugins and runtime post-processing
    precision [dp]            --      sp, dp, spdp      Precision option
    scotch [on]               --      on, off           With scotch/ptscotch decomposition
    source [on]               --      on, off           Install library/application sources and tutorials
    vtk [off]                 --      on, off           With VTK runTimePostProcessing
    zoltan [off]              --      on, off           With zoltan renumbering
...

403 Forbidden というエラーが発生します。

  1. Markdown はコードハイライトをサポートしておらず、構文指定を追加すると 403 Forbidden エラーが発生します。

  2. インラインコードセグメントも、他のコードブロックとの相対位置によっては、一部の場所で 403 Forbidden を引き起こします。

インストールされているバージョンは 3.1.1 ( 0612f0d5b6 ) です。

これらの問題は関連していますか、また、この動作の原因は何でしょうか?

投稿例: Compiling OpenFOAM with Spack - 📚 Knowledge nuggets - HPC discourse

意図した結果:

Spack を使用した OpenFOAM (OpenCFD) のインストールには、いくつかの問題があります。

UL HPC のチュートリアルに従って Spack でパッケージを管理するために環境が設定されました。簡単に言うと、SPACK パッケージの以下の依存関係が定義されました。

(access node)$ cat << EOF > $SPACK_ROOT/etc/spack/packages.yaml
packages:
    slurm:
        externals:
        - spec: slurm@22.05.5
          prefix: /usr
        buildable: False
    libevent:
        externals:
        - spec: libevent@2.1.8
          prefix: /usr
        buildable: False
    pmix:
        externals:
        - spec: pmix@4.2.3
          prefix: /usr
        buildable: False
    hwloc:
        externals:
        - spec: hwloc@2.2.0
          prefix: /usr
        buildable: False
EOF

また、ビルドキャッシュディレクトリの以下のオプションが定義され、

(access)$ cat << EOF > $SPACK_ROOT/etc/spack/config.yaml
config:
    build_stage:
        - /dev/shm/$user/spack-stage
EOF

RAM ディスクファイルシステムを使用してコンパイルを高速化しました。OpenFOAM のインストールに進む前に、システムコンパイラを使用して目的のバージョンの Open MPI がインストールされます。

(compute node)$ spack install -j openmpi@4.0.5 +pmi schedulers=slurm ^pmix@4.2.3 ^hwloc@2.2.0

OpenFOAM のディストリビューションもシステムコンパイラを使用してインストールされます。利用可能な OpenFOAM のコンポーネントは次のとおりです。

(access node)$ spack list openfoam@2306
...
Variants:
    Name [Default]            When    Allowed values    Description
    ======================    ====    ==============    ==================================================

    build_system [generic]    --      generic           Build systems supported by the package
    int64 [off]               --      on, off           With 64-bit labels
    kahip [off]               --      on, off           With kahip decomposition
    knl [off]                 --      on, off           Use KNL compiler settings
    metis [off]               --      on, off           With metis decomposition
    mgridgen [off]            --      on, off           With mgridgen support
    paraview [off]            --      on, off           Build paraview plugins and runtime post-processing
    precision [dp]            --      sp, dp, spdp      Precision option
    scotch [on]               --      on, off           With scotch/ptscotch decomposition
    source [on]               --      on, off           Install library/application sources and tutorials
    vtk [off]                 --      on, off           With VTK runTimePostProcessing
    zoltan [off]              --      on, off           With zoltan renumbering
...

OpenFOAM は、利用可能なすべてのパーティショナー (metisscotchzoltankahip) およびマルチグリッドジェネレータコンポーネント (ドキュメントのセクション 6.3.1.4) を使用してインストールされます。

(compute node)$ spack install -j openfoam@2306 +source precision=dp +metis +scotch +zoltan +kahip +mgridgen ~knl ~int64 ~paraview ^openmpi@4.0.5

しかし、結果のインストールでは複数のコンポーネントが欠落しています。たとえば、doc/Build.md で手動のインストール後検証を実行すると、

# Create the user "run" directory:
mkdir -p "$FOAM_RUN"
# Change to the user "run" directory:
run
# Copy tutorial
cp -r "$FOAM_TUTORIALS"/incompressible/simpleFoam/pitzDaily ./
# Run the tutorial
( cd pitzDaily && blockMesh && simpleFoam )

メッシュジェネレータ blockMesh とソルバー simpleFoam の両方が欠落しています。

METIS パーティショナーが複数のコンポーネントのインストールに失敗することが判明しました。SCOTCH パーティショナーのみで再コンパイルすると、

(compute node)$ spack install openfoam@2306 +source +scotch +mgridgen precision=dp ~int64 ~kahip ~knl ~metis ~paraview ~vtk ~zoltan ^openmpi@4.0.5

問題は解決します。すべてのソルバーコンポーネントがインストールされますが、いくつかのユーティリティはまだ欠落しています。

欠落しているすべてのコンポーネントを検出するために、次のスクリプトを使用します。

(access node)$ cat list_spack_openfoam
#!/usr/bin/bash

set -euo pipefail

declare variant="${1}" # e.g. @2306%gcc@8.5.0 @2306+mgridgen
declare type="${2}" # solvers, utilities

find_makefile_directories() {
    local directory="${1}"

    find "${directory}" -type d | grep -E '\/Make$' || true
}

extract_executable_name() {
    local makefile_directory="${1}"

    cat "${makefile_directory}/files" | ( grep -E '^EXE[[:space:]]*=' || true ) | sed 's/^EXE[[:space:]]*=[[:space:]]*\$(FOAM_APPBIN)\///g'
}

main() {
    local variant="${1}"
    local type="${2}"

    local foam_location="$(spack location -i openfoam"${variant}")"

    local pagkage_directory=""
    local executable_name=""
    local installed=""
    local package_makefile_directory=""
    while read -r package_makefile_directory; do
        executable_name=$( extract_executable_name "${package_makefile_directory}" )

        if [ -n "${executable_name}" ]; then
            if [ -x "${foam_location}/platforms/linux64GccDPInt32-spack/bin/${executable_name}" ]; then
                installed="Y"
            else
                installed="N"
            fi
            package_directory="$( echo "${package_makefile_directory}" | xargs -I % dirname % )"

            echo "${installed} : ${executable_name} => ${package_directory#${foam_location}}"
        fi
    done < <( find_makefile_directories "${foam_location}/applications/${type}" )
}

main "${variant}" "${type}"

スクリプトを単純に実行すると、次のユーティリティが欠落していることが示されます。

(access node)$ ./list_spack_openfoam utilities @2306 | grep -E '^N'
N : addr2line => /applications/utilities/miscellaneous/OSspecific/addr2line
N : foamyHexMeshSurfaceSimplify => /applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify
N : foamyHexMeshBackgroundMesh => /applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh
N : cellSizeAndAlignmentGrid => /applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid
N : foamToCcm => /applications/utilities/mesh/conversion/ccm/foamToCcm
N : ccmToFoam => /applications/utilities/mesh/conversion/ccm/ccmToFoam

判断が難しいのですが、Markdown関連の問題は通常403エラーではなく、作成者にUIフィードバックがあります。当社の403エラーは、通常、承認に関連しており、たとえば、制限されたカテゴリへの投稿や、制限されたタグの使用などが該当します。

あなたのテキストチャンクをバニラ版のDiscourseで使用してみましたが、問題ないようです。

モデレーターにそのような制限が設けられているか確認することをお勧めします。

「いいね!」 4

さらに、特にコードブロックを含む投稿の作成を試みる際に、このような403エラーが発生するのは、コードブロックをシェルコードやインジェクション攻撃だと誤認する、過剰に反応するWAFが原因であることがほとんどだと判明しています。

問題のインスタンスはWAFで保護されているようです。

○ → host hpc-discourse.uni.lu
hpc-discourse.uni.lu is an alias for fstc-waf2.uni.lu.

したがって、403エラーはDiscourseからではなく、WAFから発生している可能性が非常に高いと考えられます。

ブラウザでエラーのヘッダーを調べれば、拒否の原因を特定できるはずです。

「いいね!」 7

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.