/dev/null ; printf %d $?'"); if ($ret == 0) { $ssh = $_POST['ssh']; } else { $ssh_err = "Not a valid SSH public key"; } unset($ret); } else { $ssh_err = "Public key is required"; } if (!empty($_POST['joinreason'])) { $reason = $_POST['joinreason']; } else { $reason_err = "Join reason is required"; } if (empty($username_err . $password0_err . $password1_err . $email_err . $ssh_err . $reason_err)) $success = true; } if (!$success) { ?>

Sign Up

* Required field
">

Username: *

Password: *

Password: *

E-mail *

SSH public keys (newline separated) *

Why do you want to join? *

What services do you want? (You can always request an account on one later)









By signing up, you agree to the ~vern rules and privacy policy. Thanks for using ~vern.

You also accept that the service may or may not suffer from occassional outages and that information or data stored within the service may or may not be lost during the outage. You are responsible for anything that you store within the services. ~vern PROVIDES SERVICES "AS IS" AND GUARANTEES NO WARRANTY TO THE EXTENT PERMITTED BY APPLICABLE LAW, INCLUDING BUT NOT LIMITED TO THE WARRANTS OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE RESPONSIBLE FOR ANYTHING YOU DO WITHIN ~vern.

Thank you for signing up.

An admin will review your request, and an e-mail will be sent if your registration is successful.

You will be redirected back home in 3 seconds.

"; $message = "Hello Administrators,\nSomeone has requested a membership. Please view the details below and decide if it is worth approving.\n\nSSH keys:\n$ssh\n\nRequested username: $username\nRequested services: Tilde"; if ($use_matrix) $message .= ", Matrix"; if ($use_fedi) $message .= ", Mastodon"; if ($use_git) $message .= ", Gitea"; if ($use_jitsi) $message .= ", Jitsi"; if ($use_xmpp) $message .= ", XMPP"; $message .= ".\nJoin reason:\n$reason\n\n\nTo accept this request, run this command as root:\n/root/bin/accept $username\nTo deny this request, run this command as root:\n/root/bin/deny $username\n"; $contents = "#!/usr/bin/env -S bash -e\n\n# This is the registration script for $username \n# This script was automatically generated by http://" . $_SERVER['HTTP_HOST'] . htmlspecialchars($_SERVER['PHP_SELF']). "\n\n"; $contents .= "~/bin/mktuser " . escapeshellarg($username) . ' ' . escapeshellarg($password0) . " <<< " . escapeshellarg($_POST['ssh']) . "\n\n"; if ($use_matrix) $contents .= "~/bin/mkmuser " . escapeshellarg($username) . ' ' . escapeshellarg($password0) . "\n"; if ($use_fedi) { $pass_file = '/home/' . $username . '/mastodon-pass'; $contents .= "~/bin/mkfuser " . escapeshellarg($username) . ' ' . escapeshellarg($email) . ' | tee /sshfs' . escapeshellarg($pass_file) . "\n"; $contents .= 'ssh 192.168.122.30 chown ' . escapeshellarg($username . ':' . $username) . ' ' . escapeshellarg($pass_file) . "\n"; $contents .= 'chmod 600 /sshfs' . $pass_file . "\n"; unset($pass_file); } if ($use_git) $contents .= "~/bin/mkguser " . escapeshellarg($username) . ' ' . escapeshellarg($password0) . ' ' . escapeshellarg($email) . "\n"; if ($use_jitsi) $contents .= "~/bin/mkxuser " . escapeshellarg($username) . ' ' . escapeshellarg($password0) . " jitsi.vern.cc\n"; if ($use_xmpp) $contents .= "~/bin/mkxuser " . escapeshellarg($username) . ' ' . escapeshellarg($password0) . " vern.cc\n"; $contents .= "s-nail -vr 'register@vern.cc' -c cobra@vern.cc -c neopenk@vern.cc -c aryak@vern.cc -s 'Your ~vern account has been created' -M text/plain " . escapeshellarg($email) . " < <(printf 'Hello %s,\\nYour membership request on ~vern has been accepted.\\nYou can now SSH into vern.cc using the public key(s) that you supplied to ~vern.\\nIf you signed up for Mastodon, a randomly generated password for the account will be in ~/mastodon-pass\\n\\nThank you for being a part of ~vern!' " . escapeshellarg($username) . ")\n"; $contents .= "rm -f $0\n"; $contents .= "exit\n\n\n"; $contents .= $reason; $filename = "/var/tmp/register/" . $username; $handle = fopen($filename, "w+"); chmod($filename, 0600); unset($filename); fwrite($handle, $contents); fclose($handle); $from = "register@vern.cc"; $headers = "From: " . $from . "\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/plain\n"; $headers .= "Cc: Alex \n"; $headers .= "Cc: Arya \n"; $headers .= "Cc: Neo \n"; mail($to, $subject, $message, $headers); } ?>