User Tools

Site Tools


doc:appunti:linux:sa:debian_11_12_mapserver_upgrade

This is an old revision of the document!


MapServer upgrade from Debian 11 to Debian 12

Finally I decided to upgrade my home server from Debian 11 Bullseye to Debian 12 Bookworm; here you can read some notes about the upgrade: Aggiornamento da Debian 11 Bullseye a 12 Bookworm.

One change that deserves a dedicated page is the upgrade from MapServer 7.6.2 shipped with Debian 11 to MapServer 8.0.1 shipped with Debian 12; in fact it happened that almost all the MapServer based applications stopped working.

A mapserver.conf is required

In version 8 it became mandatory to have a configuration file, the default location of which is /etc/mapserver.conf. See the syntax here: https://mapserver.org/mapfile/config.html. You must declare at least the MS_MAP_PATTERN path.

In the past I used to have some CGI-Mapserver services (as native MapServer or as WMS service) where the service URL contained the full path of the mapfile, something like this:

http://www.rigacci.org/cgi-bin/mapserv?map=/usr/local/lib/mapserver/mie-strade-wms.map&

It is not a good practice to accept from the internet a parameter that is the full path to a local file. MapServer 8 requires that you declare at least a pattern that the received mapfile must obey to (MS_MAP_PATTERN). Better than that, you can define several aliases (short names pointing to the mapfiles wherever they resied) and accept from the client only that aliases, disallowing the requests for a full path mapfile (MS_MAP_NO_PATH). I opted for the latter mode:

# MapServer 8.0 Config File
# https://mapserver.org/mapfile/config.html
CONFIG
  MAPS
    # Define the aliases for mapfile paths.
    MIE_STRADE_WMS "/usr/local/lib/mapserver/mie-strade-wms.map"
  END
  ENV
    # Disallow using full path for mapfiles (use aliases defined in CONFIG:MAPS instead).
    MS_MAP_NO_PATH "true"
    # Limit mapfile access when using full paths, this setting is never used 
    # if CONFIG:ENV:MS_MAP_NO_PATH is set.
    MS_MAP_PATTERN "^/usr/local/lib/mapserver"
  END
END

In this way the above URL will be changed into:

http://www.rigacci.org/cgi-bin/mapserv?map=MIE_STRADE_WMS&
doc/appunti/linux/sa/debian_11_12_mapserver_upgrade.1700758055.txt.gz · Last modified: 2023/11/23 17:47 by niccolo