Compare commits

...

4 Commits

Author SHA1 Message Date
h7x4
9c6a812334 WIP: temmie/userweb: use IPC to proxy sendmail requests out of sandbox 2026-05-11 14:03:18 +09:00
h7x4
5e50b617fb temmie/userweb: switch from postfix to nullmailer 2026-05-11 13:52:58 +09:00
h7x4
258c5a7b25 temmie/userweb: set up sendmail wrapper 2026-05-11 12:26:39 +09:00
h7x4
b9eda3dc56 temmie/userweb: reduce package list 2026-05-11 10:17:09 +09:00
3 changed files with 90 additions and 67 deletions

View File

@@ -6,7 +6,7 @@
(fp /base) (fp /base)
./services/nfs-mounts.nix ./services/nfs-mounts.nix
./services/userweb.nix ./services/userweb
]; ];
systemd.network.networks."30-ens18" = values.defaultNetworkConfig // { systemd.network.networks."30-ens18" = values.defaultNetworkConfig // {

View File

@@ -16,8 +16,7 @@ let
mysqlnd mysqlnd
pgsql pgsql
posix posix
protobuf protobuf sqlite3
sqlite3
uuid uuid
xml xml
xsl xsl
@@ -65,6 +64,21 @@ let
ignoreCollisions = true; ignoreCollisions = true;
}; };
sendmailWrapper = pkgs.writeShellApplication {
name = "sendmail";
runtimeInputs = [ ];
text = ''
args=("$@")
if [[ "''${PWD:-}" =~ ^/home/pvv/[^/]+/([^/]+) ]] && [[ "''${BASH_REMATCH[1]}" != "pvv" ]]; then
# Prepend -fusername to the argument list, so bounces go to the user
args=("-f''${BASH_REMATCH[1]}" "''${args[@]}")
fi
exec '${lib.getExe pkgs.system-sendmail}' "''${args[@]}"
'';
};
# https://nixos.org/manual/nixpkgs/stable/#sec-building-environment # https://nixos.org/manual/nixpkgs/stable/#sec-building-environment
fhsEnv = pkgs.buildEnv { fhsEnv = pkgs.buildEnv {
name = "userweb-env"; name = "userweb-env";
@@ -72,6 +86,8 @@ let
paths = with pkgs; [ paths = with pkgs; [
bash bash
sendmailWrapper
perlEnv perlEnv
pythonEnv pythonEnv
phpEnv phpEnv
@@ -80,87 +96,56 @@ let
# composer # composer
]) ])
++ [ ++ [
# Useful packages for homepages
exiftool
gnuplot
ikiwiki-full
imagemagick
jhead
ruby
sbcl
sourceHighlight
# Missing packages from tom
# blosxom
# pyblosxom
# mediawiki (TODO: do people host their own mediawikis in userweb?)
# nanoblogger
# Version control
cvs
rcs
git
# Compression/Archival
bzip2
gnutar
gzip
lz4
unzip
xz
zip
zstd
# Other tools you might expect to find on a normal system
acl acl
aspell
autoconf
autotrash
bazel
bintools
bison
bsd-finger
catdoc
ccache
clang
cmake
coreutils-full coreutils-full
curl curl
devcontainer
diffutils diffutils
emacs
# exiftags
exiftool
ffmpeg
file file
findutils findutils
gawk gawk
gcc
glibc
gnugrep gnugrep
gnumake gnumake
gnupg gnupg
gnuplot
gnused gnused
gnutar
gzip
html-tidy
imagemagick
inetutils
iproute2
jhead
less less
libgcc man
lndir
mailutils
man # TODO: does this one want a mandb instance?
meson
more
mpc
mpi
mplayer
ninja
nix
openssh
openssl
patchelf
pkg-config
ppp
procmail
procps
qemu
rc
rhash
rsync
ruby # TODO: does this one want systemwide packages?
salt
sccache
sourceHighlight
spamassassin
strace
subversion
system-sendmail
systemdMinimal
texliveMedium
tmux
unzip
util-linux util-linux
valgrind
vim vim
wget wget
which which
wine
xdg-utils xdg-utils
zip
zstd
]; ];
extraOutputsToInstall = [ extraOutputsToInstall = [
@@ -170,6 +155,10 @@ let
}; };
in in
{ {
imports = [
./mail.nix
];
services.httpd = { services.httpd = {
enable = true; enable = true;
adminAddr = "drift@pvv.ntnu.no"; adminAddr = "drift@pvv.ntnu.no";

View File

@@ -0,0 +1,34 @@
{ config, lib, pkgs, ... }:
{
services.postfix.enable = lib.mkForce false;
services.nullmailer = {
enable = true;
config = {
me = config.networking.fqdn;
remotes = "mail.pvv.ntnu.no smtp --port=25";
};
};
systemd.sockets.userweb-sendmail-sandbox-proxy = {
wantedBy = [ "sockets.target" ];
listenStreams = [ "/run/userweb-sendmail-sandbox-proxy.sock" ];
socketConfig = {
# Accept = true;
SocketUser = "httpd";
SocketGroup = "httpd"; # TODO: is wwwrun(54) in this group?
SocketMode = "0660";
};
};
systemd.services.userweb-sendmail-sandbox-proxy = {
serviceConfig = {
User = "root";
Group = "root";
Sockets = [
"userweb-sendmail-sandbox-proxy.socket"
];
ExecStart = "${lib.getExe pkgs.hello}";
};
};
}