Difference between revisions of "Infrastructure:Sysadmin Handbook"

From the Linux and Unix Users Group at Virginia Teck Wiki
Jump to: navigation, search
(gitolite -> gitea)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
This page describes how to manage the infra. See [https://vtluug.github.io/rtfm.txt rtfm.txt] for a guide to build it from scratch.
 
This page describes how to manage the infra. See [https://vtluug.github.io/rtfm.txt rtfm.txt] for a guide to build it from scratch.
  
This is NOT up to date as of 2019.
+
This covers setup of a VM on [[Infrastructure:Meltdown|meltdown]] or [[Infrastructure:Spectre|spectre]] depending on if the service is critical or not.
  
This covers setup of a Debian 9 VM on cyberdelia. This is current as of 2017-08-19.
+
== Networks ==
 +
''Further information: [[Infrastructure:Network|Network]]
  
== Networks ==
 
 
We ''should'' have the following networks in place:
 
We ''should'' have the following networks in place:
  
* Cyberdelia br0 on eth4 <--> eth1 on temp88191. This is the main LUUG network.
+
* [[Infrastructure:Meltdown|meltdown]] and [[Infrastructure:Spectre|spectre]] br0 on eno1 <--> enp4s0 on [[Infrastructure:Joey|joey]]. This is the main LUUG network.
** 10.0.0.1/22 for VTLUUG NAT (echarlie thinks we should only use a /24)
+
** 10.98.0.0/16 for VTLUUG NAT
** IPv6 via NDP proxying (static hosts configured in /root/scripts/router/ipv6/setup_ipv6.sh, but things should work without)
+
** IPv6 via prefix delegation on 607:b400:6:cc80/64
** Global IPv4s via ARP proxying (edit /root/scripts/router/ipv4/Nat and edit $Inside_Hosts). Gateway is 128.173.88.1/22.
+
** Global IPv4s via ARP proxying (See https://github.com/vtluug/scripts). Gateway is 128.173.88.1/22.
* Internal VM network (10.99.0.1/24). This is useful for sharing NFS insecurely, but be aware it only works on cyberdelia. If we get more VM hosts, they won't be able to use it without network reconfiguration. Several hosts also use this for LDAP
+
* Static hosts are on 10.98.0.0/24, and DHCP is enabled on 10.98.1.0/24. This is mainly just useful for organization and quickly finding new hosts or other hosts on the network.
* "Internet" (a CNS portal) <--> eth0 on temp88191. LUUG only has one of these, and port security is probably enabled.
+
** Static host IPs are assigned via static DHCP leases for IPv4.
 +
** Since we can't do this with IPv6, physical host IPs are determined upon first boot and VMs are assigned a specific MAC to pre-determine the SLAAC IP.
 +
* "Internet" (a CNS portal) <--> enp2s0 on [[Infrastructure:Joey|joey]]. LUUG only has one of these, and port security is probably enabled.
 +
 
 +
'''DNS/DHCP:'''
 +
* All DNS entries for services run by VTLUUG are hosted on [https://gandi.net Gandi]. Ask an officer if you want to change something.
 +
* jkh and Roddy own ece.vt.edu. DNS updates don't happen. echarlie can add IPv6-only records if needed to wuvt.vt.edu so we have PTRs.
 +
* [[Infrastructure:Joey|joey]] runs DHCP via dnsmasq on enp4s0 (that is, 10.98.0.0/16). To change anything, modify it on https://github.com/vtluug/scripts first then pull that into root's homedir on [[Infrastructure:Joey|joey]]. Please don't just update it on a machine without pushing your updates.
 +
* By default, hosts are accessible via SSH on ports 22 and 2222.
  
Most of our hosts consist of a "LUUG network" eth0 as the default route and an internal network for eth1.
+
== Adding a VTLUUG Service VM ==
 +
''VMs in this category are deployed to [[Infrastructure:Meltdown|meltdown]]''
  
DNS/DHCP:
+
Prerequisites:
* I think echarlie manages vtluug.org DNS? (It's on namecheap. we should unfuck this)
+
* Clone <code>https://github.com/vtluug/scripts</code>. This is referred to as 'SCRIPTS' in this guide.
* jkh and Roddy own ece.vt.edu. DNS updates don't happen. echarlie can add IPv6-only records if needed to wuvt.vt.edu so we have PTRs.
+
* Clone <code>https://github.com/vtluug/ansible</code> and install ansible. This repo is referred to as 'ANSIBLE' in this guide.
* temp88191 runs DHCP and dnsmasq on eth1 (that is, 10.0.0.1/22). Edit /etc/dnsmasq.conf, add your static entries, and restart dnsmasq.
+
* Have access to [https://git.vtluug.org/officers/vtluug-admin officers/vtluug-admin] on [https://git.vtluug.org gitea].
 +
* Understand the [[Infrastructure:Network|Network]] and [[Infrastructure]].
 +
* Put your SSH key on [[Infrastructure:Meltdown|meltdown]]
 +
 
 +
=== Configure the network ===
 +
* Decide on a MAC address for the host and add it to <code>SCRIPTS/router/lan/local_hosts</code>
 +
* Add an entry to <code>SCRIPTS/router/lan/dnsmasq.conf</code> for static DHCP leases.
 +
* If a new IP in 128.173.88.1/22 is being added, also add it to <code>SCRIPTS/router/proxy/arp_proxy.sh</code>
 +
 
 +
'''Note:''' It is '''not''' recommended that you do the following steps if nobody is on campus in case something breaks.
 +
 
 +
Pull the latest changes to <code>/root/scripts</code>, update the configuration files, and restart the services:
 +
* Dnsmasq configuration is at <code>/etc/dnsmasq.conf</code>
 +
* ARP Proxy configuration is in <code>/usr/local/bin</code>
 +
 
 +
=== Add the VM configuration to ansible ===
 +
Edit <code>ANSIBLE_PATH/roles/deploy-vms/defaults/main.yml</code> and add a new entry, following the existing format.
 +
 
 +
'''Note:''' if there are any entries in this file that are '''not''' present on the VM host, they will also be created. Comment out entries that shouldn't be created. Existing hosts are skipped.
 +
 
 +
Run <code>ansible-playbook -v deploy.yml -i hosts.cfg -u papatux -k -K -e @VTLUUG_ADMIN_REPO/accounts.yml</code>, using the correct vtluug-admin repo path.
 +
 
 +
=== Testing ===
 +
The new host should be accessible by papatux on via SSH port 2222 (and 22) over IPv6 and IPv4 from the internal network. Check 10.98.1.0/24 to see if it had any issues getting a static DHCP lease and if the MAC is correct.
 +
 
 +
== Adding a User VM ==
 +
''VMs in this category are deployed to [[Infrastructure:Spectre|spectre]]''
  
== Auth ==
+
Prerequisites:
* <code>apt-get -y install sssd-ldap nscd</code>
+
* Clone <code>https://github.com/vtluug/scripts</code>. This is referred to as 'SCRIPTS' in this guide.
* <code>vim /etc/sssd/sssd.conf</code>
+
* Clone <code>https://github.com/vtluug/ansible</code> and install ansible. This repo is referred to as 'ANSIBLE' in this guide.
<pre>
+
* Understand the [[Infrastructure:Network|Network]] and [[Infrastructure]].
[sssd]
+
* Have root on [[Infrastructure:Spectre|spectre]]
config_file_version = 2
+
* Put your SSH key on [[Infrastructure:Spectre|spectre]]
services = nss, pam
 
domains = LDAP
 
debug_level = 5
 
  
[nss]
+
=== Configure the network ===
filter_users = root,ldap,named,avahi,haldaemon,dbus,radiusd,news,nscd
+
* Decide on a MAC address for the host and add it to <code>SCRIPTS/router/lan/local_hosts</code>
homedir_substring = /home
+
* Add an entry to <code>SCRIPTS/router/lan/dnsmasq.conf</code> for static DHCP leases. (If applicable; you might not care for a test/temp VM).
  
[domain/LDAP]
+
'''Note:''' It is '''not''' recommended that you do the following steps if nobody is on campus in case something breaks.
id_provider = ldap
 
auth_provider = ldap
 
ldap_search_base = dc=vtluug,dc=org
 
ldap_tls_reqcert = allow
 
ldap_uri = ldaps://razor.vtluug.org
 
</pre>
 
  
== Storage ==
+
Pull the latest changes to <code>/root/scripts</code>, update the configuration files, and restart the services:
* <code>apt-get -y install nfs-common</code>
+
* Dnsmasq configuration is at <code>/etc/dnsmasq.conf</code>
* <code>vim /etc/idmap.conf</code>
 
<pre>
 
[General]
 
  
Verbosity = 0
+
=== Add the VM configuration to ansible ===
Pipefs-Directory = /run/rpc_pipefs
+
Edit <code>ANSIBLE_PATH/roles/deploy-vms/defaults/main.yml</code> and add a new entry under <code>new_vms_spectre</code>, following the existing format.
# set your own domain here, if it differs from FQDN minus hostname
 
# Domain = localdomain
 
Domain = vtluug.org
 
  
[Mapping]
+
'''Note:''' if there are any entries in this file that are '''not''' present on the VM host, they will also be created. Comment out entries that shouldn't be created. Existing hosts are skipped.
  
Nobody-User = nobody
+
Run <code>ansible-playbook -v deploy.yml -i hosts.cfg -u papatux -k -K</code>, using the correct vtluug-admin repo path.
Nobody-Group = nogroup
 
</pre>
 
* <code>vim /etc/fstab</code>
 
<pre>
 
10.99.0.1:/tank/nfs/home /home nfs soft,auto,nodev 0 0
 
10.99.0.1:/tank/nfs/share /tank/nfs/share nfs soft,auto,nodev,nosuid 0 0
 
10.99.0.1:/tank/nfs/scratch /tank/nfs/scratch nfs soft,auto,nodev,nosuid 0 0
 
10.99.0.1:/tank/nfs/files /tank/nfs/files nfs soft,auto,nodev,nosuid 0 0
 
</pre>
 
* <code>mkdir -p /tank/nfs/{share,scratch,files}</code>
 
* <code>systemctl restart sssd</code>
 
* <code>mount -a</code>
 
  
== Testing ==
+
'''Important:''' A random root password is set during VM creation and printed to stdout. Record this!
To verify that this worked: <code>su</code> to your user, <code>cd</code>, and you should be able to modify your files.
 
  
 +
=== Testing ===
 +
The new host should be accessible by root on via SSH port 2222 (and 22) over IPv6 and IPv4 from the internal network. Check 10.98.1.0/24 to see if it had any issues getting a static DHCP lease and if the MAC is correct.
  
 
[[Category:Infrastructure]]
 
[[Category:Infrastructure]]
 
[[Category:Howtos]]
 
[[Category:Howtos]]
[[Category:Needs Restoration]]
+
[[Category:Needs restoration]]

Latest revision as of 08:36, 26 October 2024

This page describes how to manage the infra. See rtfm.txt for a guide to build it from scratch.

This covers setup of a VM on meltdown or spectre depending on if the service is critical or not.

Networks

Further information: Network

We should have the following networks in place:

  • meltdown and spectre br0 on eno1 <--> enp4s0 on joey. This is the main LUUG network.
    • 10.98.0.0/16 for VTLUUG NAT
    • IPv6 via prefix delegation on 607:b400:6:cc80/64
    • Global IPv4s via ARP proxying (See https://github.com/vtluug/scripts). Gateway is 128.173.88.1/22.
  • Static hosts are on 10.98.0.0/24, and DHCP is enabled on 10.98.1.0/24. This is mainly just useful for organization and quickly finding new hosts or other hosts on the network.
    • Static host IPs are assigned via static DHCP leases for IPv4.
    • Since we can't do this with IPv6, physical host IPs are determined upon first boot and VMs are assigned a specific MAC to pre-determine the SLAAC IP.
  • "Internet" (a CNS portal) <--> enp2s0 on joey. LUUG only has one of these, and port security is probably enabled.

DNS/DHCP:

  • All DNS entries for services run by VTLUUG are hosted on Gandi. Ask an officer if you want to change something.
  • jkh and Roddy own ece.vt.edu. DNS updates don't happen. echarlie can add IPv6-only records if needed to wuvt.vt.edu so we have PTRs.
  • joey runs DHCP via dnsmasq on enp4s0 (that is, 10.98.0.0/16). To change anything, modify it on https://github.com/vtluug/scripts first then pull that into root's homedir on joey. Please don't just update it on a machine without pushing your updates.
  • By default, hosts are accessible via SSH on ports 22 and 2222.

Adding a VTLUUG Service VM

VMs in this category are deployed to meltdown

Prerequisites:

Configure the network

  • Decide on a MAC address for the host and add it to SCRIPTS/router/lan/local_hosts
  • Add an entry to SCRIPTS/router/lan/dnsmasq.conf for static DHCP leases.
  • If a new IP in 128.173.88.1/22 is being added, also add it to SCRIPTS/router/proxy/arp_proxy.sh

Note: It is not recommended that you do the following steps if nobody is on campus in case something breaks.

Pull the latest changes to /root/scripts, update the configuration files, and restart the services:

  • Dnsmasq configuration is at /etc/dnsmasq.conf
  • ARP Proxy configuration is in /usr/local/bin

Add the VM configuration to ansible

Edit ANSIBLE_PATH/roles/deploy-vms/defaults/main.yml and add a new entry, following the existing format.

Note: if there are any entries in this file that are not present on the VM host, they will also be created. Comment out entries that shouldn't be created. Existing hosts are skipped.

Run ansible-playbook -v deploy.yml -i hosts.cfg -u papatux -k -K -e @VTLUUG_ADMIN_REPO/accounts.yml, using the correct vtluug-admin repo path.

Testing

The new host should be accessible by papatux on via SSH port 2222 (and 22) over IPv6 and IPv4 from the internal network. Check 10.98.1.0/24 to see if it had any issues getting a static DHCP lease and if the MAC is correct.

Adding a User VM

VMs in this category are deployed to spectre

Prerequisites:

Configure the network

  • Decide on a MAC address for the host and add it to SCRIPTS/router/lan/local_hosts
  • Add an entry to SCRIPTS/router/lan/dnsmasq.conf for static DHCP leases. (If applicable; you might not care for a test/temp VM).

Note: It is not recommended that you do the following steps if nobody is on campus in case something breaks.

Pull the latest changes to /root/scripts, update the configuration files, and restart the services:

  • Dnsmasq configuration is at /etc/dnsmasq.conf

Add the VM configuration to ansible

Edit ANSIBLE_PATH/roles/deploy-vms/defaults/main.yml and add a new entry under new_vms_spectre, following the existing format.

Note: if there are any entries in this file that are not present on the VM host, they will also be created. Comment out entries that shouldn't be created. Existing hosts are skipped.

Run ansible-playbook -v deploy.yml -i hosts.cfg -u papatux -k -K, using the correct vtluug-admin repo path.

Important: A random root password is set during VM creation and printed to stdout. Record this!

Testing

The new host should be accessible by root on via SSH port 2222 (and 22) over IPv6 and IPv4 from the internal network. Check 10.98.1.0/24 to see if it had any issues getting a static DHCP lease and if the MAC is correct.