Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2ada6b0
Copy lib/pause_2017 files into lib/pause_2025
charsbar Apr 19, 2025
f2495b1
Rename PAUSE::Web under lib/pause_2025 as PAUSE::Web2025
charsbar Apr 19, 2025
2168789
Replace 2017 under lib/pause_2025 with 2025
charsbar Apr 19, 2025
bf1477c
Copy pause_2017.css to pause_2025.css
charsbar Apr 19, 2025
d0f2daa
Copy app_2017.psgi to app_2025.psgi
charsbar Apr 19, 2025
4291ef9
Add lib/pause_2025 to @INC
charsbar Apr 19, 2025
1219ad9
Mount PAUSE::Web2025 app instead of old PAUSE::Web::App::Index
charsbar Apr 19, 2025
b244c02
Set pass_through to true for static files from Mojolicious to be serv…
charsbar Apr 19, 2025
ccf3eec
Tweak my_url to accept both ACTION and query parameters
charsbar Apr 26, 2025
927711e
Modify my_full_url as well
charsbar Apr 26, 2025
5a56f1b
Remove ->query from my_(full_)url and pass the parameters to them
charsbar Apr 26, 2025
eeeb2bc
Just use $c->url_for for the menu links on the left
charsbar Apr 26, 2025
b65a0c7
Move ABRA back to ->query() as my_url removes it internally
charsbar Apr 26, 2025
9af4b1b
Move links to list.min.js under /pause
charsbar Apr 26, 2025
73fce8e
Remove FixAction plugin
charsbar Apr 26, 2025
e9ceb9b
Set $pause->{Action} to param('ACTION')
charsbar Apr 26, 2025
1108b0e
Modify the link to the home
charsbar Apr 26, 2025
0988a65
Stop adding ACTION hidden field as we can find the action from the pa…
charsbar Apr 26, 2025
358182f
Add configuration entries for login/logout/mfa
charsbar Apr 26, 2025
e8be0d7
Modify router parameters
charsbar Apr 26, 2025
12ce701
Add the login action to the Root controller
charsbar Apr 26, 2025
b4bb0d2
Verify one time password if usertable.mfa is true
charsbar Apr 26, 2025
6d945e3
Add a template to login
charsbar Apr 26, 2025
68fc619
Add the logout Root action and the template for it
charsbar Apr 26, 2025
c94001c
Fix app's secret
charsbar Apr 26, 2025
6e33f91
Make sure the action (taken from the path_info) is allowed for the us…
charsbar Apr 26, 2025
b6577fe
Redirect to /login if the action requires authentication and the sess…
charsbar Apr 26, 2025
992b6ce
Retrieve a user from the user id stored in the session
charsbar Apr 26, 2025
4850dfd
Retrieve user secrets while retrieving a user
charsbar Apr 26, 2025
b7f2496
Allow login action
charsbar Apr 26, 2025
d0474ba
Retrieve the user from the $c->session
charsbar Apr 26, 2025
15d0876
Redirect to /login if active_user_record fails to retrieve a user fro…
charsbar Apr 26, 2025
1c80f17
Add an MFA controller and templates
charsbar Apr 26, 2025
ec544d3
Remove Auth::Basic middleware
charsbar Apr 26, 2025
79f7146
Add one off schema change file
charsbar Apr 26, 2025
fa8e73a
Fix tail_logfile url in an email
charsbar May 1, 2025
c868a23
my_full_url should also respect the ACTION parameter
charsbar May 1, 2025
a84ce80
Add a "public" endpoint to prevent the "check" endpoint from being ca…
charsbar May 1, 2025
b880f66
Reintroduce PAUSE::Web2025::Plugin::WithCSRFProtection
charsbar May 1, 2025
8357835
Copy all the tests for pause_2017 under t/pause_2025
charsbar May 1, 2025
6bfdf9d
Rename t/pause_2025/action as t/pause_2025/action_2017
charsbar May 1, 2025
a86b9e4
Copy tests under t/pause_2025/action_2017 to t/pause_2025/action_2025
charsbar May 1, 2025
69e64ee
Migrate pause_2025 tests
charsbar May 2, 2025
3ceb1c6
Update cpanfile
charsbar May 2, 2025
c342be9
Ignore WithCSRFProtection 1.02 for now
charsbar May 2, 2025
930b140
Requires Image::QRCode as well
charsbar May 2, 2025
a25722e
No need to escape a question mark here
charsbar May 2, 2025
70b42e4
Remove ::App::Index from app_2025.psgi as we don't use it, as well as…
charsbar May 4, 2025
f7c47f6
Update schema
charsbar May 4, 2025
eb49aa2
Apply the same changes done for pause_2017 files to pause_2025 files
charsbar May 4, 2025
3c6160a
Add a schemachange file
charsbar May 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions app_2025.psgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env perl

use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/lib/", "$FindBin::Bin/lib/pause_2017", "$FindBin::Bin/lib/pause_2025", "$FindBin::Bin/../pause-private/lib", "$FindBin::Bin/privatelib";
use Plack::Builder;
use Plack::App::Directory::Apaxy;
use Path::Tiny;
my $AppRoot = path(__FILE__)->parent->realpath;
Log::Dispatch::Config->configure("$AppRoot/etc/plack_log.conf.".($ENV{PLACK_ENV} // 'development'));

$ENV{MOJO_REVERSE_PROXY} = 1;
$ENV{MOJO_HOME} = $AppRoot;

# preload stuff
use PAUSE::Web::Context;
use PAUSE::Web;
use PAUSE::Web::App::Disabled;
use PAUSE::Web2025;
use PAUSE::Web2025::Context;

use BSD::Resource ();
#BSD::Resource::setrlimit(BSD::Resource::RLIMIT_CPU(),
# 60*10, 60*10);
#BSD::Resource::setrlimit(BSD::Resource::RLIMIT_DATA(),
# 40*1024*1024, 40*1024*1024);
BSD::Resource::setrlimit(BSD::Resource::RLIMIT_CORE(),
40*1024*1024, 40*1024*1024);

my $builder = eval {

my $context = PAUSE::Web::Context->new(root => $AppRoot);
$context->init;

my $context2025 = PAUSE::Web2025::Context->new(root => $AppRoot);
$context2025->init;

my $pause_app = PAUSE::Web->new(pause => $context);
my $pause2025_app = PAUSE::Web2025->new(pause => $context2025);
my $disabled_app = PAUSE::Web::App::Disabled->new->to_app;

builder {
enable 'LogDispatch', logger => $context->logger;
enable 'ReverseProxy';
enable 'ServerStatus::Tiny', path => '/status';

if (-f "/etc/PAUSE.CLOSED") {
mount '/' => builder { $disabled_app };
} else {
# Static files are serverd by us; maybe some day we want to change that
enable 'Static',
path => qr{(?:(?<!index)\.(js|css|gif|jpg|png|pod|html)$|^/\.well-known/)},
root => "$FindBin::Bin/htdocs",
pass_through => 1;

mount '/pub/PAUSE' => builder {
enable '+PAUSE::Web::Middleware::Auth::Basic', context => $context;
Plack::App::Directory::Apaxy->new(root => $PAUSE::Config->{FTPPUB});
};

mount '/incoming' => builder {
enable '+PAUSE::Web::Middleware::Auth::Basic', context => $context;
Plack::App::Directory::Apaxy->new(root => $PAUSE::Config->{INCOMING_LOC});
};

mount '/pause' => builder {
enable_if {$_[0]->{PATH_INFO} =~ /authenquery/ ? 1 : 0} '+PAUSE::Web::Middleware::Auth::Basic', context => $context;
$pause_app->start('psgi');
};

mount '/' => builder {
$pause2025_app->start('psgi');
};
}
};

};

if ($@) {
Log::Dispatch::Config->instance->log(
level => 'error',
message => "$@",
);
}

$builder;
4 changes: 3 additions & 1 deletion cpanfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
requires 'Apache::Session::Counted';
requires 'Auth::GoogleAuth', '1.05';
requires 'BSD::Resource';
requires 'CPAN::Checksums', '1.050';
requires 'CPAN::DistnameInfo';
Expand All @@ -22,6 +23,7 @@ requires 'HTML::Entities';
requires 'HTTP::Date';
requires 'HTTP::Status';
requires 'HTTP::Tiny', '0.059';
requires 'Imager::QRCode';
requires 'IO::Socket::SSL', '1.56';
requires 'IPC::Run3';
requires 'JSON';
Expand All @@ -34,7 +36,7 @@ requires 'Log::Dispatchouli';
requires 'Module::Signature';
requires 'MojoX::Log::Dispatch::Simple';
requires 'Mojolicious';
requires 'Mojolicious::Plugin::WithCSRFProtection';
requires 'Mojolicious::Plugin::WithCSRFProtection'; #, '1.02';
requires 'Net::SSLeay', '1.49';
requires 'Parallel::Runner';
requires 'Parse::CPAN::Packages';
Expand Down
3 changes: 3 additions & 0 deletions doc/authen_pause.schema.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ CREATE TABLE usertable (
`changed` int(11) DEFAULT NULL,
changedby char(10) DEFAULT NULL,
lastvisit datetime DEFAULT NULL,
mfa tinyint(1) DEFAULT 0,
mfa_secret32 varchar(16) DEFAULT NULL,
mfa_recovery_codes text DEFAULT NULL,
PRIMARY KEY (`user`),
KEY usertable_password (`password`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 PACK_KEYS=1;
Expand Down
3 changes: 3 additions & 0 deletions doc/schemas/authen_pause.schema.sqlite
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ CREATE TABLE usertable (
changed int(11) DEFAULT NULL,
changedby char(10) DEFAULT NULL,
lastvisit datetime DEFAULT NULL,
mfa tinyint(1) DEFAULT 0,
mfa_secret32 varchar(16) DEFAULT NULL,
mfa_recovery_codes text DEFAULT NULL,
PRIMARY KEY (user)
);

Expand Down
191 changes: 191 additions & 0 deletions htdocs/pause/pause_2025.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
body {
color: #000000;
background: white;
}
a { color: #0000cc; }
a:visited { color: #0000bb; }
a:active { color: #ff0000; }
p { padding: 0.5em; margin: 0; }

h1.logo { font-size:1em; margin: 0; padding: 0 }
div.menu {
padding-right: 0.5em;
}
div.menu p {
margin: 0;
padding: 0.2em 0.3em 0.2em 0.3em;
}
div.menu p.menuheading { padding-top: 0.5em; padding-bottom: 0.3em; }
nav {
border-right: 0.3em #f00 solid;
margin-right: 1em;
}

.actionresponse {
border: 3px #f3f dashed;
padding: 10px;
margin: 2px;
background-color: #eee;
color: black;
}

.line1, .line2, .line3 { color: black; }
.line1 { background-color: #ffe0e0; }
.line2 { background-color: #e0ffe0; }
.line3 { background-color: #e0e0ff; }


.activemenu { background: #bfb; font-size: small; line-height: 1.5; }
.alternate1 {
background: #f8f8f8;
padding: 0.5em;
}
.alternate2 {
background: #ddd;
padding: 0.5em;
}
.explain { font-size: small; }
.firstheader { margin: 0 0 5%; }
.menuheading { background: white;
font-size: small; }
.menuitem { background: #ddf; font-size: small; line-height: 1.5; }
.menupointer { color: green; }
.messages { text-align: left; border: 2px dashed red; padding: 2ex; }
.userstatus { text-align: center;
font-size: small;
padding: 0.2em;
float: right; }
.statusencr { background: #bfb;
border: green solid 2px; }
.statusunencr { background: #fbb;
border: red solid 2px; }
.xexplain { font-size: x-small; }
a.activemenu { text-decoration: none; }
a.activemenu:hover { text-decoration: underline; }
a.menuitem { text-decoration: none; }
a.menuitem:hover { text-decoration: underline; }
h4.altering { margin: 0 0 12px; }
p.motd { margin: 10px 1in; padding: 5px; color: black; background: yellow; font-size: small; }
p.versionspecial { margin: 10px 1in; padding: 5px; color: white; background: gray; font-size: small; }
a.versionspecial { color: yellow; }
a.versionspecial:hover { color: red; }
p.activemenu { border: green solid 1px; }

.texttable { border: black solid 1px; }

.orange_button {
background:#FF6600 none repeat scroll 0%;
border-color:#FFCC99 rgb(102, 51, 0) rgb(51, 51, 0) rgb(255, 153, 102);
border-style:solid;
border-width:1px;
color:#FFFFFF;
font-family:verdana,sans-serif;
font-size:10px;
font-size-adjust:none;
font-stretch:normal;
font-style:normal;
font-variant:normal;
font-weight:bold;
line-height:normal;
margin:0pt;
padding:0pt 3px;
text-decoration:none;
}
#contentBox {
width:600px;
height:auto;
}
td.administration {
border-top: 2px grey solid;
border-left: 2px grey solid;
}

.sort:after {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid transparent;
content:"";
position: relative;
top:-10px;
right:-5px;
}
.sort.asc:after {
width: 0;
height: 0;
border-left: 0.3em solid transparent;
border-right: 0.3em solid transparent;
border-top: 0.3em solid #000;
content:"";
position: relative;
top:0.8em;
right:-0.3em;
}
.sort.desc:after {
width: 0;
height: 0;
border-left: 0.3em solid transparent;
border-right: 0.3em solid transparent;
border-bottom: 0.3em solid #000;
content:"";
position: relative;
top:-0.8em;
right:-0.3em;
}

.pagination { padding: 0; margin: 0.3em; display: inline-block; }
.pagination li {
display: inline-block;
margin: 0;
padding-right: 0.5em;
font-size: 0.8em;
}
.pagination li.active {
font-weight: bold;
}
.pagination:before {
content: "Page: ";
font-size: 0.8em;
}

.table.compact { font-size: small; }
.table th,.table td{ padding: 0.3em; text-align: left; vertical-align: top; }
.table tbody>:nth-child(2n-1){ background: #ddd }
input, textarea { background: #fff; }
td.checkbox { padding: 0em; text-align: center; vertical-align: middle; }
.http_upload { background: #e0ffff; }
.url_upload { background: #ffe0ff; }

p.notice {
font-weight: bold;
}
div.info {
color: #004085;
background-color: #cce5ff;
border-color: #b8daff;
}
div.warning {
color: #856404;
background-color: #fff3cd;
border-color: #ffeeba;
}
div.error {
color: #721c24;
background-color: #f8d7da;
border-color: #f5c6cb;
}
div.messagebox {
padding: 0.75rem 1.25rem;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: 0.25rem;
}
td.indexed {
font-weight: bold
}
.row {
margin-left: 1em;
margin-right: 1em;
}
h1.logo img { margin-right: 0.5em; }
Loading