commit - 176d5d5d9a6208946006a89a85fd93a4fafc7919
commit + 8de79cd0c9fc4a2969d176d53e066cbe54adcc05
blob - adf491de0cc69afa816d6f9942324f4c01223169
blob + cc520b037bcb7795b1f07c9b6676182bdcf4e093
--- BNC.pm
+++ BNC.pm
if($hostmask eq '*controlpanel!znc@znc.in') {
if ($text =~ /^Error: User \[cloneuser\] does not exist/) {
createclone($bot);
+ main::putserv($bot, "PRIVMSG *status :loadmod blockuser");
foreach my $chan (@teamchans) {
main::putserv($bot, "PRIVMSG $chan :Cloneuser created");
}
$approvemsg = <<"EOF";
*IMPORTANT*: Your account has been created but it has not yet been
-activated. To activate your account, please contact your admins
+approved. To get your account approved, please contact your admins
$staff on IRC and by email.
EOF
blob - ea264bb186718e1782b96621a9a983d02252a7ad
blob + 2c81071ce140bdccf136648d4140f6f26b776bac
--- Mail.pm
+++ Mail.pm
use warnings;
use OpenBSD::Pledge;
use OpenBSD::Unveil;
+use File::Copy qw(copy);
use MIME::Base64;
use Digest::SHA qw(sha256_hex);
my %conf = %main::conf;
+my $chans = $conf{chans};
my $staff = $conf{staff};
my $hostname = $conf{hostname};
my $mailfrom = $conf{mailfrom};
my $teamchans = $conf{teamchans};
my @teamchans = split /[,\s]+/m, $teamchans;
my $mailwebpanel = $conf{mailwebpanel};
+my $approval = $conf{approval};
+my $expires = $conf{expires};
my $passwdpath = "/etc/mail/passwd";
my $virtualspath = "/etc/mail/virtuals";
my $senderspath = "/etc/mail/users";
+my @users;
main::cbind("msg", "-", "mail", \&mmail);
unveil("/usr/bin/encrypt", "rx") or die "Unable to unveil $!";
#dependencies for mail
unveil("/usr/sbin/sendmail", "rx") or die "Unable to unveil $!";
+ unveil($passwdpath, "rwc") or die "Unable to unveil $!";
+ unveil($virtualspath, "rwc") or die "Unable to unveil $!";
+ unveil($senderspath, "rwc") or die "Unable to unveil $!";
unveil("/usr/lib/libutil.so.13.1", "r") or die "Unable to unveil $!";
unveil("/bin/sh", "rx") or die "Unable to unveil $!";
}
return;
} elsif (main::isstaff($bot, $nick) && $text =~ /^approve\s+([[:ascii:]]+)/) {
my $username = $1;
- ### TODO: Unblock account ###
+ my @passwd = main::readarray($passwdpath);
+ foreach my $line (@passwd) {
+ $line =~ s/^#(${username}\@${hostname}.*)/$1/;
+ }
+ # trailing newline necessary
+ main::writefile("$passwdpath.bak", join("\n", @passwd)."\n");
+ copy "${passwdpath}.bak", $passwdpath;
+
foreach my $chan (@teamchans) {
main::putserv($bot, "PRIVMSG $chan :$username mail approved");
}
main::putserv($bot, "PRIVMSG $nick :Check your email!");
mailmail($username, $pass, $email);
if ($approval eq "true") {
- ### TODO: Block account ###
+ my @passwd = main::readarray($passwdpath);
+ foreach my $line (@passwd) {
+ $line =~ s/^(${username}\@${hostname}.*)/#$1/;
+ }
+ # trailing newline necessary
+ main::writefile("$passwdpath.bak", join("\n", @passwd)."\n");
+ copy "${passwdpath}.bak", $passwdpath;
+
main::putserv($bot, "PRIVMSG $nick :Your account has been created but must be manually approved by your admins ($staff) before it can be used.");
foreach my $chan (@teamchans) {
main::putservlocalnet($bot, "PRIVMSG $chan :$staff: $nick\'s account $username must be manually unblocked before it can be used.");
}
}
foreach my $chan (@teamchans) {
- main::putservlocalnet($bot, "PRIVMSG $chan :$nick\'s mail registration of $username@$hostname on $bot->{name} was successful, please help him connect");
+ main::putservlocalnet($bot, "PRIVMSG $chan :$nick\'s mail registration of $username\@$hostname on $bot->{name} was successful, please help him connect");
}
#www($newnick, $reply, $password, "bouncer");
return;
$approvemsg = <<"EOF";
*IMPORTANT*: Your account has been created but it has not yet been
-activated. To activate your account, please contact your admins
+approved. To get your account approved, please contact your admins
$staff on IRC and by email.
EOF
You created an email account:
-Username: $username@$hostname
+Username: $username\@$hostname
Password: $password
Server: $hostname
IMAP Port: $imapport (STARTTLS)
sub deletemail {
my ($username) = @_;
- my @passwd = readarray($passwdpath);
- my @virtuals = readarray($virtualspath);
- my @senders = readarray($senderspath);
+ my @passwd = main::readarray($passwdpath);
+ my @virtuals = main::readarray($virtualspath);
+ my @senders = main::readarray($senderspath);
@passwd = grep !/^${username}\@${hostname}/, @passwd;
@virtuals = grep !/^${username}\@${hostname}/, @virtuals;
@senders = grep !/^${username}\@${hostname}/, @virtuals;
# trailing newline necessary
main::writefile("$passwdpath.bak", join("\n", @passwd)."\n");
- copy "$passwdpath.bak", $passwdpath;
+ copy "${passwdpath}.bak", $passwdpath;
main::writefile("$virtualspath", join("\n", @virtuals)."\n");
- copy "$virtualspath.bak", $virtualspath;
+ copy "${virtualspath}.bak", $virtualspath;
main::writefile("$senderspath", join("\n", @senders)."\n");
- copy "$senderspath.bak", $senderspath;
+ copy "${senderspath}.bak", $senderspath;
`doas rcctl restart smtpd`;
`doas rcctl reload dovecot`;
blob - 14153c3d570d26cb6f92b04d67e07903dec73848
blob + 4097cd6fdf76db9b84c02aa5d68869f299dcc8df
--- Shell.pm
+++ Shell.pm
sub yesterday {
my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
- my $localtime = sprintf("%s%02d%04d", $months[mon], $mday-1, $year+1900);
+ my $localtime = sprintf("%s%02d%04d", $months[$mon], $mday-1, $year+1900);
return $localtime;
}
sub init {
main::whois($bot->{sock}, $nick);
main::ctcp($bot->{sock}, $nick);
main::putserv($bot, "PRIVMSG $nick :".`figlet $captcha`);
- main::putserv($bot, "PRIVMSG $nick :$captchaURL".encode_base64($captcha));
+ # main::putserv($bot, "PRIVMSG $nick :$captchaURL".encode_base64($captcha));
main::putserv($bot, "PRIVMSG $nick :Type !shell captcha <text>");
foreach my $chan (@teamchans) {
main::putservlocalnet($bot, "PRIVMSG $chan :$nick\'s captcha on $bot->{name} is $captcha");
$approvemsg = <<"EOF";
*IMPORTANT*: Your account has been created but it has not yet been
-activated. To activate your account, please contact your admins
+approved. To get your account approved, please contact your admins
$staff on IRC and by email.
EOF