summaryrefslogtreecommitdiff
path: root/src/migration-scripts
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-18 18:40:53 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-18 21:35:28 +0200
commitf07f46d36e17ea07b0db65e3856cc090033d9e78 (patch)
tree0c98755d9466a3079edc1e7880bf9192c69a1b59 /src/migration-scripts
parentb81a37d19abfac0dbc1f49860dbe75a4f8caed61 (diff)
downloadvyos-1x-f07f46d36e17ea07b0db65e3856cc090033d9e78.tar.gz
vyos-1x-f07f46d36e17ea07b0db65e3856cc090033d9e78.zip
ipoe-server: T2324: migrate RADIUS configuration to common CLI syntax
Diffstat (limited to 'src/migration-scripts')
-rwxr-xr-xsrc/migration-scripts/ipoe-server/0-to-123
1 files changed, 23 insertions, 0 deletions
diff --git a/src/migration-scripts/ipoe-server/0-to-1 b/src/migration-scripts/ipoe-server/0-to-1
index 94addcbdb..c04a7fb19 100755
--- a/src/migration-scripts/ipoe-server/0-to-1
+++ b/src/migration-scripts/ipoe-server/0-to-1
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# - remove primary/secondary identifier from nameserver
+# - Unifi RADIUS configuration by placing it all under "authentication radius" node
import os
import sys
@@ -58,6 +59,28 @@ else:
config.delete(dns_base)
+ # Migrate radius-settings node to RADIUS and use this as base for the
+ # later migration of the RADIUS servers - this will save a lot of code
+ radius_settings = base + ['authentication', 'radius-settings']
+ if config.exists(radius_settings):
+ config.rename(radius_settings, 'radius')
+
+ # Migrate RADIUS server
+ radius_server = base + ['authentication', 'radius-server']
+ if config.exists(radius_server):
+ new_base = base + ['authentication', 'radius', 'server']
+ config.set(new_base)
+ config.set_tag(new_base)
+ for server in config.list_nodes(radius_server):
+ old_base = radius_server + [server]
+ config.copy(old_base, new_base + [server])
+
+ # remove old req-limit node
+ if config.exists(new_base + [server, 'req-limit']):
+ config.delete(new_base + [server, 'req-limit'])
+
+ config.delete(radius_server)
+
try:
with open(file_name, 'w') as f:
f.write(config.to_string())