ECE 440 · Week 8

Modern Computer: Full Stack

One service on the board, one client on the lab network, one saved transcript.

Week 8 of 10 · Solitude

ECE 440 · Week 8 · In class

One service on the board, one client on the lab network, one saved transcript.

ECE 440 · Week 8 · In class

One service on the board, one client on the lab network, one saved transcript. (continued)

ECE 440 · Week 8 · In class

The port number is the number the instructor writes on the board at the start of this lecture.

ECE 440 · Week 8 · Lecture

Why a product's service is not root

ECE 440 · Week 8 · Lecture

A user with no login

sudo useradd --system --no-create-home \
	--shell /usr/sbin/nologin svc-project
id svc-project

ECE 440 · Week 8 · Lecture

Its own unit file

[Unit]
Description=Project network service
After=network-online.target
Wants=network-online.target

[Service]
User=svc-project
Group=svc-project
ExecStart=/usr/local/bin/project-service --port PORT
Restart=on-failure
NoNewPrivileges=yes

[Install]
WantedBy=multi-user.target

Saved as /etc/systemd/system/project.service.

ECE 440 · Week 8 · Lecture

Start it and show who runs it

sudo systemctl daemon-reload
sudo systemctl enable --now project.service
systemctl status project.service
ps -o user,pid,cmd -C project-service
sudo ss -ltnp

ECE 440 · Week 8 · Lecture

When the client cannot connect

Symptom on the lab PCLook at
Connection refusedIs it listening, on which address?
Hangs, then times outRight board address? A firewall?
Connects, then closesjournalctl -u project.service
Service keeps restartingPermissions of the files it opens

ECE 440 · Week 8 · Lab

Lab

  1. Run one service on the board, under its own unit file and as an unprivileged user, that a client on the lab network talks to.
  2. Save the client's transcript, and the process listing that shows the service's user. Second pass: run the client a second time and keep that transcript in your notes, not in the graded page.

ECE 440 · Week 8 · Lab

Lab (continued)

  1. Assemble the lab hand-in: The transcript of a lab-network client talking to the board's service, and the unit file and process listing that show the service runs as an unprivileged user.

ECE 440 · Week 8 · Lab

Hand in

The transcript of a lab-network client talking to the board's service, and the unit file and process listing that show the service runs as an unprivileged user.

ECE 440 · Week 8 · Homework

Homework

ECE 440 · Week 8 · Homework

Turn in

The port number and the client command.

ECE 440 · Week 8 · Read

Read

On the lab site: Module 12, A whole system, does not grade a client transcript from the lab network. This week does.

ECE 440 · Week 8 · Next

Week 9

The checkpoint shows one path on the project image: the power-pull path or the bad-update path.

Arrow keys or space to move, F for full screen, N for speaker notes, Home and End for the first and last slide. Print gives one slide per page.