Compare commits

...

52 Commits

Author SHA1 Message Date
deepend 213a90df09 Update 'README.md' 2021-02-27 02:55:11 +00:00
deepend 57349ac927 Update 'ssh/authorized_keys'
removed center, dataforge.  Obviously if dataforge comes back we can re-add.  but from what I can tell the domains are all offline.
2021-02-27 02:49:16 +00:00
deepend b2924f3f32 Update 'nodelist'
removed tilde.center
2021-02-27 02:47:36 +00:00
ubergeek 94cdf831d8 Merge branch 'master' of amcclure/uucp into master 2019-10-31 09:56:42 -04:00
Anton McClure b1fe6a0096
Updated domain name for dataforge 2019-10-31 13:43:29 +00:00
praetor 8ebc93d5ca Merge branch 'master' of jgoerzen/uucp into master
Great work!
2019-10-26 22:08:42 -04:00
John Goerzen af06c03628 No longer let remote systems request any file on the system
Local users can still send any file that the uucp user has access
to, but don't let remote systems get it all.
2019-10-23 07:36:42 -05:00
John Goerzen 4f5b52ca3c Support ssh on nonstandard ports
Port 22 can be a target for portscanning, so for those that wish to
listen elsewhere, support that by adding a field to nodelist
2019-10-23 16:09:09 -05:00
John Goerzen b61398309a Make sure to exit if a command fails in update script 2019-10-23 16:09:09 -05:00
John Goerzen 45724aa86a Document permissions for /etc/uucp 2019-10-23 16:09:09 -05:00
John Goerzen f6dc1b424a Pass the username in authorized_keys, not reading in uucico
Since all the passwords are trivially guessable, it is easy for
any authorized system to impersonate any other authorized system
at present.

This patch prevents that by hardcoding the username into the uucico
call based on the authorized key from ssh.  This causes the incoming
system to need to only present a password, hence the change to chat.

This change will break communication between nodes until all nodes
apply it.
2019-10-23 06:12:14 -05:00
John Goerzen a4e8993913 Switch to "restrict" in authorized_keys
Per the docs:

     restrict
             Enable all restrictions, i.e. disable port, agent and X11 forwarding,
             as well as disabling PTY allocation and execution of ~/.ssh/rc.  If
             any future restriction capabilities are added to authorized_keys
             files they will be included in this set.
2019-10-23 12:12:40 -05:00
John Goerzen 78fec632b6 Block rmail by default
The default set of authorized commands is "rnews rmail" per the Taylor
UUCP documentaiton.  The way rmail works -- generally injecting a
message in such a way that the MTA sees it as originating locally --
can open up a UUCP node to unahtorized mail relay attacks.  Since it
looks like rmail isn't being used across the Tilde UUCP right now,
just block it by default.
2019-10-22 10:09:00 -05:00
praetor 8300b0f67b Merge branch 'master' of dgold/uucp into master
Approved addition of dgold.eu

Welcome :D
2019-04-27 16:00:53 -04:00
uucp e872b7e837 add dgold.eu 2019-04-27 12:42:21 +01:00
praetor 35497b41fe Merge branch 'master' of radiofreqs/uucp into master
Added radiofreqs.space
2019-04-15 09:59:40 -04:00
uucp 99e0c02ef3 add radiofreqs.space 2019-04-15 03:46:57 +00:00
praetor 567da120f5 Merge branch 'master' of tomasino/uucp into master
Approved PR to fix variable scope in script.
2019-04-06 17:51:58 -04:00
James Tomasino 57751a5489 removed "my" keyword to put $myNode in global scope 2019-04-06 17:00:09 -04:00
praetor 2588731e64 Merge branch 'master' of dbucklin/uucp into master
Added PR to provide options for server setup.
2019-04-05 23:21:38 -04:00
Dave Bucklin d71c5ad7b6 Add command-line options -h and -t for help and truncate existing files, respectively. 2019-04-06 02:03:19 +00:00
praetor 45ae555951 Merge branch 'master' of dumai/uucpconfig into master
Added called login
2019-03-30 13:11:47 -04:00
dumai 89e163df75 Trivial swap out of spaces for tabs for consistencyb 2019-03-30 09:38:48 -04:00
dumai b50ecbf428 Update 'utils/bootstrap.pl'
Add called-login entry to sysfile stanza
2019-03-30 09:22:50 -04:00
praetor 05d62e10c3 Merge branch 'master' of dbucklin/uucp into master
added frostbyte
2019-03-28 22:48:36 -04:00
dbucklin 9afcd5fa0c Update 'nodelist'
Add frostbyte
2019-03-27 22:31:58 -04:00
dbucklin cd5a31f2c5 Update 'ssh/authorized_keys'
Added key for frostbyte
2019-03-27 22:30:25 -04:00
praetor 2833a36b7a Merge branch 'epfl' of jeffallen/uucp into master
Added EPFL to the Tier 1 configs
2019-03-26 23:01:13 -04:00
praetor 9e7a496f17 Merge branch 'fixes' of jeffallen/uucp into master
Added fixes for file concatenation and better error handling.
2019-03-26 11:33:53 -04:00
Jeff R. Allen 61e208dd1a Small fixes to usability. 2019-03-26 14:36:58 +01:00
Jeff R. Allen 7dcd9db143
Fix the hostname. 2019-03-26 11:44:33 +01:00
Jeff R. Allen 2d7f04bdfb
Adding EPFL node. 2019-03-26 11:00:29 +01:00
praetor 6c20385bf8 Merge branch 'fix-append' of tildeverse/uucp into master
Fixed concatenation issues with the config files
2019-03-24 21:10:51 -04:00
Ben Harris 15c5046c82
fix bug with bootstrap results 2019-03-24 21:08:49 -04:00
praetor ccc95a3aac fixed ssh known_hosts 2019-03-24 23:16:20 +00:00
praetor e71d11735f Merge branch 'master' of fosslinux/uucp into master
added aussie tilde
2019-03-22 20:17:47 -04:00
fosslinux 74abbc2a73 add aussie to nodelist 2019-03-22 20:03:43 -04:00
fosslinux c83005cc6e add aussie ssh key 2019-03-22 20:03:13 -04:00
uucp bda224e3f7 known_hosts not concatenating. Fixed 2019-03-20 05:40:42 +00:00
praetor eea20dfacc Update 'nodelist'
Fixed nodes to standard conventions
2019-03-19 12:38:03 -04:00
praetor 63bf67a6fd Added call and passwd configuration 2019-03-19 13:27:58 +00:00
praetor 3ea474521d Merge branch 'institute' of ahriman/uucp into master 2019-03-07 10:47:45 -05:00
root eea68a0df0 Updated README 2019-03-06 20:09:43 +00:00
root 5b28c322ce updated README 2019-03-06 19:57:55 +00:00
root 53ed8e0e5b fixed config file bug 2019-03-06 19:48:12 +00:00
root 89ce28e5d4 Finished bootstrapping script 2019-03-06 19:13:50 +00:00
uucp a9cbc37ecf Updated Bootstrapping script 2019-03-06 18:37:16 +00:00
ahriman 03a3cc8038 added tilde.institute key 2019-03-06 00:38:00 -05:00
praetor ed33496ea9 added initial bootstrap script for new Tier 1 nodes 2019-03-06 04:48:20 +00:00
root 8a10364fcc Fixed files for center 2019-03-05 18:01:47 +00:00
uucp 9467eab5e0 added config templates 2019-03-05 00:31:41 +00:00
praetor 4a98594331 Merge branch 'master' of center/uucp into master
merged tilde.center to the main authorized_keys file
2019-03-04 19:00:40 -05:00
5 changed files with 244 additions and 6 deletions

View File

@ -0,0 +1,44 @@
# UUCP Scripts
These are utility scripts for UUCP sever provisioning and maintenance.
More information is available at https://uucp.tildeverse.org
## Prerequisites
In order to use these scripts you will first have to install the UUCP server software. While in theory any implementation of UUCP
will work, this network uses Taylor UUCP as it's server software.
### Debian/Ubuntu
```
sudo apt-get install uucp
```
### Redhat/Fedora/CentOS
```
sudo dnf install uucp
```
In order to join the UUCP network, you will first need to fork this repo and create a pull request with your server's uucp user's public key in ./ssh/authorized_keys. Please notify an admin of your join request. You may also join #uucp on tilde.chat IRC server.
### Provisioning
Provisioning a Tier 1 server is easy. Simply run the ./utils/bootstrap.pl file and move the generated configuration files to /etc/uucp as root. You will also need to get a password from each Tier 1 node. THIS PROCESSES IS NOT AUTOMATED YET.
```
./bootstrap.pl <assigned_node_name>
mv call config passwd port sys /etc/uucp
chmod 0640 /etc/uucp/call /etc/uucp/passwd
chown -R uucp:uucp /etc/uucp
```
Setting up a leaf node is similar, however, you must edit the nodelist file with a single entry of the server that you are joining. You will need
to contact your desired Tier 1 server's admin for a password. Leaf nodes do not need to run any update cron jobs, unlike Tier 1 servers.
### Care and feeding
A Tier 1 system must be able to receive updates about the network topology. You must create a cron job in the uucp user's crontab that runs update.pl at a set interval. While most other Tier 1 servers run this hourly, you can choose any interval you wish.
### Support
You can get help by joining us on IRC. We're nice. We promise :D
### Authors
Wesley Fisher (aka; Praetor) - Dataforge - wfisher@dataforge.network

8
nodelist Normal file
View File

@ -0,0 +1,8 @@
team,tilde.team,22
voyage,cosmic.voyage,22
institute,tilde.institute,22
aussie,aussies.space,22
epfl,uucp.cothority.net,22
frostbyte,uucp.frostbyte.cc,22
radiofreqs,radiofreqs.space,22
caconym,dgold.eu,22

View File

@ -1,6 +1,9 @@
no-port-forwarding,no-X11-forwarding,command="/usr/sbin/uucico -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUqrOtLNKN033OeoJtkGMKgEev+tgVAuKvDa//thWkhjvqxi2QtJ7gO1L9LsGXKSCfRLFZYJp04Zkz9/8BywGmPYknGkz9dyKlSk6/cLQ5Dc1Y01KcikFbNW8SaL+B2upBO8tYGDiTcNWlmZj2bFzcaT/sSUATPBcmlAcQqXgLLcWfo5H4mG1Ghha0IKSyGYDuyWCHHE5V7+jPFIApNAPc0cF9gZGTv8mjxODNW66qLs7bMjNAL3T47qzIx2Mc1nKuZTmA//heZ2OvnDrg9aWKFDeyJV4ovkIdfyErKqk8rq7G1i2Q+Vy2uxHV9CYIWCJ3KXQTyGzt9KTYSRaGFXw9 uucp@mail
no-port-forwarding,no-X11-forwarding,command="/usr/sbin/uucico -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+ZXG9cN7CTPoUmxlJLPiAct7/z8uG43VK0TZUtNeaO35medG8DR8pflm+KHZstJZp11Vpqtg1lTotYy3BL91KLWWkHj/sKLeoEUdhtbprm0vkXrHxzcyoPkunOyvk91dZnwY/JpoHrJUKyDIZGz+vHQ7MFzRB+x+7Yodx+wiQqE7zXzi0AuRXmsKhJa/mV10ZhHGEPbWuFj+vj7qqmVhU+B5OkL/rr6F8iVB/oCiXShGUIMHCSlYSQj50a5LmD2/9Bwl2QcLrhrNF1inHIgzRpYsBl1peJpiE/1NRiQZneneog/DQQvlsumdpwHiM9T5RL9vGU42PBL4kxclZqspd uucp@uucp
no-port-forwarding,no-X11-forwarding,command="/usr/sbin/uucico -l" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBaPW5orOACAl5GdTtn7CYDH+aAyCqOSsf/QHdH3WFST uucp@tilde
no-port-forwarding,no-X11-forwarding,command="/usr/sbin/uucico -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCENRbdhPRoI1c0dcQM8bqcpeEpq4dck8pRsGXRMCkwJBPMWk861nlx8H4hZsU7rpJAcgHGX3JwxEPEOGCC2vB4vv46K5eeiVkp5EmDH67K/9TjSzuX0qT+y6tECuXjB2dn3NQJpp0zh681hCszcjy8WxA4+a71HVfQPX2xE4Y6MCz7fTYaumXs9hpetVAgonzlP7W1h6zft+jAsrGDo8FrwAOCubw6/Ra1uAE5Ar3Gl8lLFe/eijjbjI2Y/MCZN3dacfqKH75MwY5E+3e7sRxrUaRtJ2sSiKmL+GqMEa916fxsJGlCu3tvVeUjsq3QEo/MI417l9tghOpOoSFaKNv uucp@cosmic.voyage
no-port-forwarding,no-X11-forwarding,command="/usr/sbin/uucico -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqZ76dU/vwv4nvmYcRW/4HhJyJDWnI1yv/asY0MFsr1pLDRWZ+YgOs+Ss6KH3nxOF4yGJd1ODO2Sru2zzjdljegl00/wJ/HTAO2HI5HLPJzH5uRXk+M48YtbKPJFE3da87xRmySsaWJgwjDQhLGozfbDiiOe6ZeIgxfByrCfMKkRklkKhkBgbFalqEb5awFeVT7893qd6FQ5CZksHoBIrK8o4eN7TeDSCwx4Z4+xJEBNQQVU50ThEaDxCWdnzE2AZZGX0MbN3IM6VmWW4lBu/cxrx9o6Dkyap5iEd8orx+ddGcKA1rDaplvBhlXynEuotmlWs7UgR1Yv5FSMjOb6AH uucp@hadrian
no-port-forwarding,no-X11-forwarding,command="/usr/sbin/uucico -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDp1sXCxtJ0ed240fNsqsrhXoZskKiEWTSnRPrvCpM+HByUJ4XvBy/L0LJNe1nWXg70N8tYZZTKfUsnrtWEEp8V/7/UalBSIUeSM/nf+TG9cYjBZepYwvrk4s7lsj6XD7Q5GtN3Iv1wBKwElRuuAJ8boajqa7zsjcW+miUTXbf1y/fpUomHhRdU3pnbGMe/vAUR82ex93/LQx66AbZVqyCvDDHFmLaWFZLkMaJ2aSQ0mK5g5OMuzU4P4tGkExTkh8XaIi5tABEF9eieAJC7WDt3XIN7KYott3lL8jh5x5qMQoK4lXMYIrd9ZS2KjHI27CgWfNcqRn6yXpgIebXLVMZ9 uucp@tilde.center
restrict,command="/usr/sbin/uucico -u Uteam -l" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBaPW5orOACAl5GdTtn7CYDH+aAyCqOSsf/QHdH3WFST uucp@tilde
restrict,command="/usr/sbin/uucico -u Uvoyage -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCENRbdhPRoI1c0dcQM8bqcpeEpq4dck8pRsGXRMCkwJBPMWk861nlx8H4hZsU7rpJAcgHGX3JwxEPEOGCC2vB4vv46K5eeiVkp5EmDH67K/9TjSzuX0qT+y6tECuXjB2dn3NQJpp0zh681hCszcjy8WxA4+a71HVfQPX2xE4Y6MCz7fTYaumXs9hpetVAgonzlP7W1h6zft+jAsrGDo8FrwAOCubw6/Ra1uAE5Ar3Gl8lLFe/eijjbjI2Y/MCZN3dacfqKH75MwY5E+3e7sRxrUaRtJ2sSiKmL+GqMEa916fxsJGlCu3tvVeUjsq3QEo/MI417l9tghOpOoSFaKNv uucp@cosmic.voyage
restrict,command="/usr/sbin/uucico -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqZ76dU/vwv4nvmYcRW/4HhJyJDWnI1yv/asY0MFsr1pLDRWZ+YgOs+Ss6KH3nxOF4yGJd1ODO2Sru2zzjdljegl00/wJ/HTAO2HI5HLPJzH5uRXk+M48YtbKPJFE3da87xRmySsaWJgwjDQhLGozfbDiiOe6ZeIgxfByrCfMKkRklkKhkBgbFalqEb5awFeVT7893qd6FQ5CZksHoBIrK8o4eN7TeDSCwx4Z4+xJEBNQQVU50ThEaDxCWdnzE2AZZGX0MbN3IM6VmWW4lBu/cxrx9o6Dkyap5iEd8orx+ddGcKA1rDaplvBhlXynEuotmlWs7UgR1Yv5FSMjOb6AH uucp@hadrian
restrict,command="/usr/sbin/uucico -u Uinstitute -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDAvleeZgYvqi4RrjEj7EwTZEJ3NMYnL+cF3nL/6oTzOQe7n9Yy8Usj4dmrMnxOgtqKJHR0qgPDEk0bzreys1UBsw8vHYTNqdrORa9J+hHiuxNL8GmB+aAKZrvzyfWi5YK/ON2sG0wfLaQM3/RYGGUli0wgoDwcUgGsuMwboUIfTRQ+a3jjfQdaw2JbKIH6hUlgKMe/eWJAGzo3GEWJ5t2NHILJFCCeBeXsbsOwTEYM6xt5BqOCMuTu5xadLFMfSttWcmGvF615G0rhy6jTpLkFvgboBXkmh1H8QNrvnTFF+MCBn5v+YQ7U6/ynebDMKxgpMHC1gvazCt1B6UgM7dIIOg7YcK7ZMDed10Sq2qVkZdDbncLizTkK78kmYqSrATj4T5mxi90mFD41XxC0p/lrW5CyDucGYYLWP6tGVbgEUE4MPO0ZV+p8i2QQS1FfD5VAa0b+v4Os5VEayL0HO1Wq6X55jTOd8MYGJ6+fWQRwvDIdyKVe7afz1hQ6CpPBYT3/603b6L8K3A8/MJDjeA1eu47LWsKE6hSr0859TiIxPVsBeDRBucEAX6Lz2p2gVg8kBbU9EhSe/O56NT1DezRlaDNT+R2/ALNoSeWkVoQ5u2FIv8FW1QeI1KvTaRUs1+/+mfthG7Hc0x5CEjTiBLAosyqrwS+5Qtdz7a/k2tWyXQ== uucp@tilde.institute
restrict,command="/usr/sbin/uucico -u Uaussie -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRo+3geI6OcpyEC3XufkKUQ193Y0Y4NR82EnCjojpraCRy9yazzCHzJIz/rhPzpJYiTJ3blNqyTIM3rfMg+mALehnNBJPi5h1tBC0Qv60aLGtsYDHrovIG1YNc9ln/nfAriisIXU+wWh8K0KOiDcvtHuLRZnUbGyDLBP8bp/Lku7bz+N8ucRvSdt5O0vDCv/AVsz9JIP5HBkUcY42PNM1rHAzWddVLJ1msQmyMnib6LyKJ5RAJJbSER6xXFpSDPHfKQsbr5XbPJT4P1KiI54jhwXBZddH4ZRyLiqTz16NYWDrYBeVHsLmFv8vL/j7/dzDyiV8okl+Nknb3aTXrQ1tb uucp@aussie
restrict,command="/usr/sbin/uucico -u Uepfl -l" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKHc5n4OT1n52HbQir3ON0pwtkgTjTNKSlgDziSKhOdT jeff.allen@epfl.ch
restrict,command="/usr/sbin/uucico -u Ufrostbyte -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpJo1XBdJXecYZPkTrfX4MT25GQ3bm5pjrh3w2SV/h2x69zFrV1pB+MAJHpstY6mdK+4YjMZ8t4A3xRwuJT/LZegQf9vi0Bi4lY02an6jpLIoOXxp5xG2jwCYBURy70CBAG8FgRjqs5uUNf1l9skFfKke71p4FU/14LW0vj5K60L8Y/LlVVQCqxr1w790G/HHqFjsrGwN1Jt+nk8IbHr1Mfi5NAqsocbRUfhVsB8M2y+IlBUnxDFtw9LnehPBflESa2iISroDMYpzH1eg+zbrGKutzSUY4PMqwgSNDOTwwA8r+3rtXzf+QFR00y8gr5ZIho2rz2KjbLpzixTJ4W0px uucp@uucp.frostbyte.ccssh-rsa
restrict,command="/usr/sbin/uucico -u Uradiofreqs -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWl41JEIAWQpn2w/ius7CvBh379bCOB1OFljOcZAtOu4NN9RPK3v4qC8aWHm3icqPOZalDPsSTZ9uJ5ox8DZH+tvNtWiJeLPvu6NxyAyePBqlBaxkTC9yaBwgWFceGlqttMilo+ALxi5BleFlQxwOywxV1RdhzaMl0/MxeWBOHtKF6w/bt6v23zR/5l8Q/e6a0HUBwjLv6VL5fFLXB9PrCX/fjgw8v44YVSQP+hCukUO/9WqApTFkvkHf+kHVwJRS5L8DIgZZTEtzTezRbLEqfsdQXPFOePiGj2kvzA307PubVupvSoSjmXNhQ2dASi7s2ubu2E5dKCminVKtokBYL uucp@radiofreqs.space
restrict,command="/usr/sbin/uucico -u Ucaconym -l" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqX+riAKAJnoFdlun0kdYSld6rsfh9RHhRPHbgd/CmY0i0HSJoOiDk57fhbvYLZ4QUOruMWBw1vEUFkaFzyxfiu42C7L8xjh9lqzGWI4xhap2e9bIP3lUoMqBrxsaWJk+6/sRoNDNhITZxPEJig2rmEHFU7GO7Z3v+GkshiYTcstFvj3OttQne2cZdNIO5AekqNhUBHv9mUSBnSTUf4t4VOiQP7+/VWYtu9sogzAzgZbY+L6j3hbZCxaLJtKKRJ+8ns+9Zdzb1q55IlKUB/umFQg/Aff25oitEy6MszGV66aEyVBe04CiiWwAH15W3OLpNmkPzZLQBSnBQ4Rd2oIkZ uucp@dgold

View File

@ -1,6 +1,8 @@
#!/bin/bash
set -e
# "Updating Git"
cd $HOME/uucp
git pull --quiet
@ -9,4 +11,7 @@ git pull --quiet
cp ~/uucp/ssh/authorized_keys ~/.ssh/authorized_keys
chmod 644 ~/.ssh/authorized_keys
if [ -f ~/.ssh/authorized_keys.local ]; then
cat ~/.ssh/authorized_keys.local >> ~/.ssh/authorized_keys
fi

178
utils/bootstrap.pl Executable file
View File

@ -0,0 +1,178 @@
#!/usr/bin/perl
#
use warnings;
use strict;
use Digest::MD5 qw(md5_hex);
use Getopt::Std;
my $myNode = "";
my $passwdFile = "passwd";
my $callFile = "call";
my $confFile = "config";
my $sysFile = "sys";
my $portFile = "port";
my %options = ();
sub getNodes {
my $nodelist = "../nodelist";
open(my $data, '<', $nodelist) or die ("Cannot open nodelist");
if ($options{t}) {
print("Truncating existing files\n");
truncate($passwdFile,0);
truncate($callFile,0);
truncate($confFile,0);
truncate($sysFile,0);
truncate($portFile,0);
}
print("Generating files\n");
while (my $line = <$data>) {
chomp $line;
my @fields = split(",", $line);
my $nodeName = $fields[0];
#$nodeName eq $myNode && continue
my $nodeAddress = $fields[1];
my $nodePort = $fields[2];
generatePort($nodeName,$nodeAddress,$nodePort);
generateSys($nodeName);
generateCall($nodeName);
generatePasswd($nodeName);
getKeys($nodeAddress);
print("System ".$nodeName." added successfully\n");
}
generateConfig($myNode);
print("Done\n\n");
}
sub generatePort {
my $nodeName = shift;
my $nodeAddress = shift;
my $nodePort = shift;
my $currentNode = ucfirst($nodeName);
my $template = qq{
port $currentNode
type pipe
command /usr/bin/ssh -a -x -q -i /var/spool/uucp/.ssh/id_rsa -l uucp -p $nodePort $nodeAddress
reliable true
protocol etyig
};
open(FH, '>>', $portFile);
print FH $template;
}
sub generateSys {
my $nodeName = shift;
my $currentNode = ucfirst($nodeName);
my $template = qq{
system $nodeName
call-login *
call-password *
called-login U$nodeName
local-send /
local-receive ~
remote-send ~
remote-receive ~
time any
forward ANY
chat \"\" \\d\\d\\r\\c word: \\d\\P
chat-timeout 60
protocol t
port $currentNode
commands rnews
};
open(FH, '>>', $sysFile);
print FH $template;
}
sub generateConfig {
my $nodeName = shift;
open(FH, '>>',$confFile);
my $nodeConfig = "nodename\t\t".$nodeName."\npubdir\t\t/var/spool/uucppublic\n";
print FH $nodeConfig;
}
sub getKeys {
my $address = shift;
my $cmd = "/usr/bin/ssh-keyscan -H $address >> /var/spool/uucp/.ssh/known_hosts";
system($cmd);
}
sub generateCall{
my $nodeName = shift;
my $password = $nodeName.$myNode;
my $callHash = md5_hex($password);
my $callPasswd = $nodeName."\t"."U".$myNode."\t".$callHash."\n";
open(FH, '>>', $callFile);
print FH $callPasswd;
}
sub generatePasswd {
my $nodeName = shift;
my $password = $myNode.$nodeName;
my $passwdHash = md5_hex($password);
my $authPasswd = "U".$nodeName."\t".$passwdHash."\n";
open(FH, '>>', $passwdFile);
print FH $authPasswd;
}
sub preCheck()
{
print("Updating git repo\n");
chdir("../");
#system("git pull");
print("Installing authorized_keys\n");
#rename("authorized_keys",".ssh/authorized_keys");
chdir("./utils");
print("Pre-flight checks done\n");
getNodes();
}
sub showHelp()
{
print("Usage: bootstrap.pl [OPTION...] node-id\n");
print("Generate uucp configuration files.\n\n");
print(" -t truncate files before appending config\n");
print(" -h display this help and exit\n");
}
getopts("ht", \%options);
if ($ARGV[0]) {
$myNode=$ARGV[0];
} else {
showHelp();
exit;
}
if ($options{h}) {
showHelp();
exit;
}
preCheck();
print("\n\n");
print("This setup script has finished. Please move the generated configuration files as ROOT to /etc/uucp\n");