System Administration HW5 - Mini Private Lab tzute Computer - - PowerPoint PPT Presentation

system administration hw5
SMART_READER_LITE
LIVE PREVIEW

System Administration HW5 - Mini Private Lab tzute Computer - - PowerPoint PPT Presentation

System Administration HW5 - Mini Private Lab tzute Computer Center, CS, NCTU Architecture Overview (1/3) behind account SSH playground storage 2 Computer Center, CS, NCTU Architecture Overview (2/3) Sharing these via YP: behind ypbind


slide-1
SLIDE 1

System Administration HW5

  • Mini Private Lab

tzute

slide-2
SLIDE 2

Computer Center, CS, NCTU

2

account storage

Architecture Overview (1/3)

behind SSH playground

slide-3
SLIDE 3

Computer Center, CS, NCTU

3

Architecture Overview (2/3)

behind account storage NIS Master NIS Slave ypbind ypbind yppush

Sharing these via YP: hosts passwd group netgroup ypservers

playground

slide-4
SLIDE 4

Computer Center, CS, NCTU

4

Architecture Overview (3/3)

behind account storage NFS Server export

Export these mountpoints: /net/home /net/shares /net/datas

playground

slide-5
SLIDE 5

Computer Center, CS, NCTU

5

Requirements (1/7) - Overview

❑ Machines

  • account: NIS Master Server, (NIS/NFSv4 Client)
  • storage: NFS Server, NIS Slave Server, (NIS/NFSv4 Client)
  • playground: NIS/NFSv4 Client

❑ Groups

  • acctadm: can sudo inside "account"
  • storadm: can sudo inside "storage"
  • users: can access /net/shares

❑ Netgroups

  • admins: admin users, can login behind
  • behind: machine "account" and "storage"
  • front: machine "playground"
slide-6
SLIDE 6

Computer Center, CS, NCTU

6

Requirements (2/7) - Overview

❑ Users

  • god

 Group: acctadm, storadm, users  Netgroup: admins

  • <student-id-A>

 Group: acctadm, users  Netgroup: admins

  • <student-id-B>

 Group: storadm, users  Netgroup: admins

  • user

 Group: users

slide-7
SLIDE 7

Computer Center, CS, NCTU

7

Requirements (3/7) - Account

❑ NFSv4

  • storage:/net/home (maproot=nobody)
  • storage:/net/shares (all_squash, anonuid=user, anongid=users)
  • storage:/net/datas (rw)

❑ NIS

  • Bind priority: account > storage

❑ login

  • ssh from playground only
  • ssh by admins only
  • sudo with acctadm only
slide-8
SLIDE 8

Computer Center, CS, NCTU

8

Requirements (4/7) - Storage

❑ NFSv4

  • exports

 /net/home  /net/shares  /net/datas

❑ NIS

  • Bind priority: storage > account
  • Slave of account

❑ login

  • ssh from playground only
  • ssh by admins only
  • sudo with storadm only
slide-9
SLIDE 9

Computer Center, CS, NCTU

9

Requirements (5/7) - Playground

❑ NFSv4

  • storage:/net/home (maproot=nobody)
  • storage:/net/shares (all_squash, anonuid=user, anongid=users)
  • storage:/net/datas (ro)

❑ NIS

  • Bind priority: storage > account

❑ login

  • ALL
slide-10
SLIDE 10

Computer Center, CS, NCTU

10

Requirement (6/7)

❑ All machines share /net/datas/sudoers ❑ All user's home directory must be in /net/home except root ❑ Auto-start all services ❑ Auto-mount all folders with autofs

slide-11
SLIDE 11

Computer Center, CS, NCTU

11

Requirement (7/7)

❑ NFSv4 with nfsuserd for mapping uid and username ❑ /etc/exports must be NFSv4 format ❑ User can change password on NIS Clients ❑ NIS share file must be in /var/yp/src

  • configure /var/yp/Makefile
slide-12
SLIDE 12

Computer Center, CS, NCTU

12

Single Player Team

❑ If you are in a single player team, here are some boost for you

  • Combine account and storage as machine named "pro"
  • Make playground as NIS Slave like the original storage
slide-13
SLIDE 13

Computer Center, CS, NCTU

13

pro

Architecture Overview (1/3)

behind SSH with admins SSH playground

slide-14
SLIDE 14

Computer Center, CS, NCTU

14

Architecture Overview (2/3)

behind NIS Master NIS Slave ypbind ypbind yppush

Sharing these via YP: hosts passwd group netgroup ypservers autofs.map

playground pro

slide-15
SLIDE 15

Computer Center, CS, NCTU

15

Architecture Overview (3/3)

behind export

Export these mountpoints: /net/home /net/shares /net/datas

playground pro NFS Server

slide-16
SLIDE 16

Computer Center, CS, NCTU

16

Step 1 - Setup NIS Master Server

❑Edit /etc/rc.conf

  • nis_server, nisdomainname, yppasswdd

❑Edit /var/yp/Makefile

  • #NOPUSH = "True"
  • $(YPSRCDIR) = < to be modified >
  • TARGETS = < to be modified >

❑Create /var/yp/src/hosts, /var/yp/src/group…etc

  • Edit /var/yp/src/master.passwd & /var/yp/src/group to create your accounts

❑Initial and start services

  • ypinit
  • service [ ypserv | ypbind | rpcbind ] [ start | restart | stop ]
  • services started order is important!
slide-17
SLIDE 17

Computer Center, CS, NCTU

17

Step 2 - Setup NIS Clients

❑Add NIS Servers’ IP to /etc/hosts ❑Edit /etc/master.passwd & /etc/group

  • vipw
  • vigr

❑Edit /etc/nsswitch.conf

  • hosts : files nis dns

❑Edit /etc/rc.conf

  • nis_client, nis_client_flags, nisdomainname
  • Modify ypbind sequence (on every clients)

❑Testing tools

  • ypcat
  • ypwhich
slide-18
SLIDE 18

Computer Center, CS, NCTU

18

Step 3 - Setup NIS Slave Server

❑Edit /etc/rc.conf

  • nis_server, nisdomainname

❑ Edit /var/yp/ypservers (on cshome)

❑Initial and (re)start services

  • ypinit
slide-19
SLIDE 19

Computer Center, CS, NCTU

19

Step 4 - Setup NFSv4 environment

❑Edit /etc/rc.conf

  • autofs (NFS Client)
  • nfs_server, mountd, nfsv4_server, nfsuserd, nfsuserd_flags (NFS Server)

❑Edit /etc/exports (NFSv4 Server)

  • Must be NFSv4 format

❑Edit autofs.map / amd.map

slide-20
SLIDE 20

Computer Center, CS, NCTU

20

Step 4 - Setup NFSv4 environment (Cont.)

❑Initial and start services

  • service [ rpcbind | nfsd | nfsuserd | mountd ] [ start | restart | stop ]

❑Do something for mapping uid/gid and user/group

  • nfsuserd
slide-21
SLIDE 21

Computer Center, CS, NCTU

21

Step 5 - Finishing

❑sudoers (/usr/local/etc/sudoers)

  • Including other sudoers file from /net/data/sudoers
  • man sudoers to see more about “include”

❑Login permissions

  • only admins (netgroup) can login behind

❑/etc/hosts.allow

  • only can login behind from playground

❑/net/shares

  • Squash all as user:users

❑If you restart rpcbind, all of service based on rpc also need to restart

slide-22
SLIDE 22

Computer Center, CS, NCTU

22

❑ Share autofs.map via yp with automountd

  • yp key map name

 auto_behind for account  auto_front for playground

  • ypcat -k auto_behind
  • auto_master

 +auto_behind

❑ Hint

  • man auto_master

Bonus - Share autofs.map

slide-23
SLIDE 23

Computer Center, CS, NCTU

23

❑ Write a script to create accounts on NIS

  • random password
  • read from <account_info> file only contain username, fullname

➢ e.g. bigwang, Da-Chui Wang

  • define group by args

➢ e.g. ./autocreate users <account-list.txt>

  • user home directory must be created on NFS
  • you can use any language to implement

Bonus - Script to create account

slide-24
SLIDE 24

Computer Center, CS, NCTU

24

❑2019/1/15 ❑You do not need to submit anything

Deadline

slide-25
SLIDE 25

Computer Center, CS, NCTU

25

❑ Service auto start (5%) ❑ SSH limitation (10%)

  • Only can login behind from playground (5%)
  • Only admins can login behind (5%)

❑ Sudo (15%)

  • acctadm can sudo in account (5%)
  • storadm can sudo in storage (5%)
  • Sharing and including /net/datas/sudoers (5%)

❑ NIS (30%)

  • Bind priority (5%)
  • Slave configured (5%)
  • passwd on client (10%)
  • File sharing (10%)

Checklist (1/2)

slide-26
SLIDE 26

Computer Center, CS, NCTU

26

❑ NFS (40%)

  • Export using NFSv4 (5%)
  • Mount storage:/net/home as nobody (5%)
  • Mount storage:/net/shares and squash all as user:users (5%)
  • Mount storage:/net/datas with rw on behind (5%)
  • Mount storage:/net/datas with ro on playground (5%)
  • Auto mount all folders (10%)
  • Mapping uid and username (5%)

❑ Bonus (20%)

  • Sharing autofs.map via yp with automountd (10%)
  • Account creating script (10%)

Checklist (2/2)

slide-27
SLIDE 27

Computer Center, CS, NCTU

27

Help

❑E-mail ta@nasa.cs.nctu.edu.tw ❑New E3 https://e3new.nctu.edu.tw/ ❑Office hour: 3GH at EC320

slide-28
SLIDE 28

Computer Center, CS, NCTU

28

Appendix

❑Virtualbox Network Type Comparison

VM ↔ Host VM1 ↔ VM2 VM → Internet VM ← Internet Host-only + + – – Internal – + – – Bridged + + + + NAT – – + Port forwarding NAT Network – + + Port forwarding