File: simplesamlphp-riak.md

package info (click to toggle)
simplesamlphp 1.19.7-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 42,920 kB
  • sloc: php: 202,044; javascript: 14,867; xml: 2,700; sh: 225; perl: 82; makefile: 70; python: 5
file content (113 lines) | stat: -rw-r--r-- 3,280 bytes parent folder | download | duplicates (3)
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
Riak Store module
=================

<!--
	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
-->


<!-- {{TOC}} -->

Introduction
------------

The riak module implements a Store that can be used as a backend
for SimpleSAMLphp session data like the phpsession, sql, or memcache
backends.

Preparations
------------

The obvious first step for using Riak as a backend is to install
and configure a Riak cluster for SimpleSAMLphp to use. Please refer
to the Riak documentation for this.

This module requires the use of a Riak backend that supports secondary
indexes. Refer to the Riak documentation on how to enable an
appropriate backend for use by this module. Currently the only
storage backend that supports secondary indexes is leveldb.

Finally, you need to config SimpleSAMLphp to use the riak Store by
enabling the following modules:

 1. cron
 2. riak

The cron module allows you to do tasks regularly by setting up a
cronjob that calls hooks in SimpleSAMLphp. This is required by the
riak module to remove expired entries in the store.

Enabling the riak module allows it to be loaded and used as a storage
backend.

You also need to copy the `config-templates` files from the cron
module above into the global `config/` directory.

	$ cd /var/simplesamlphp
	$ touch modules/cron/enable
	$ cp modules/cron/config-templates/*.php config/
	$ touch modules/riak/enable
	$ cp modules/riak/config-templates/*.php config/


Configuring the cron module
---------------------------

At `/var/simplesamlphp/config`

	$ vi module_cron.php

edit:

	$config = array (
		'key' => 'secret',
		'allowed_tags' => array('daily', 'hourly', 'frequent'),
		'debug_message' => TRUE,
		'sendemail' => TRUE,
	);

Then: With your browser go to => https://simplesamlphp_machine/simplesaml/module.php/cron/croninfo.php

And copy the cron's sugestion:

	-------------------------------------------------------------------------------------------------------------------
	Cron is a way to run things regularly on unix systems.

	Here is a suggestion for a crontab file:

	# Run cron [daily]
	02 0 * * * curl --silent "https://simplesamlphp_machine/simplesaml/module.php/cron/cron.php?key=secret&tag=daily" > /dev/null 2>&1
	# Run cron [hourly]
	01 * * * * curl --silent "https://simplesamlphp_machine/simplesaml/module.php/cron/cron.php?key=secret&tag=hourly" > /dev/null 2>&1
	# Run cron [frequent]
	XXXXXXXXXX curl --silent "https://simplesamlphp_machine/simplesaml/module.php/cron/cron.php?key=secret&tag=frequent" > /dev/null 2>&1
		Click here to run the cron jobs:

	Run cron [daily]
	Run cron [hourly]
	Run cron [frequent]
	-------------------------------------------------------------------------------------------------------------------

Add to CRON with

	# crontab -e

Configuring the riak module
---------------------------

The riak module uses the following configuration options specified
in `config/module_riak.php`. The defaults are listed:

	$config = [
		'host' => 'localhost',
		'port' => 8098,
		'bucket' => 'SimpleSAMLphp',
	];

Finally, the module can be specified as the Store in `config/config.php`
with the following setting:

		'store.type' => 'riak:Riak',