forked from team/makeuser
Modfied for thunix
This commit is contained in:
parent
40cfd05eed
commit
82ce5d58ad
48
email.tmpl
48
email.tmpl
|
@ -1,43 +1,13 @@
|
||||||
Subject: welcome to tilde.team!
|
Welcome newusername to thunix!
|
||||||
|
|
||||||
hey ~newusername,
|
Your account has been provisioned, and should be available in a few
|
||||||
|
minutes for login. Your password is newpassword
|
||||||
|
|
||||||
welcome to tilde.team!
|
Any questions, concerns, comments, etc etc? Join us
|
||||||
|
in IRC at ircl.tilde.chat/6697, in #thunix, or via webchat:
|
||||||
|
https://web.tilde.chat/?join=thunix
|
||||||
|
|
||||||
your new account has been established. you can ssh into tilde.team with
|
Also, check out our git repos, that pretty much manage the whole of the
|
||||||
the ssh key you supplied on registration.
|
system at https://tildegit.org/thunix, and feel free to open issues and PRs.
|
||||||
|
|
||||||
your password is "newpassword". please change it when you log in for
|
|
||||||
the first time. the password is used for imap/smtp auth, not shell login,
|
|
||||||
which is set to only use ssh key authentication.
|
|
||||||
|
|
||||||
to get started, type `motd` at the command prompt to see a few ways to
|
|
||||||
get started. have fun!
|
|
||||||
|
|
||||||
the greatest value of tilde.team is not the services provided by the
|
|
||||||
server, but rather the interesting and welcoming community built by its
|
|
||||||
users. this is possible because of people like you who choose to make
|
|
||||||
this a great place. the best way you can help tilde.team is by working
|
|
||||||
to support a great system culture. chat on irc; build cool programs and
|
|
||||||
share them with others; focus on learning, and help others learn; be a
|
|
||||||
good example for others; have fun!
|
|
||||||
|
|
||||||
also, your ~/public_html directory is served at
|
|
||||||
https://tilde.team/~newusername/
|
|
||||||
(you can also use https://newusername.tilde.team)
|
|
||||||
|
|
||||||
check out our wiki at https://tilde.team/wiki/ for more information (and
|
|
||||||
maybe help us write a new wiki article:)
|
|
||||||
|
|
||||||
our irc is tilde.chat, an irc network connecting several
|
|
||||||
tilde servers. the `chat` command on your ~team shell will open up
|
|
||||||
weechat with some nice default configs and plugins.
|
|
||||||
see our wiki article (https://tilde.team/wiki/?page=irc)
|
|
||||||
or https://tilde.chat site for information on how to connect from elsewhere.
|
|
||||||
we also have a webclient at https://irc.tilde.team that you can
|
|
||||||
register for by running the `webirc` command from a shell session.
|
|
||||||
|
|
||||||
we look forward to seeing you around! welcome to the ~team!
|
|
||||||
|
|
||||||
~tilde.team admins
|
|
||||||
|
|
||||||
|
Finally, welcome aboard!
|
||||||
|
|
67
makeuser
67
makeuser
|
@ -1,11 +1,25 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# makeuser - tilde.team new user creation
|
# makeuser - tilde new user creation
|
||||||
# Usage: makeuser [-h|--help] <username> <email> "<pubkey>"
|
# Usage: makeuser [-h|--help] <username> <email> "<pubkey>"
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Forked from tilde.team's make user script (
|
||||||
PROGNAME=${0##*/}
|
PROGNAME=${0##*/}
|
||||||
VERSION="0.1"
|
VERSION="0.4"
|
||||||
|
LIST_NAME="thunix-join@lists.tildeverse.org"
|
||||||
|
ADMIN_EMAIL="root@thunix.net"
|
||||||
|
EMAIL_TEMPLATE="email.tmpl"
|
||||||
|
YAML_FILE="$1.yml"
|
||||||
|
# This one for team
|
||||||
|
# ZNC_USER="/home/znc/add_znc_user.sh"
|
||||||
|
|
||||||
|
# This one for Thunix
|
||||||
|
ZNC_USER="/var/lib/znc/create-znc_account.sh"
|
||||||
|
|
||||||
|
# Set location to your repo for ansible here
|
||||||
|
# It is only needed for thunix
|
||||||
|
REPO_LOCATION="~/repos/ansible"
|
||||||
|
|
||||||
error_exit() {
|
error_exit() {
|
||||||
echo -e "${PROGNAME}: ${1:-"Unknown Error"}" >&2
|
echo -e "${PROGNAME}: ${1:-"Unknown Error"}" >&2
|
||||||
|
@ -20,10 +34,10 @@ sub_to_list() {
|
||||||
echo "
|
echo "
|
||||||
From: $1
|
From: $1
|
||||||
Subject: subscribe
|
Subject: subscribe
|
||||||
" | sudo -u $1 sendmail tildeteam-join@lists.tildeverse.org
|
" | sudo -u $1 sendmail $LIST_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
[[ $(id -u) != 0 ]] && error_exit "you must be the superuser to run this script."
|
[[ $(id -u) == 0 ]] && error_exit "Do not run this script as root."
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
|
@ -35,13 +49,46 @@ case $1 in
|
||||||
echo "adding new user $1"
|
echo "adding new user $1"
|
||||||
newpw=$(pwgen -1B 10)
|
newpw=$(pwgen -1B 10)
|
||||||
pwcrypt=$(perl -e "print crypt('${newpw}', 'sa');")
|
pwcrypt=$(perl -e "print crypt('${newpw}', 'sa');")
|
||||||
useradd -m -g 100 -p $pwcrypt -s /bin/bash $1 || exit 1
|
sudo useradd -m -g 100 -p $pwcrypt -s /bin/bash $1 || exit 1
|
||||||
|
sed -e "s/newusername/$1/g" -e "s/newpassword/$newpw/" $EMAIL_TEMPLATE | sendmail $1 $2 $ADMIN_EMAIL
|
||||||
sed -e "s/newusername/$1/g" -e "s/newpassword/$newpw/" email.tmpl | sendmail $1 $2 sudoers@tilde.team
|
|
||||||
sub_to_list $1
|
sub_to_list $1
|
||||||
sudo -u znc /home/znc/add_znc_user.sh $1
|
|
||||||
|
# This line is for team
|
||||||
|
# sudo -u znc /home/znc/add_znc_user.sh $1
|
||||||
|
# This one is for Thunix
|
||||||
|
sudo $ZNC_USER $1 $newpw
|
||||||
|
|
||||||
echo "$3" | tee /home/$1/.ssh/authorized_keys
|
echo "$3" | tee /home/$1/.ssh/authorized_keys
|
||||||
toot "welcome new user ~$1!" ;;
|
|
||||||
|
# If root doesn't have a fediverse account, comment this out
|
||||||
|
sudo toot "welcome new user ~$1!"
|
||||||
|
|
||||||
|
#Thunix specific section
|
||||||
|
echo "---
|
||||||
|
- name: Setting up $1
|
||||||
|
user:
|
||||||
|
name: $1
|
||||||
|
groups: tilde
|
||||||
|
state: present
|
||||||
|
skeleton: /etc/skel
|
||||||
|
shell: /bin/bash
|
||||||
|
system: no
|
||||||
|
createhome: yes
|
||||||
|
home: /home/$1
|
||||||
|
- authorized_key:
|
||||||
|
user: $1
|
||||||
|
state: present
|
||||||
|
key:'$3'" > $REPO_LOCATION/roles/shell/tasks/users/$YAML_FILE
|
||||||
|
|
||||||
|
echo -e "- include: users/$YAML_FILE\n" >> $REPO_LOCATION/roles/shell/tasks/users.yml
|
||||||
|
place=`pwd`
|
||||||
|
cd $REPO_LOCATION
|
||||||
|
git add $REPO_LOCATION/roles/shell/tasks/users.yml
|
||||||
|
git commit -am "Adding user $1"
|
||||||
|
git push
|
||||||
|
cd $place
|
||||||
|
# End Thunix specific section
|
||||||
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue