Commit fabd07a7 authored by Leigh Stoller's avatar Leigh Stoller

Changes for building/installing capture/console on control nodes:

* Makefile changes to build and install nossl versions of capture and
  console on a rack control node (or more generally, a physical node
  hosting boss/ops VMs that are not built on our XEN49 image).

* Add -I (insecure) option to capture, that listens on localhost only.

* Add systemd startup files for capture on ops and boss, I tested these
  on Ubuntu18.

Basic instructions:

* Clone the emulab-devel repo to the control node.

  git clone https://gitlab.flux.utah.edu/emulab/emulab-devel.git

* On the control node, install the libssl devel code:

  sudo apt-get update
  sudo apt-get install libssl-dev

* configure and build capture. Note that the obj-clientside directory might
  already exist, you can just rm -rf the directory.

  control> cd ~elabman
  control> mkdir obj-clientside
  control> cd obj-clientside
  control> /path/to/emulab-devel/clientside/configure
  control> make rack-control
  control> sudo make rack-control-install
  control> (cd os/capture; sudo make rack-control-startup-install)

* start capture.

  control> sudo systemctl daemon-reload
  control> sudo systemctl start capture-boss
  control> sudo systemctl start capture-ops
parent cdcbedc7
......@@ -76,6 +76,16 @@ onie-dongle-install: onie-dongle
$(MAKE) -C os onie-dongle-install
$(MAKE) -C tmcc onie-dongle-install
rack-control:
$(MAKE) -C lib rack-control
$(MAKE) -C os rack-control
$(MAKE) -C tip rack-control
rack-control-install: rack-control
$(MAKE) -C lib rack-control-install
$(MAKE) -C os rack-control-install
$(MAKE) -C tip rack-control-install
destdircheck:
@if [ -z "$(DESTDIR)" ]; then \
echo "You must define DESTDIR for this target!"; \
......
......@@ -57,6 +57,11 @@ onie-dongle:
onie-dongle-install: onie-dongle
rack-control:
$(MAKE) -C libtb client
rack-control-install: rack-control
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
......
......@@ -158,6 +158,12 @@ onie-dongle:
onie-dongle-install:
$(MAKE) -C bootinfo onie-dongle-install
rack-control:
$(MAKE) -C capture rack-control
rack-control-install:
$(MAKE) -C capture rack-control-install
subdir-distclean:
@$(MAKE) -C imagezip distclean
......
......@@ -39,6 +39,7 @@ tipserv-all: capture capture-tty capquery caplogserver caplog caplog.bin
client: capture capture-nossl capquery caplog caplog.bin
control:
subboss: client
rack-control: capture-nossl
include $(TESTBED_SRCDIR)/GNUmakerules
......@@ -110,6 +111,22 @@ real-install: all $(INSTALL_SBINDIR)/capserver $(INSTALL_SBINDIR)/capture
tipserv-install: tipserv-all $(INSTALL_SBINDIR)/capture \
$(INSTALL_SBINDIR)/caplogserver
rack-control-install: rack-control
-mkdir -p /var/log/tiplogs
$(INSTALL_PROGRAM) capture-nossl$(EXE) $(DESTDIR)$(INSTALL_SBINDIR)/capture-nossl$(EXE)
rack-control-startup-install: rack-control-install
if [ -d "/etc/systemd/system" ]; then \
$(MKDIR_P) /etc/systemd/system ; \
$(INSTALL_PROGRAM) $(SRCDIR)/capture-boss.service /etc/systemd/system ; \
$(INSTALL_PROGRAM) $(SRCDIR)/capture-ops.service /etc/systemd/system ; \
$(MKDIR_P) /etc/systemd/system/multi-user.target.wants ; \
ln -sf ../capture-boss.service \
/etc/systemd/system/multi-user.target.wants/capture-boss.service ; \
ln -sf ../capture-ops.service \
/etc/systemd/system/multi-user.target.wants/capture-ops.service ; \
fi
clean:
rm -f *.o capture capture-tty capserver capquery core errs Errs
rm -f caplog caplog.bin caplogserver
......
[Unit]
Description=Emulab console capture process for boss VM
After=network.target network-online.target
[Service]
ExecStart=/usr/local/sbin/capture-nossl -I -i -C -L -T 10 -R 2000 -X boss -l /var/log/tiplogs boss
KillMode=process
Restart=on-failure
Type=forking
PIDFile=/var/log/tiplogs/boss.pid
[Install]
WantedBy=multi-user.target
[Unit]
Description=Emulab console capture process for ops VM
After=network.target network-online.target
[Service]
ExecStart=/usr/local/sbin/capture-nossl -I -i -C -L -T 10 -R 2000 -X ops -l /var/log/tiplogs ops
KillMode=process
Restart=on-failure
Type=forking
PIDFile=/var/log/tiplogs/ops.pid
[Install]
WantedBy=multi-user.target
......@@ -165,6 +165,7 @@ char **programargv;
#define xendomain 0
#define retryinterval 0
#define nomodpath 0
#define insecure 0
#else
char *Bossnode = BOSSNODE;
struct sockaddr_in Bossaddr;
......@@ -178,6 +179,7 @@ int retryinterval = 5000;
int maxretries = 0;
int nomodpath = 0;
int maxfailures = 10;
int insecure = 0;
int failures;
int upportnum = -1, upfd = -1, upfilefd = -1;
char uptmpnam[64];
......@@ -384,7 +386,7 @@ main(int argc, char **argv)
else
Progname = *argv;
while ((op = getopt(argc, argv, "rds:Hb:ip:c:T:aonu:v:PmMLCl:X:R:y:A")) != EOF)
while ((op = getopt(argc, argv, "rds:Hb:ip:c:T:aonu:v:PmMLCl:X:R:y:AI")) != EOF)
switch (op) {
#ifdef USESOCKETS
#ifdef WITHSSL
......@@ -403,6 +405,10 @@ main(int argc, char **argv)
serverport = atoi(optarg);
break;
case 'I':
insecure = 1;
break;
case 'i':
standalone = 1;
break;
......@@ -614,7 +620,12 @@ main(int argc, char **argv)
/* Create wildcard name. */
name.sin_family = AF_INET;
name.sin_addr.s_addr = INADDR_ANY;
if (insecure) {
inet_aton("127.0.0.1", &name.sin_addr);
}
else {
name.sin_addr.s_addr = INADDR_ANY;
}
name.sin_port = 0;
if (bind(sockfd, (struct sockaddr *) &name, sizeof(name)))
die("bind(): binding stream socket: %s", geterr(errno));
......@@ -2799,7 +2810,7 @@ createkey(void)
if ((fp = fdopen(fd, "w")) == NULL)
die("fdopen(%s)", tmpname, geterr(errno));
fprintf(fp, "host: %s\n", ourhostname);
fprintf(fp, "host: %s\n", (insecure ? "localhost" : ourhostname));
fprintf(fp, "port: %d\n", portnum);
if (upportnum > 0) {
fprintf(fp, "uphost: %s\n", inet_ntoa(relayaddr));
......
......@@ -29,6 +29,7 @@ include $(OBJDIR)/Makeconf
all: tip tiptunnel console.bin console console.boss tippty
client: console.bin console
rack-control: console-nossl
include $(TESTBED_SRCDIR)/GNUmakerules
......@@ -77,6 +78,12 @@ console.bin.o: tiptunnel.c $(SRCDIR)/../os/capture/capdecls.h
console.bin: console.bin.o
$(CC) $(CFLAGS) -o console.bin console.bin.o
console-nossl.o: tiptunnel.c $(SRCDIR)/../os/capture/capdecls.h
$(CC) $(CFLAGS) -o console-nossl.o -c $<
console-nossl: console-nossl.o
$(CC) $(CFLAGS) -o console-nossl console-nossl.o
tippty.o: tiptunnel.c $(SRCDIR)/../os/capture/capdecls.h
$(CC) $(CFLAGS) -DTIPPTY -o $@ -c $<
......@@ -103,6 +110,8 @@ install: all $(INSTALL_BINDIR)/tip \
boss-install: install
rack-control-install: $(INSTALL_BINDIR)/console-nossl
# Tip not installed in these targets.
subboss:
subboss-install:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment