Big restructure of all directories:

config regarding ssh-reg into ssh-reg repository,
config regarding ssh and logins itself into config/etc

administrate.py to private/
userapplications.py to public/
scripts to private/scripts/
feature-restruct
darksider3 5 years ago
parent 3971ed88e8
commit 93e846e775

@ -0,0 +1,23 @@
[DEFAULT]
base_path=/application/
applications_db=%(base_path)sapplications.sqlite
log_dir=/application/
log_file=%(log_dir)sapplications.log
user_creationscript=%(base_path)smake-tilde-user.sh
[USERS]
UserGroup=tilde
userPWLock=yes
chmodPerms=0o700
chmodParams=-Rv
chownParams=%(chmodParams)s
chownGroups=%(UserGroup)s:%(UserGroup)s
[LOG_LEVEL]
log_level=%(log_debug)s
log_notset=0
log_debug=10
log_info=20
log_warning=30
log_error=40
lo0g_critical=50

@ -0,0 +1,29 @@
MAIL_DIR /var/mail
FAILLOG_ENAB yes
LOG_UNKFAIL_ENAB no
LOG_OK_LOGINS no
SYSLOG_SU_ENAB yes
SYSLOG_SG_ENAB yes
FTMP_FILE /var/log/btmp
SU_NAME su
HUSHLOGIN_FILE .hushlogin
ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
TTYGROUP tty
TTYPERM 0600
ERASECHAR 0177
KILLCHAR 025
UMASK 022
PASS_MAX_DAYS 99999
PASS_MIN_DAYS 0
PASS_WARN_AGE 7
UID_MIN 100000
UID_MAX 165536
GID_MIN 100000
GID_MAX 165536
LOGIN_RETRIES 5
LOGIN_TIMEOUT 60
CHFN_RESTRICT rwh
DEFAULT_HOME yes
USERGROUPS_ENAB yes
ENCRYPT_METHOD SHA512

@ -0,0 +1,10 @@
UseDNS no
Protocol 2
SyslogFacility AUTHPRIV
PermitRootLogin no
PubkeyAuthentication yes
ChallengeResponseAuthentication no
Subsystem sftp /usr/lib/openssh/sftp-server
Match User tilde
PermitEmptyPasswords yes

@ -0,0 +1,11 @@
#!/bin/bash
cut -d: -f1 /etc/passwd | grep test > deltest.txt
while read name; do
userdel "$name"
rm -rf /home/$name
if [ "$#" -eq 1 ]; then
sqlite3 -batch $1 "DELETE FROM applications WHERE username = '$name'"
fi
done < deltest.txt
rm -f deltest.txt

@ -0,0 +1,23 @@
#!/bin/env bash
USERNAME=$1
REALNAME=$2
EMAIL=$3
PUBKEY=$4
adduser $USERNAME
# empty password
usermod --lock $USERNAME
# add to tilde group
usermod -a -G tilde $USERNAME
# paste ssh key
mkdir /home/$USERNAME/.ssh
echo $PUBKEY >/home/$USERNAME/.ssh/authorized_keys
# fix perms
chmod -Rv 700 /home/$USERNAME/.ssh/
chown -Rv $USERNAME:$USERNAME /home/$USERNAME/.ssh/
echo "user created."
return 0

@ -0,0 +1,35 @@
#!/usr/bin/expect
expr {srand([clock seconds])} ;# initialize RNG
set username "testuser"
set mail "test@testmail.com"
set name "test Name"
set sshkey "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Tob2HvgKL5yns9BQpb/EJENR3UurMdhM9oc7tQ/USw/nIiisRDp4qmwqZM3kyl1RfkGoSiEALCogM693jl/2RO2MFLW/Da9WFuXwBmV4wMbQZQiZJCvqyMBW7uPHgfCXJ2E8T707Ixwv9S9gtmwgAqg/+x12C0fF7P45MpO3Mvc+6ZPdP5qg/GCaej67KHqfVTb4/OMrvHkRTlETFYVNj4B/uwuA7NxTi8YkCSKH+BGCLYDl95uISrHOxaKbeDb6OgkgdYS9ygg2F7r3S36n8woLdSXqJNpxx2zLgO8Ow9KE0paezyeQqPPjbYu6l8y2IAkKCWTHKTAQ6DFgcvAD darksider3@prism"
set y "y"
set random "[expr {int(rand() * 1000)}]"
spawn ./userapplication.py
expect "allowed:"
send "$username$random\r"
expect "full name:"
send "$name\r"
expect "email address:"
send "$random$mail\r"
expect "ssh public key:"
send "$sshkey\r"
expect "correct?*"
send "$y\r"
interact
spawn ./administrate.py
expect -glob "*-> "
send "1\r"
expect -glob "*->"
send "\r"
expect -glob "*-> "
send "A\r"
expect -glob "*..."
send "\r"
expect -glob "*-> "
send "4\r"
interact
Loading…
Cancel
Save