{
  "id": "06",
  "content": [
    {
      "type": "heading",
      "text": "IP Access Rules & Maintenance Mode"
    },
    {
      "type": "text",
      "html": "Restrict by client IP; show a maintenance page for everyone else."
    },
    {
      "type": "text",
      "html": "<pre><code># Allow your office, deny others\nRequire all denied\nRequire ip 203.0.113.10\nRequire ip 2001:db8::/32\n\n# Maintenance: rewrite all to static page except whitelisted IP\nRewriteEngine On\nRewriteCond %{REMOTE_ADDR} !^203\\.0\\.113\\.10$\nRewriteRule ^.*$ /maintenance.html [R=302,L]</code></pre>"
    }
  ],
  "quiz": {
    "questions": [
      {
        "id": "q1",
        "type": "single",
        "text": "Which directive denies everyone by default (Apache 2.4 syntax)?",
        "options": [
          {
            "id": "a",
            "text": "Deny from all"
          },
          {
            "id": "b",
            "text": "Require all denied"
          },
          {
            "id": "c",
            "text": "Block all"
          }
        ],
        "correct": [
          "b"
        ]
      },
      {
        "id": "q2",
        "type": "single",
        "text": "Which variable matches the client IP in RewriteCond?",
        "options": [
          {
            "id": "a",
            "text": "%{REMOTE_ADDR}"
          },
          {
            "id": "b",
            "text": "%{CLIENT_IP}"
          },
          {
            "id": "c",
            "text": "%{COOKIE_IP}"
          }
        ],
        "correct": [
          "a"
        ]
      }
    ]
  }
}