summaryrefslogtreecommitdiffstats
path: root/raddb/mods-config/sql/ippool/mongo
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:49:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:49:46 +0000
commit50b37d4a27d3295a29afca2286f1a5a086142cec (patch)
tree9212f763934ee090ef72d823f559f52ce387f268 /raddb/mods-config/sql/ippool/mongo
parentInitial commit. (diff)
downloadfreeradius-upstream.tar.xz
freeradius-upstream.zip
Adding upstream version 3.2.1+dfsg.upstream/3.2.1+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'raddb/mods-config/sql/ippool/mongo')
-rw-r--r--raddb/mods-config/sql/ippool/mongo/queries.conf109
1 files changed, 109 insertions, 0 deletions
diff --git a/raddb/mods-config/sql/ippool/mongo/queries.conf b/raddb/mods-config/sql/ippool/mongo/queries.conf
new file mode 100644
index 0000000..9d7d070
--- /dev/null
+++ b/raddb/mods-config/sql/ippool/mongo/queries.conf
@@ -0,0 +1,109 @@
+# -*- text -*-
+#
+# ippool/mongo/queries.conf -- Mongo queries for rlm_sqlippool
+#
+# $Id$
+
+#
+# The IP Pool queries expect a result like:
+#
+# {
+# pool_key: "bob"
+# pool_name: "my_pool"
+# expiry_time: xxx
+# value: "192.168.1.1"
+# }
+#
+# i.e. the results are in "value", and not "framed_ip_address".
+#
+# When using dynamic expansions such as "%{sql:... mongo query ...}",
+# Mongo uses a lot of curly brackets, {..}. Any closing braces have
+# to be escaped as %}. Sorry, that is a limitation of the FreeRADIUS
+# parser.
+#
+
+#
+# TBD
+#
+on_begin = ""
+off_begin = ""
+
+allocate_begin = ""
+
+#
+# This query allocates an IP address from the Pool
+#
+allocate_find = "db.mypool_collection.findAndModify( \
+ { \
+ 'query': {' \
+ '$and': [ \
+ { \
+ 'pool_name': '%{control:Pool-Name}' \
+ }, \
+ { \
+ 'nas_ip': '%{Nas-IP-Address}' \
+ }, \
+ { \
+ '$or': [ \
+ { \
+ 'calling_station_id': '%{Calling-Station-Id}' \
+ }, \
+ { \
+ 'locked': 0 \
+ } \
+ ] \
+ } \
+ ] \
+ }, \
+ 'update': { \
+ 'locked': 1', \
+ 'calling_station_id': '%{Calling-Station-Id'}' \
+ }, \
+ 'fields': { \
+ '_id': 0, 'framed_ip_address': 1 \
+ } \
+ })"
+
+allocate_update = ""
+
+allocate_clear = "db.mypool_collection.findAndModify( \
+ { \
+ 'query': { \
+ '$and': [ \
+ { \
+ 'pool_name': '%{Control:Pool-Name}' \
+ }, \
+ { \
+ 'nas_ip': '%{Nas-IP-Address}' \
+ }, \
+ { \
+ 'calling_station_id': '%{Calling-Station-Id}' \
+ }, \
+ { \
+ 'locked': 1 \
+ } \
+ ] \
+ }, \
+ 'update': { \
+ 'locked': 0, \
+ 'calling_station_id': '' \
+ } \
+ })"
+
+allocate_commit = ""
+
+start_begin = ""
+start_update = ""
+start_commit = ""
+
+stop_begin = ""
+stop_clear = ""
+stop_commit = ""
+
+alive_begin = ""
+alive_update = ""
+alive_commit = ""
+
+on_clear = ""
+off_clear = ""
+