From ed33496ea92e9467c0c1a76c7ad26613bcb94ea8 Mon Sep 17 00:00:00 2001 From: praetor Date: Wed, 6 Mar 2019 04:48:20 +0000 Subject: [PATCH] added initial bootstrap script for new Tier 1 nodes --- etc/call | 2 -- etc/config | 16 --------- etc/port | 29 ---------------- etc/sys | 13 -------- nodelist | 4 +++ utils/bootstrap.pl | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 86 insertions(+), 60 deletions(-) delete mode 100644 etc/call delete mode 100644 etc/config delete mode 100644 etc/port delete mode 100644 etc/sys create mode 100644 nodelist create mode 100755 utils/bootstrap.pl diff --git a/etc/call b/etc/call deleted file mode 100644 index 6ac42b3..0000000 --- a/etc/call +++ /dev/null @@ -1,2 +0,0 @@ -# Username/password pairs are in the format: -# Uname password diff --git a/etc/config b/etc/config deleted file mode 100644 index f78b3ba..0000000 --- a/etc/config +++ /dev/null @@ -1,16 +0,0 @@ -# -# config This is the configuration file for uucp. Most configurable -# things are commented out as they are the default (compiled -# in) setting. The only thing you might want to change is the -# "nodename". That's your UUCP system name - change it if it's -# different from your normal hostname. -# - -nodename - -# Defaults. -#sysfile /etc/uucp/sys -#portfile /etc/uucp/port -#dialfile /etc/uucp/dial -#callfile /etc/uucp/call -#passwdfile /etc/uucp/passwd diff --git a/etc/port b/etc/port deleted file mode 100644 index 8fa7f63..0000000 --- a/etc/port +++ /dev/null @@ -1,29 +0,0 @@ -# -# port This file defines the possible dialout ports you have -# on your system. Normally you have only one, and it's -# most probably /dev/ttyS[0-3]. Define that port here. -# -# If you have multiple dialout ports, you can ofcourse -# define them all if you want. -# -port ACU -type modem -# -# NOTE: Make SURE this device is owned by root:dialout, mode 0660 (crw-rw---) -# -device /dev/ttyS3 -dialer hayes -speed 57600 - -# -# Description for the TCP port - pretty trivial. DON'T DELETE. -# -port TCP -type tcp - -port Dataforge -type pipe -command /usr/bin/ssh -a -x -q -i /var/spool/uucp/ssh/id_rsa -l uucp uucp.dataforge.tk -reliable true -protocol etyig - diff --git a/etc/sys b/etc/sys deleted file mode 100644 index 57e2598..0000000 --- a/etc/sys +++ /dev/null @@ -1,13 +0,0 @@ -system dataforge -call-login U -call-password Y2VudGVyOmRhdGFmb3JnZQ=== -local-send / -local-receive /var/spool/uucppublic -remote-send / -remote-receive /var/spool/uucppublic -time any -forward ANY -chat "" \d\d\r\c login: \d\L word: \P -chat-timeout 60 -protocol t -port Dataforge diff --git a/nodelist b/nodelist new file mode 100644 index 0000000..fb17a1b --- /dev/null +++ b/nodelist @@ -0,0 +1,4 @@ +tildeteam,tilde.team +cosmic,cosmic.voyage +center,tilde.center +dataforge,uucp.dataforge.tk diff --git a/utils/bootstrap.pl b/utils/bootstrap.pl new file mode 100755 index 0000000..2f99cf8 --- /dev/null +++ b/utils/bootstrap.pl @@ -0,0 +1,82 @@ +#!/usr/bin/perl +# +use warnings; +use strict; + +my $nodename = $ARGV[0]; + +sub getNodes { + my $nodelist = "../nodelist"; + + open(my $data, '<', $nodelist); + + print("Generating files\n"); + while (my $line = <$data>) { + chomp $line; + + my @fields = split(",", $line); + my $nodeName = $fields[0]; + my $nodeAddress = $fields[1]; + generatePort($nodeName,$nodeAddress); + generateSys($nodeName); + print("System ".$nodeName." added successfully\n"); + } + + print("UUCP bootstrapping complete. Please copy sys and port configuration files to /etc/uucp\n"); +} + +sub generatePort { + + my $currentNode = shift; + my $nodeAddress = shift; + + $currentNode =~ s/^([a-z])/\U$1/; + + my $template = qq{ + port $currentNode + type pipe + command /usr/bin/ssh -a -x -q -i /var/spool/uucp/.ssh/id_rsa -l uucp $nodeAddress + reliable true + protocol etyig + }; + + my $portFile = "port"; + open(FH, '>>', $portFile); + print FH $template; +} + + +sub generateSys { + my $nodeName = shift; + + my $template = qq{ + system $nodeName + call-login * + call-password * + local-send / + local-receive /var/spool/uucppublic + remote-send / + remote-receive /var/spool/uucppublic + time any + forward ANY + chat \"\" \\d\\d\\r\\c login: \\d\\L word: \\P + chat-timeout 60 + protocol t + port Center + }; + + my $sysFile = "sys"; + + open(FH, '>>', $sysFile); + print FH $template; +}; + +sub generatePasswd { + +} + +sub generateConfig { + +} + +getNodes()