Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-53563

IPBlocker: Add CLI to enable/disable blocking, also beautify the block message.

XMLWordPrintable

    • MOODLE_29_STABLE, MOODLE_30_STABLE
    • MDL-53563-ipblock_master
    • Hide

      Navigate to the IP block settings page, /admin/settings.php?section=ipblocker

      By default the 'enableipblocker' and 'enableipblockertheme' boxes should not be ticked/enabled.

      In the 'ipblockermessage' field, enter a custom message.
      In the 'blockedip' field, enter the IP/range that you're accessing Moodle with. (eg '192.168')

      Enable the IP block via the CLI,
      php admin/cli/ipblock.php --enable --theme

      Refresh the page to view the new block message.
      Try to navigate to other pages,
      /my/
      /course/index.php
      You should still be blocked.

      Disable the IP block via the CLI,
      php admin/cli/ipblock.php --disable

      Refresh the page, you are unblocked and now looking at the correct page contents.

      Additional testing,
      Enable the IP block via the CLI,
      php admin/cli/ipblock.php --enable --theme

      Purge the caches,
      php admin/cli/purge_caches.php
      The themed page should still be displayed correctly.

      Enable the IP block via the CLI,
      php admin/cli/ipblock.php --enable
      You should be viewing a message that is not wrapped around the theme.

      Show
      Navigate to the IP block settings page, /admin/settings.php?section=ipblocker By default the 'enableipblocker' and 'enableipblockertheme' boxes should not be ticked/enabled. In the 'ipblockermessage' field, enter a custom message. In the 'blockedip' field, enter the IP/range that you're accessing Moodle with. (eg '192.168') Enable the IP block via the CLI, php admin/cli/ipblock.php --enable --theme Refresh the page to view the new block message. Try to navigate to other pages, /my/ /course/index.php You should still be blocked. Disable the IP block via the CLI, php admin/cli/ipblock.php --disable Refresh the page, you are unblocked and now looking at the correct page contents. Additional testing, Enable the IP block via the CLI, php admin/cli/ipblock.php --enable --theme Purge the caches, php admin/cli/purge_caches.php The themed page should still be displayed correctly. Enable the IP block via the CLI, php admin/cli/ipblock.php --enable You should be viewing a message that is not wrapped around the theme.

      What this improvement provides is,

      • A CLI script to enable or disable the IP blocker.
      • Allows a custom message to be set for those that are blocked.

      After a deployment it would be useful to allow access granted to only a select group of IP addresses. Much like the maintenance mode this can now be toggled via a CLI script.

      Other reasons to block or whitelist the address space would be a planned maintenance where you require the site to be enabled, but wish to restrict students from accessing it for a period of time while staff are given time to make modifications.

      The default blocked message does not provide a description of why the user has been denied access, this improvement allows you to set a custom message which will be wrapped around the current theme. If users know why their access has been restricted it could alleviate the load on their local IT department.

      The message can be configured in admin/settings.php?section=ipblocker along with the previous IP blocker settings.

            nhoobin Nicholas Hoobin
            nhoobin Nicholas Hoobin
            cameron1729 cameron1729
            Dan Poltawski Dan Poltawski
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.