aboutsummaryrefslogtreecommitdiff
path: root/rcynic
diff options
context:
space:
mode:
Diffstat (limited to 'rcynic')
-rw-r--r--rcynic/Makefile.in9
-rw-r--r--rcynic/rules.darwin.mk35
-rw-r--r--rcynic/rules.freebsd.mk24
-rw-r--r--rcynic/rules.linux.mk26
4 files changed, 90 insertions, 4 deletions
diff --git a/rcynic/Makefile.in b/rcynic/Makefile.in
index 709dbb58..e3b45036 100644
--- a/rcynic/Makefile.in
+++ b/rcynic/Makefile.in
@@ -54,11 +54,15 @@ RCYNIC_CONF_DATA = @RCYNIC_CONF_DATA@
RCYNIC_CONF_TA_DIR = @RCYNIC_CONF_TA_DIR@
RCYNIC_USER = rcynic
RCYNIC_GROUP = rcynic
-NOBODY_USER = nobody
+RPKIRTR_USER = rpkirtr
RCYNIC_GECOS = RPKI Validation System
RCYNIC_STATIC_RSYNC = @RCYNIC_STATIC_RSYNC@
RCYNIC_HTML_DIR = @RCYNIC_HTML_DIR@
RCYNIC_CRON_USER = @RCYNIC_CRON_USER@
+RPKIRTR_USER = rpkirtr
+RPKIRTR_GROUP = rpkirtr
+RPKIRTR_GECOS = RPKI router server
+RPKIRTR_MODE = 775
SCRIPTS = rcynic-text rcynic-html rcynic-svn validation_status rcynic-cron
@@ -155,7 +159,8 @@ ${RCYNIC_DIRS} ${DESTDIR}${bindir} ${DESTDIR}${sysconfdir}:
install-directory-ownership: ${RCYNIC_DATA_DIR} ${RCYNIC_RPKI_RTR_DIR}
chown ${RCYNIC_USER}:${RCYNIC_GROUP} ${RCYNIC_DATA_DIR} ${RCYNIC_RPKI_RTR_DIR}
- chown ${NOBODY_USER}:${RCYNIC_GROUP} ${RCYNIC_RPKI_RTR_DIR}/sockets
+ chown ${RPKIRTR_USER}:${RCYNIC_GROUP} ${RCYNIC_RPKI_RTR_DIR}/sockets
+ chmod ${RPKIRTR_MODE} ${RCYNIC_RPKI_RTR_DIR}/sockets
install-rcynic-conf: ${RCYNIC_CONF_FILE}
diff --git a/rcynic/rules.darwin.mk b/rcynic/rules.darwin.mk
index 998b5f54..d37b0e75 100644
--- a/rcynic/rules.darwin.mk
+++ b/rcynic/rules.darwin.mk
@@ -36,6 +36,41 @@ install-user-and-group: .FORCE
echo "Please create it, then try again."; \
exit 1; \
fi
+ @if /usr/bin/dscl . -read "/Groups/${RPKIRTR_GROUP}" >/dev/null 2>&1; \
+ then \
+ echo "You already have a group \"${RPKIRTR_GROUP}\", so I will use it."; \
+ elif gid="$$(/usr/bin/dscl . -list /Groups PrimaryGroupID | /usr/bin/awk 'BEGIN {gid = 501} $$2 >= gid {gid = 1 + $$2} END {print gid}')" && \
+ /usr/bin/dscl . -create "/Groups/${RPKIRTR_GROUP}" && \
+ /usr/bin/dscl . -create "/Groups/${RPKIRTR_GROUP}" RealName "${RPKIRTR_GECOS}" && \
+ /usr/bin/dscl . -create "/Groups/${RPKIRTR_GROUP}" PrimaryGroupID "$$gid" && \
+ /usr/bin/dscl . -create "/Groups/${RPKIRTR_GROUP}" GeneratedUID "$$(/usr/bin/uuidgen)" && \
+ /usr/bin/dscl . -create "/Groups/${RPKIRTR_GROUP}" Password "*"; \
+ then \
+ echo "Added group \"${RPKIRTR_GROUP}\"."; \
+ else \
+ echo "Adding group \"${RPKIRTR_GROUP}\" failed..."; \
+ echo "Please create it, then try again."; \
+ exit 1; \
+ fi; \
+ if /usr/bin/dscl . -read "/Users/${RPKIRTR_USER}" >/dev/null 2>&1; \
+ then \
+ echo "You already have a user \"${RPKIRTR_USER}\", so I will use it."; \
+ elif uid="$$(/usr/bin/dscl . -list /Users UniqueID | /usr/bin/awk 'BEGIN {uid = 501} $$2 >= uid {uid = 1 + $$2} END {print uid}')" && \
+ /usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" && \
+ /usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" UserShell "/usr/bin/false" && \
+ /usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" RealName "${RPKIRTR_GECOS}" && \
+ /usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" UniqueID "$$uid" && \
+ /usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" PrimaryGroupID "$$gid" && \
+ /usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" NFSHomeDirectory "/var/empty" && \
+ /usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" GeneratedUID "$$(/usr/bin/uuidgen)" && \
+ /usr/bin/dscl . -create "/Users/${RPKIRTR_USER}" Password "*"; \
+ then \
+ echo "Added user \"${RPKIRTR_USER}\"."; \
+ else \
+ echo "Adding user \"${RPKIRTR_USER}\" failed..."; \
+ echo "Please create it, then try again."; \
+ exit 1; \
+ fi
install-shared-libraries: .FORCE
diff --git a/rcynic/rules.freebsd.mk b/rcynic/rules.freebsd.mk
index f5391ce8..5233386e 100644
--- a/rcynic/rules.freebsd.mk
+++ b/rcynic/rules.freebsd.mk
@@ -12,10 +12,21 @@ install-user-and-group: .FORCE
echo "Please create it, then try again."; \
exit 1; \
fi
+ @if /usr/sbin/pw groupshow "${RPKIRTR_GROUP}" 2>/dev/null; \
+ then \
+ echo "You already have a group \"${RPKIRTR_GROUP}\", so I will use it."; \
+ elif /usr/sbin/pw groupadd ${RPKIRTR_GROUP}; \
+ then \
+ echo "Added group \"${RPKIRTR_GROUP}\"."; \
+ else \
+ echo "Adding group \"${RPKIRTR_GROUP}\" failed..."; \
+ echo "Please create it, then try again."; \
+ exit 1; \
+ fi
@if /usr/sbin/pw usershow "${RCYNIC_USER}" 2>/dev/null; \
then \
echo "You already have a user \"${RCYNIC_USER}\", so I will use it."; \
- elif /usr/sbin/pw useradd ${RCYNIC_USER} -g ${RCYNIC_GROUP} -h - -d /nonexistant -s /usr/sbin/nologin -c "${RCYNIC_GECOS}"; \
+ elif /usr/sbin/pw useradd ${RCYNIC_USER} -g ${RCYNIC_GROUP} -h - -d /nonexistant -s /usr/sbin/nologin -c "${RCYNIC_GECOS}" -G "${RPKIRTR_GROUP}"; \
then \
echo "Added user \"${RCYNIC_USER}\"."; \
else \
@@ -23,6 +34,17 @@ install-user-and-group: .FORCE
echo "Please create it, then try again."; \
exit 1; \
fi
+ @if /usr/sbin/pw usershow "${RPKIRTR_USER}" 2>/dev/null; \
+ then \
+ echo "You already have a user \"${RPKIRTR_USER}\", so I will use it."; \
+ elif /usr/sbin/pw useradd ${RPKIRTR_USER} -g ${RPKIRTR_GROUP} -h - -d /nonexistant -s /usr/sbin/nologin -c "${RPKIRTR_GECOS}"; \
+ then \
+ echo "Added user \"${RPKIRTR_USER}\"."; \
+ else \
+ echo "Adding user \"${RPKIRTR_USER}\" failed..."; \
+ echo "Please create it, then try again."; \
+ exit 1; \
+ fi
# We use static compilation on FreeBSD, so no need for shared libraries
diff --git a/rcynic/rules.linux.mk b/rcynic/rules.linux.mk
index 84275361..6a962cef 100644
--- a/rcynic/rules.linux.mk
+++ b/rcynic/rules.linux.mk
@@ -25,7 +25,31 @@ install-user-and-group: .FORCE
echo "Please create it, then try again."; \
exit 1; \
fi
-
+ @if getent group ${RPKIRTR_GROUP} >/dev/null; \
+ then \
+ echo "You already have a group \"${RPKIRTR_GROUP}\", so I will use it."; \
+ elif /usr/sbin/groupadd ${RPKIRTR_GROUP}; \
+ then \
+ echo "Added group \"${RPKIRTR_GROUP}\"."; \
+ else \
+ echo "Adding group \"${RPKIRTR_GROUP}\" failed..."; \
+ echo "Please create it, then try again."; \
+ exit 1; \
+ fi
+ @nogroup='-N'; \
+ if test -f /etc/redhat-release; then read vendor release version < /etc/redhat-release; if test $$vendor = CentOS; then nogroup='-n'; fi; fi; \
+ if getent passwd ${RPKIRTR_USER} >/dev/null; \
+ then \
+ echo "You already have a user \"${RPKIRTR_USER}\", so I will use it."; \
+ elif /usr/sbin/useradd -g ${RPKIRTR_GROUP} -M $$nogroup -d "${RPKIRTR_DIR}" -s /sbin/nologin -c "${RPKIRTR_GECOS}" ${RPKIRTR_USER}; \
+ then \
+ echo "Added user \"${RPKIRTR_USER}\"."; \
+ else \
+ echo "Adding user \"${RPKIRTR_USER}\" failed..."; \
+ echo "Please create it, then try again."; \
+ exit 1; \
+ fi
+ usermod -a -G ${RPKIRTR_GROUP} ${RCYNIC_USER}
install-shared-libraries: .FORCE
@echo "Copying required shared libraries"