Skip to content
Snippets Groups Projects
simplesamlphp-install.txt 15 KiB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
simpleSAMLphp Installation and Configuration
============================================

<!-- 
	This file is written in Markdown syntax. 
	For more information about how to use the Markdown syntax, read here:
	http://daringfireball.net/projects/markdown/syntax
-->

  * Version: `$Id$`



simpleSAMLphp documentation
---------------------------

This document is part of the simpleSAMLphp documentation suite.

- [List of all simpleSAMLphp documentation](http://rnd.feide.no/view/simplesamlphpdocs)

This document is the first step.

News about simpleSAMLphp
------------------------

To get the latest news about simpleSAMLphp you can follow this url:
[http://rnd.feide.no/taxonomy/term/4](http://rnd.feide.no/taxonomy/term/4).
It also conatins an RSS feed.

Here is the simpleSAMLphp homepage:
[http://rnd.feide.no/simplesamlphp](http://rnd.feide.no/simplesamlphp)


Prerequisites
-------------

PHP version >= 5.1.2. If you want to run the *Shibboleth 1.3* part of simpleSAMLphp, you must have PHP >= 5.2.

Apache or some other webserver that allows you to run PHP.

simpleSAMLphp is has been tested most thoroughly on different Linux versions, Unix, and Mac OS X. It also runs on Windows, but at the time of writing, testing has been less thorough.


Download and install simpleSAMLphp
----------------------------------

The most recent relase of simpleSAMLphp is found at
[code.google.com/p/simplesamlphp/.](http://code.google.com/p/simplesamlphp/)
To obtain a stable version, you may download the zipped
`simplesamlphp` zip file listed under Featured Dowloads, or you may
check out the last version includeing the most recent updates from
the subversion repository.

### Get a working copy of simpleSAMLphp from subversion

Go to the directory where you want to install simpleSAMLphp:

    cd /var

Then do a subversion checkout:

    svn checkout http://simplesamlphp.googlecode.com/svn/trunk/ simplesamlphp

Using subversion, you can view logs and review changes to the
files. To update the version you have checked out, enter:

    cd /var/simplesamlphp
    svn up

## Upgrading from a previous version of simpleSAMLphp

*If you have downloaded a version from the subversion repository:*

Type, while located in the root folder of your simpleSAMLphp
installation:

    svn update

*If you download and install the zipped version:*

-   Make a backup of the `config` and the `metadata` directories.

-   Delete all files from your current simpleSAMLphp directory .

-   Unzip the new version in the simpleSAMLphp directory.

-  
    Install the backups of `config` and the `metadata` directories in
    the simpleSAMLphp directory.


If the format of the config files or metadata has changed from your
previous version of simpleSAMLphp (check the revision log), you may
have to update your configuration and metadata after updating the
simpleSAMLphp code:

### Upgrading configuration files

A good approach is to run a `diff` between your preivous
`config.php` file and the new `config.php` file located in
`config-templates/config.php`, and apply relevant modifications to
the new template. This will ensure that all new entries in the
latest version of config.php are included, as well as preserve your
local modifications.

There is a link to a configuration check utility from the frontpage
of your simpleSAMLphp installation page. The name of the link is
"simpleSAMLphp configuration check". Then you will get a list of
all configuration files in your `config/` directory. Click through
the files, and you will get a report on superfluous and missing
entries in the configuration file. What is done under the hood is
that simpleSAMLphp looks up the `config-templates/` directory and
compares to your real config. Although not all option is required
to have in the configuration files, it's a good thumb rule to
include them nontheless, so you simply see what configuration is
possible.

### Upgrading metadata files

Most likely the metadata format is backwards compatible. If not,
you should receive a very clear error message at startup indicating
how and what you need to update. You should look through the
metadata in the metadata-templates directory after the upgrade to
see whether recommended defaults have been changed.




Making configuration and metadata files
---------------------------------------

### Tip

You do not need to read this section if you are upgrading
simpleSAMLphp from an earlier version, then see
[the section called “Upgrading from a previous version of simpleSAMLphp”](#sect.upgrading "Upgrading from a previous version of simpleSAMLphp").

Configuration and metadata files are distributed as templates; you
should make local copies to directories `config` and `metadata` and
edit these copies to suit your local requirements. When you later
upgrade, through a subversion `svn     up` command or by installing
a new zip file, your existing configuration data will not not be
overwritten.

Here are the steps you need to do to create local configuration
files:

    cd /var/simplesamlphp
    cp -r config-templates/*.php config/
    cp -r metadata-templates/*.php metadata/



Configuring Apache
------------------

Examples below assume that simpleSAMLphp is installed in the
default location, `/var/simplesamlphp`. You may choose another
location, but this requires a path update in a few files.
[See Appendix A for details](#sect.altlocations "A. Installing simpleSAMLphp in alternative locations").

The only subdirectories of `simpleSAMLphp` that needs to be
accessible from the web is `www`. There are several ways of putting
the simpleSAMLphp depending on the way web sites are structured on
your apache web server. Here is what I believe is the best
configuration.

Find the Apache configuration file for the virtual hosts where you
want to run simpleSAMLphp. The configuration may look like this:

    <VirtualHost *>
            ServerName service.example.com
            DocumentRoot /var/www/service.example.com
    
            Alias /simplesaml /var/simplesamlphp/www
    </VirtualHost>

Note the `Alias` directive, which gives control to simpleSAMLphp
for all urls matching `http(s)://service.example.com/simplesaml/*`.
simpleSAMLphp makes several SAML interfaces available on the web;
all of them are included in the `www` subdirectory of your
simpleSAMLphp installation. You can name the alias whatever you
want, but the name must be specified in the `config.php` file of
simpleSAML as described in
[the section called “simpleSAMLphp configuration: config.php”](#sect.config "simpleSAMLphp configuration: config.php").
Here is an example of how this configuration may look like in
`config.php`:h

    $config = array (
    [...]
            'baseurlpath'                   => 'simplesaml/',

simpleSAMLphp configuration: config.php
---------------------------------------

There is a few steps that you should edit in the main configuration
file, `config.php`, right away:

-  
    Set a administrator password. This is needed to access some of the
    pages in your simpleSAMLphp installation web interface.

		'auth.adminpassword'        => 'setnewpasswordhere',

-  
    Set a secret salt. This should be a random string. Some parts of
    the simpleSAMLphp needs this salt to generate cryptographically
    secure hashes. SimpleSAMLphp will give an error if the salt is not
    changed from the default value. The command below can help you to
    generated a random string on (some) unix systems:

		tr -c -d '0123456789abcdefghijklmnopqrstuvwxyz' </dev/urandom | dd bs=32 count=1 2>/dev/null;echo

    Here is an example of the config option:

		'secretsalt' => 'randombytesinsertedhere',

-  
    Set technical contact information. This information will be
    available in the generated metadata. The e-mail address will also
    be used for receiving error reports sent automatically by
    simpleSAMLphp. Here is an example:

		'technicalcontact_name'     => 'Andreas Åkre Solberg',
		'technicalcontact_email'    => 'andreas.solberg@uninett.no',

-  
    If you use simpleSAMLphp in a country where english is not
    widespread, you may want to change the default language from
    english to something else:

		'language.default'      => 'no',


Configure PHP to be able to send e-mails
----------------------------------------

Some parts of simpleSAMLphp will allow you to send e-mails. In
example sending error reports to technical admin, as well as
sending in metadata to the federation administrators. If you want
to make use of this functionality, you should make sure your PHP
installation is configured to be able to send e-mails. It's a
common problem that PHP is not configured to send e-mails properly.
The configuration differs from system to system. On UNIX, PHP is
using sendmail, on Windows SMTP.



Enable modules
--------------

If you want to enable some of the modules that are installed with
simpleSAMLphp, but are disabled by default, you should create an
empty file in the module directory named `enable`.

    # Enabling the consent module
    cd modules
    ls -l
    cd consent
    touch enable

If you later want to disable the module, rename the `enable` file
to `disable`.

    cd modules/consent
    mv enable disable



The simpleSAMLphp installation webpage
--------------------------------------

After installing simpleSAMLphp, you can access the homepage of your
installation, which contains some information and a few links to
the test services. The url of an installation can be e.g.:

https://service.example.org/simplesaml/

The exact link depends on how you set it up with Apache, and off
course on your hostname.

### Warning

Don't click on any of the links yet, because they require you to
either have setup simpleSAMLphp as an Service Provider or as an
Identity Provider.

Here is an example screenshot of what the simpleSAMLphp page looks
like:

![Screenshot of the simpleSAMLphp installation page.](http://rnd.feide.no/doc/resources/simplesamlphp-install/screenshot-installationpage.png)

### Check your PHP environment

At the bottom of the installation page are some green lights.
simpleSAML runs some tests to see whether required and recommended
prerequisites are met. If any of the lights are red, you may have
to add some extensions or modules to PHP, e.g. you need the PHP
LDAP extension to use the LDAP authentication module.

## Next steps

You have now successfully installed simpleSAMLphp, and the next
steps depends on whether you want to setup a service provider, to
protect a website by authentication or if you want to setup an
identity provider and connect it to a user catalog. Documentation
on bridging between federation protocols is found in a separate
document.

-  
    [Setting up simpleSAMLphp as a service provider](http://rnd.feide.no/content/using-simplesamlphp-service-provider)

-  
    [Setting up simpleSAMLphp as an identity provider](http://rnd.feide.no/content/using-simplesamlphp-identity-provider)

-  
    [Setting up simpleSAMLphp with Google Apps for Eduation](http://rnd.feide.no/content/simplesamlphp-idp-google-apps-education)

-  
    [Advanced simpleSAMLphp features](http://rnd.feide.no/content/simplesamlphp-advanced-features)

-  
    [simpleSAMLphp maintenance and configuration](http://rnd.feide.no/content/simplesamlphp-maintenance-and-configuration)


Support
-------

If you need help to make this work, or want to discuss simpleSAMLphp with other users of the software, you are fortunate: Around simpleSAMLphp there is a great Open source community, and you are welcome to join! The forums are open for you to ask questions, contribute answers other further questions, request improvements or contribute with code or plugins of your own.

-  [simpleSAMLphp homepage (at Feide RnD)](http://rnd.feide.no/simplesamlphp)
-  [List of all available simpleSAMLphp documentation](http://rnd.feide.no/view/simplesamlphpdocs)
-  [Join the simpleSAMLphp user's mailing list](http://rnd.feide.no/content/simplesamlphp-users-mailinglist)
-  [Visit and contribute to the simpleSAMLphp wiki](https://ow.feide.no/simplesamlphp:start)




Installing simpleSAMLphp in alternative locations
-------------------------------------------------

There may be several reasons why you want to install simpleSAMLphp
in an alternative way.

1.	You are installing simpleSAMLphp in a hosted environment where you
	do not have root access, and cannot change Apache configuration.
	Still you can install simpleSAMLphp - keep on reading.

2.	You have full permissions to the server, but cannot edit Apache
	configuration for some reason, polictics, policy or whatever.


The SimpleSAMLphp code contains one folder named `simplesamlphp`. In this folder there are a lot of subfolders for library, metadata, configuration and much more. One of these folders is named `www`. This and *only this* folder should be exposed on the web. The reccomended configuration is to put the whole `simplesamlphp` folder outside the webroot, and then link in the `www` folder by using the `Alias` directive, as described in [the section called “Configuring Apache”](#sect.apacheconfig "Configuring Apache"). But this is not the only possible way.

As an example, let's see how you can install simpleSAMLphp in your home directory on a shosted server.

Check out simpleSAMLphp in your home directory, and move or symlink the www folder into the `public_html` folder.

    cd ~
    svn checkout [snipp] simplesamlphp

Then you can try to make a symlink into the public\_html
directory.

    cd ~/public_html
    ln -s ../simplesamlphp/www simplesaml

### Tip

Symlinking may fail, because some apache configurations do not allow you to link in files from outside the public\_html folder. If so, move the folder instead of symlinking:

    cd ~/public_html
    mv ../simplesamlphp/www simplesaml

Now you have the following directory structure.

-   `~/simplesamlphp`

-  
    `~/public_html/simplesaml` where `simplesaml` is the `www`
    directory from the `simplesamlphp` installation directory, either
    moved or a symlink.


Now, we need to make a few configuration changes. First, let's edit
`~/public_html/simplesaml/_include.php`:

Change the two lines from:

    require_once(dirname(dirname(__FILE__)) . '/lib/_autoload.php');
    $path_extra = dirname(dirname(__FILE__)) . '/lib';

to something like:

    require_once('/home/andreas/simplesamlphp/lib/_autoload.php');
    $path_extra = '/home/andreas/simplesamlphp/lib';

And then at the end of the file, you need to change another line
from:

    $configdir = dirname(dirname(__FILE__)) . '/config';

to:

    $configdir = '/home/andreas/simplesamlphp/config';



### Note

In a future version of simpleSAMLphp we'll make this a bit easier, and let you only change the path one place, instead of three as described above.

Next, you need to update the configuration of paths in `simplesamlphp/config/config.php`:

Set the `basedir` parameter to the path of your simplesamlphp folder:

	'basedir' => '/home/andreas/simplesamlphp/',

And, then we need to set the `baseurlpath` parameter to match the base path of the URLs to the content of your `www` folder:

	'baseurlpath'           => '~andreas/simplesaml/',

Now, you can go to the URL of your installation and check if things work:

	http://yourcompany.com/~andreas/simplesaml/