aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Lionel <lionel@les-miquelots.net>2021-07-17 22:01:05 +0100
committerMiquel Lionel <lionelmiquel@sfr.fr>2021-07-18 20:01:02 +0100
commit1208e3e3ffb1cc263d879f996b22e18c8b024d33 (patch)
treec168dcc3eff82020e767b1d22f71880118a92fef
parente6d90c87b655db6c33724e5fb3b4001963c63736 (diff)
downloadgpigeon-1208e3e3ffb1cc263d879f996b22e18c8b024d33.tar.gz
gpigeon-1208e3e3ffb1cc263d879f996b22e18c8b024d33.zip
fixes
- Makefile is better: the generated password via genpass.pl or genpass.pl with -i flag should now be a correct argon2id hash in both cases. - Added missing checks in the makefile - Fixed undeclared variables in gpigeon-template.cgi Running make should be better and require less manual fiddling now.
-rw-r--r--Makefile96
-rw-r--r--config.def.mk17
-rw-r--r--favicon.icobin26790 -> 408142 bytes
-rwxr-xr-xgenpass.pl3
-rwxr-xr-xgpigeon-template.cgi116
-rw-r--r--index.html28
-rw-r--r--link-tmpl-template.cgi22
-rw-r--r--styles.css21
8 files changed, 165 insertions, 138 deletions
diff --git a/Makefile b/Makefile
index 4900467..c4cd989 100644
--- a/Makefile
+++ b/Makefile
@@ -8,33 +8,24 @@ RED=\033[31m
STOP=\033[0m
include config.mk
RANDOM_ARGON2 := $(shell perl genpass.pl > genpass.txt && tail -1 genpass.txt)
-_GPGID := $(shell gpg --with-colons -k $(MYMAIL_ADDR) | grep "pub:u" | cut -d':' -f5)
gpigeon: gpigeon-template.cgi link-tmpl-template.cgi
@if test -n '$(MYMAIL_ADDR)'; then \
- printf "Your mail address is ${BOLD}$(MYMAIL_ADDR)${STOP}\n"; \
- sed -e 's|your_addr_goes_here|$(MYMAIL_ADDR)|g' link-tmpl-template.cgi > link-tmpl.cgi; \
- else \
- printf "${RED}There's no mail adress configured for gpigeon in your config.mk !${STOP}\n" ; \
- $(MAKE) clean ; \
- exit 1; \
+ printf "Your mail address is ${BOLD}$(MYMAIL_ADDR)${STOP}\n";\
+ gpg -o gpg.txt --yes --batch --armor --export $(MYMAIL_ADDR) ; \
+ else \
+ printf "${RED}There's no mail adress configured for gpigeon in your config.mk !${STOP}\n";\
+ $(MAKE) clean ;\
+ exit 1;\
fi
@if test -n '$(MAILSENDER)'; then \
printf "Encrypted mails will be sent from ${BOLD}$(MAILSENDER)${STOP}\n"; \
- sed -e 's|sender_addr_goes_here|$(MAILSENDER)|g' -i link-tmpl.cgi; \
else \
printf "\t${RED}No mail sender adress configured in your config.mk. Fix this.${STOP}\n" ; \
$(MAKE) clean ; \
exit 1; \
fi
- @if test -n '$(_GPGID)'; then \
- printf "Your GPG 0xlong id is ${BOLD}0x$(_GPGID)${STOP}\n";\
- sed -e 's|gpgid_goes_here|0x$(_GPGID)|g' -i link-tmpl.cgi;\
- else \
- printf "${RED}It seems that no public GPG key is tied to ${BOLD}$(MYMAIL_ADDR)${STOP}\n";\
- exit 1; \
- fi
@if test -z '$(PREFIX)'; then \
printf "\n$(RED)No \u0024PREFIX variable defined in config.mk.\n";\
printf "Look into config.def.mk for the defaults and fix that.$(STOP)\n";\
@@ -43,16 +34,22 @@ gpigeon: gpigeon-template.cgi link-tmpl-template.cgi
printf "\n\u0024PREFIX var is set to $(BOLD)$(PREFIX)$(STOP)";\
fi
- @if test -z '$(WWWPREFIX)'; then\
+ @if test -z '$(WWWDIR)'; then\
printf "\n${RED}No web directory defined in config.mk. Check your config.def.mk for the defaults and fix that.${STOP}";\
exit 1; \
else \
- printf "\nThe WWW directory is $(BOLD)$(WWWPREFIX)$(STOP)";\
+ printf "\nThe WWW directory is $(BOLD)$(WWWDIR)$(STOP)";\
+ fi
+ @if test -z '$(BINPREFIX)'; then \
+ printf "\n$(RED)No \u0024BINPREFIX variable defined in config.mk.\n";\
+ printf "Look into config.def.mk for the defaults and fix that in your config.mk.$(STOP)\n";\
+ exit 1;\
+ else \
+ printf "\n\u0024BINPREFIX var is set to $(BOLD)$(BINPREFIX)$(STOP)";\
fi
@if test -n '$(COOKIES_DIR)'; then \
printf "\nThe cookies will be stored in ${BOLD}$(COOKIES_DIR)${STOP}"; \
- sed -e 's|cookies_dir_goes_here|$(COOKIES_DIR)|g;' gpigeon-template.cgi > gpigeon.cgi; \
else \
printf "\n${RED}No cookie directory configured. Check your config.def.mk for the defaults and fix that.${STOP}" ;\
exit 1; \
@@ -66,40 +63,56 @@ gpigeon: gpigeon-template.cgi link-tmpl-template.cgi
fi
@if test -n '$(LINK_TEMPLATE_PATH)'; then \
printf "\nLink template is at ${BOLD}$(LINK_TEMPLATE_PATH)${STOP}"; \
- sed -e 's|link_template_path_goes_here|$(LINK_TEMPLATE_PATH)|g' -i gpigeon.cgi; \
else \
printf "\n${RED}The path for the link template wasn't set in your config.mk. Fix that.${STOP}" ;\
exit 1;\
fi
@if test -n '$(UPLOAD_TMPDIR)'; then \
printf "\nUploaded files will be temporary stored at ${BOLD}$(UPLOAD_TMPDIR)${STOP}"; \
- sed -e 's|tmp_dir_goes_here|$(UPLOAD_TMPDIR)|g' -i gpigeon.cgi; \
else \
printf "\n${RED}The temporary directory for uploaded files wasn't set in your config.mk. Fix that.${STOP}" ;\
exit 1;\
fi
- @if test -n '$(ARGON2ID_HASH)'; then\
- printf "\nThe argon2id hash is ${BOLD}${ARGON2ID_HASH}${STOP}\n"; \
- sed -e 's|argon2id_hash_goes_here|$(ARGON2ID_HASH)|g' -i gpigeon.cgi; \
- else \
- sed -e 's|argon2id_hash_goes_here|$(RANDOM_ARGON2)|g' -i gpigeon.cgi; \
- printf "\nThe variable ARGON2ID_HASH wasn't declared in your config.mk thus a password \nand its argon2id hash as been generated (look into `pwd`/genpass.txt)."; \
- printf "\nYour password is:\n${BOLD}`head -1 genpass.txt`${STOP}"; \
- printf "\nAnd the hash is:\n${BOLD}%s${STOP}\n\n" '${RANDOM_ARGON2}'; \
- rm -f genpass.txt; \
- fi
@if test -n '$(MSG_FORM_CHAR_LIMIT)'; then \
- printf "Message form will have a message limit of ${BOLD}$(MSG_FORM_CHAR_LIMIT) characters${STOP}\n"; \
- sed -e "s|msg_char_limit_goes_here|$(MSG_FORM_CHAR_LIMIT)|g" -i link-tmpl.cgi;\
+ printf "\nMessage form will have a message limit of ${BOLD}$(MSG_FORM_CHAR_LIMIT) characters${STOP}"; \
else \
printf "${RED}No character limits were defined in your config.mk. Fix that.${STOP}\n" ;\
$(MAKE) clean ;\
exit 1;\
fi
+ @if test -n '$(MAX_MB_LIMIT)'; then \
+ printf "\nFilesize limit of uploads will be ${BOLD}$(MAX_MB_LIMIT) MB${STOP}\n"; \
+ else \
+ printf "${RED}No filesize limit for uploads was set in your config.mk. Fix that.${STOP}\n" ;\
+ $(MAKE) clean ;\
+ exit 1;\
+ fi
+ @sed -e 's|cookies_dir_goes_here|$(COOKIES_DIR)|g' gpigeon-template.cgi > gpigeon.cgi;
+ @sed -e 's|bin_path_goes_here|$(BINPREFIX)|g' -i gpigeon.cgi;
+ @sed -e 's|link_template_path_goes_here|$(LINK_TEMPLATE_PATH)|g' -i gpigeon.cgi;
+ @sed -e 's|your_addr_goes_here|$(MYMAIL_ADDR)|g' link-tmpl-template.cgi > link-tmpl.cgi
+ @sed -e 's|bin_path_goes_here|$(BINPREFIX)|g' -i link-tmpl.cgi;
+ @sed -e 's|sender_addr_goes_here|$(MAILSENDER)|g' -i link-tmpl.cgi;
+ @sed -e "s|msg_char_limit_goes_here|$(MSG_FORM_CHAR_LIMIT)|g" -i link-tmpl.cgi;
+ @sed -e 's|has_mailserver_goes_here|$(HAS_MAILSERVER)|g' -i link-tmpl.cgi;
+ @sed -e 's|sender_addr_goes_here|$(MAILSENDER)|g' -i link-tmpl.cgi;
+ @sed -e 's|gpg_homedir_goes_here|$(_GPG_HOMEDIR)|g' -i link-tmpl.cgi;
+ @sed -e 's|tmp_dir_goes_here|$(UPLOAD_TMPDIR)|g' -i link-tmpl.cgi;
+ @sed -e "s|max_mb_goes_here|$(MAX_MB_LIMIT)|g" -i link-tmpl.cgi;
+ @if test -n '$(ARGON2ID_HASH)'; then\
+ printf "\nThe argon2id hash is ${BOLD}${ARGON2ID_HASH}${STOP}\n"; \
+ sed -e 's|argon2id_hash_goes_here|${ARGON2ID_HASH}|g' -i gpigeon.cgi; \
+ else \
+ sed -e 's|qq{argon2id_hash_goes_here}|q{$(RANDOM_ARGON2)}|g' -i gpigeon.cgi; \
+ printf "\nThe variable ARGON2ID_HASH wasn't declared in your config.mk thus a password \nand its argon2id hash as been generated (look into `pwd`/genpass.txt)."; \
+ printf "\nYour password is:\n${BOLD}`head -1 genpass.txt`${STOP}"; \
+ printf "\nAnd the hash is:\n${BOLD}%s${STOP}\n\n" '${RANDOM_ARGON2}'; \
+ rm -f genpass.txt; \
+ fi
@if [ '${HAS_MAILSERVER}' == '1' ]; then \
printf "Local mail server setup. ${BOLD}Mail::Sendmail module will be used to send the mails${STOP}.\n"; \
else \
@@ -129,38 +142,37 @@ gpigeon: gpigeon-template.cgi link-tmpl-template.cgi
exit 1; \
fi; \
fi
- @sed -e 's|has_mailserver_goes_here|$(HAS_MAILSERVER)|g' -i link-tmpl.cgi
- @sed -e 's|gpg_homedir_goes_here|$(_GPG_HOMEDIR)|g' -i link-tmpl.cgi
$(MAKE) nginxconf
@printf "\nDone preparing files. You can now type\nsudo make install\nin your terminal.\n"
install:
$(MAKE) gpigeon;
mkdir -p $(DESTDIR)$(COOKIES_DIR);
+ mkdir -p $(DESTDIR)$(UPLOAD_DIR);
mkdir -m700 -p $(DESTDIR)$(_GPG_HOMEDIR);
GNUPGHOME="$(DESTDIR)$(_GPG_HOMEDIR)" gpg --import gpg.txt; \
- mkdir -p $(DESTDIR)$(WWWPREFIX)/cgi-bin/l
+ mkdir -p $(DESTDIR)$(WWWDIR)/cgi-bin/l
install -Dm700 gpigeon.cgi $(DESTDIR)$(GPIGEON_PATH)
install -Dm600 link-tmpl.cgi $(DESTDIR)$(LINK_TEMPLATE_PATH)
- install -Dm644 index.html favicon.ico styles.css -t $(DESTDIR)$(WWWPREFIX)/gpigeon/
+ install -Dm644 index.html favicon.ico styles.css -t $(DESTDIR)$(WWWDIR)/gpigeon/
install -Dm755 merci/* -t $(DESTDIR)$(PREFIX)/merci/
@if test -e '$(WWWDOMAIN).conf'; then\
printf "\nInstalling $(WWWDOMAIN).conf into $(SITESENABLED)\n";\
install -Dm644 $(WWWDOMAIN).conf -t $(DESTDIR)$(SITESENABLED);\
fi
- chown $(WWWUSER):$(WWWUSER) -R $(DESTDIR)$(PREFIX)/gpigeon || exit 1;
- chown $(WWWUSER):$(WWWUSER) -R $(DESTDIR)$(WWWPREFIX)/gpigeon || exit 1;
+ chown $(WWWUSER):$(WWWGROUP) -R $(DESTDIR)$(GPIGEON_DIR) || exit 1;
+ chown $(WWWUSER):$(WWWGROUP) -R $(DESTDIR)$(WWWDIR)|| exit 1;
nginxconf: nginx-example.conf
- @if test -n '$(WWWDOMAIN)' && test -n '$(WWWPREFIX)'; then\
+ @if test -n '$(WWWDOMAIN)' && test -n '$(WWWDIR)'; then\
printf "Done generating $(WWWDOMAIN).conf for nginx.";\
fi
- @sed -e 's|wwwpath_goes_here|$(WWWPREFIX)|g;s|domain_goes_here|$(WWWDOMAIN)|g' nginx-example.conf > $(WWWDOMAIN).conf ;\
+ @sed -e 's|wwwpath_goes_here|$(WWWDIR)|g;s|domain_goes_here|$(WWWDOMAIN)|g' nginx-example.conf > $(WWWDOMAIN).conf ;\
uninstall:
- rm -rf $(DESTDIR)$(PREFIX)/gpigeon
- rm -rf $(DESTDIR)$(WWWPREFIX)/gpigeon
+ rm -rf $(DESTDIR)$(GPIGEON_DIR)
+ rm -rf $(DESTDIR)$(WWWDIR)
clean:
rm -f genpass.txt gpg.txt link-tmpl.cgi gpigeon.cgi $(WWWDOMAIN).conf
diff --git a/config.def.mk b/config.def.mk
index 28c435c..8af48d7 100644
--- a/config.def.mk
+++ b/config.def.mk
@@ -1,18 +1,23 @@
# Customize below to fit your system
# paths
-PREFIX = /usr/share/gpigeon
+PREFIX = /usr/share
WWWPREFIX = /var/www
-COOKIES_DIR = $(PREFIX)/cookies
-_GPG_HOMEDIR = $(PREFIX)/gnupg
-LINK_TEMPLATE_PATH = $(PREFIX)/link-tmpl.cgi
-GPIGEON_PATH = $(WWWPREFIX)/cgi-bin/gpigeon.cgi
+GPIGEON_DIR = $(PREFIX)/gpigeon
+WWWDIR = $(WWWPREFIX)/gpigeon
+COOKIES_DIR = $(GPIGEON_DIR)/cookies
+UPLOAD_TMPDIR = $(GPIGEON_DIR)/tmp
+LINK_TEMPLATE_PATH = $(GPIGEON_DIR)/link-tmpl.cgi
+_GPG_HOMEDIR = $(GPIGEON_DIR)/gnupg
+GPIGEON_PATH = $(WWWDIR)/cgi-bin/gpigeon.cgi
# system stuff
-WEBUSER=www-data #it must match up with your nginx user. For ex. on arch it's 'http'
+WWWUSER=www-data #it must match up with your nginx user. For ex. on arch it's 'http'
+WWWGROUP=www-data # in general same as WWWUSER
# form customization stuff
MSG_FORM_CHAR_LIMIT = 3000
+MAX_MB_LIMIT = 100
# argon2id hash. generated by genpass.pl if empty when running make
ARGON2ID_HASH =
diff --git a/favicon.ico b/favicon.ico
index 0db8263..0b8fd06 100644
--- a/favicon.ico
+++ b/favicon.ico
Binary files differ
diff --git a/genpass.pl b/genpass.pl
index a57d98b..829ac48 100755
--- a/genpass.pl
+++ b/genpass.pl
@@ -29,12 +29,13 @@ my $opt = $ARGV[0];
sub FillConfigMk {
my $hash = shift;
$hash =~ s/\$/\\044/g;
+ $hash =~ s/\\/\\\\/g;
my $mkconfig = 'config.mk';
if (-e $mkconfig){
open my $in, '<', $mkconfig or die "$!";
open my $out, '>', "$mkconfig.tmp" or die "$!";
while (<$in>){
- s/ARGON2ID_HASH =.*/ARGON2ID_HASH = `printf "$hash"`/gi;
+ s/ARGON2ID_HASH =.*/ARGON2ID_HASH =$hash/gi;
print $out $_;
}
close $out;
diff --git a/gpigeon-template.cgi b/gpigeon-template.cgi
index 59c3a48..9eb82d5 100755
--- a/gpigeon-template.cgi
+++ b/gpigeon-template.cgi
@@ -26,19 +26,21 @@ use CGI qw(param);
use CGI::Cookie;
use CGI::Carp qw(fatalsToBrowser);
+delete @ENV{qw(IFS PATH CDPATH BASH_ENV)};
+$ENV{'PATH'} = q{bin_path_goes_here};
my $uagent = $ENV{HTTP_USER_AGENT};
my $rIP = $ENV{REMOTE_ADDR};
my $hostname = $ENV{'SERVER_NAME'};
sub ValidCookie {
my $client_login_cookie = shift;
+ if (not defined $client_login_cookie){
+ return;
+ }
my $dir = shift;
my $filename = $client_login_cookie->value;
my $login_cookiefile = "$dir/$filename.txt";
- if (not defined $client_login_cookie){
- return;
- }
if ($filename =~ /^([\w]+)$/){
$filename = $1;
}
@@ -48,9 +50,9 @@ sub ValidCookie {
if (-e $login_cookiefile){
open my $in, '<', $login_cookiefile or die "can't read file: $!";
- $rip_line = readline $in;
- $ua_line = readline $in;
- $cookie_line = readline $in;
+ my $rip_line = readline $in;
+ my $ua_line = readline $in;
+ my $cookie_line = readline $in;
close $in;
chomp ($rip_line, $ua_line);
if (not defined $cookie_line){
@@ -101,12 +103,6 @@ sub LoginCookieGen {
}
}
-sub EscapeArobase {
- my $escapedmailaddress = shift;
- $escapedmailaddress =~ s/@/\\@/;
- return $escapedmailaddress;
-}
-
sub UntaintCGIFilename {
my $filename = shift;
if ($filename =~ /^([-\@\w.\/]+)$/) {
@@ -119,24 +115,12 @@ sub UntaintCGIFilename {
return $filename;
}
-sub NotifIfDefined{
- my $notif = shift;
- if (defined $notif){
- return $notif;
- }
- else{
- return '<!--undef notif-->';
- }
-}
-
-my ($linkgen_notif, $link_asker, $mailisok_notif, $deletion_notif,
- $checkedornot, $hidden_pwfield, $id_cookie,
+my ( $link_asker, $checkedornot, $hidden_pwfield, $id_cookie,
$delete_id_cookie, $idval, $refresh_form) = undef;
+my $linkgen_notif = my $mailisok_notif = my $deletion_notif = my $login_notif = '<!-- undef notif -->';
my @created_links = ();
-delete @ENV{qw(IFS PATH CDPATH BASH_ENV)};
-$ENV{'PATH'} = '/usr/bin';
-my $argon2id_hash = q{argon2id_hash_goes_here};
+my $argon2id_hash = qq{argon2id_hash_goes_here};
my $cookies_dir = q{cookies_dir_goes_here};
my $link_template_path = q{link_template_path_goes_here};
@@ -148,24 +132,22 @@ my %text_strings = (
create_link_btn => 'Generate link',
delete_link_btn_text => 'Delete',
delete_links_btn_text => 'Delete all links',
- logout_btn_text => 'Logout',
here => 'here',
+ landingpage_title => 'GPIGEON - Login',
link_asker_field_label => q{Asker's mail :},
- link_web_title => 'One time GPG messaging form',
link_del_ok => 'Successful removal !',
- link_legend_textarea =>'Type your message below :',
- link_send_btn => 'Send',
link_ok_for => 'Generated a link for',
link_del_failed => 'Deletion failed and here is why : ',
+ loginbtn => 'Log in',
+ logout_btn_text => 'Logout',
mailto_body => 'Your link is ',
mailto_subject => 'Link to your one time GPG messaging form',
+ mainpage_title => 'GPIGEON - Main',
notif_login_failure => 'Cannot login. Check if your username and password match.',
refresh_btn_text => 'Refresh',
- type_msg_below => 'Type your message below',
theader_link => 'Link',
theader_for => 'For',
theader_deletion => 'Deletion',
- web_title => 'GPIGEON.CGI: generate one time GPG messaging links !',
web_greet_msg => 'Hi and welcome.',
);
my $cgi_query_get = CGI->new;
@@ -238,7 +220,6 @@ if (ValidCookie($id_cookie, $cookies_dir) or argon2id_verify($argon2id_hash,$pw)
if ( Email::Valid->address($link_asker) ){
$mailisok_notif = qq{<span id="success">$text_strings{addr} $link_asker $text_strings{addr_ok}</span>};
- my $escaped_link_asker = EscapeArobase($link_asker);
my $str_rand_obj = String::Random->new;
my $generated_form_filename = $str_rand_obj->randregex('\w{64}') . '.cgi';
my $href = "https://$hostname/cgi-bin/l/$generated_form_filename";
@@ -248,9 +229,6 @@ if (ValidCookie($id_cookie, $cookies_dir) or argon2id_verify($argon2id_hash,$pw)
open my $out, '>', $link_path or die "Can't write to link file: $!";
while( <$in> ) {
s/{link_user}/{$link_asker}/g;
- s/{link_web_title}/$text_strings{link_web_title}/g;
- s/{link_send_btn}/$text_strings{link_send_btn}/g;
- s/{type_msg_below}/$text_strings{type_msg_below}/g;
print $out $_;
}
close $in or die;
@@ -306,9 +284,10 @@ if (ValidCookie($id_cookie, $cookies_dir) or argon2id_verify($argon2id_hash,$pw)
<link rel="stylesheet" type="text/css" href="/styles.css">
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<meta charset="UTF-8">
- <title>$text_strings{web_title}</title>
+ <title>$text_strings{mainpage_title}</title>
</head>
<body>
+ <h1>$text_strings{mainpage_title}</h1>
<p>$text_strings{web_greet_msg}</p>
<form method="GET">
<input type="hidden" name="logout" value="1">
@@ -322,18 +301,18 @@ if (ValidCookie($id_cookie, $cookies_dir) or argon2id_verify($argon2id_hash,$pw)
$text_strings{link_asker_field_label}<br>
<input id="mailfield" tabindex="1" type="text" name="mail">
<input id="genlinkbtn" tabindex="2" type="submit" value="$text_strings{create_link_btn}">
- </form>},
- NotifIfDefined($mailisok_notif),
- '<br>',
- NotifIfDefined($linkgen_notif),
- qq{<hr>
+ </form>
+ $mailisok_notif
+ <br>
+ $linkgen_notif
+ <hr>
<form method="POST">
$hidden_pwfield
<input type="hidden" name="supprtout">
<input id="deleteallbtn" type="submit" value="$text_strings{delete_links_btn_text}">
- </form>},
- NotifIfDefined($deletion_notif),
- qq{<table>
+ </form>
+ $deletion_notif
+ <table>
<tr>
<th>$text_strings{theader_link} &#128279;</th>
<th>$text_strings{theader_for} &#128231;</th>
@@ -345,5 +324,48 @@ if (ValidCookie($id_cookie, $cookies_dir) or argon2id_verify($argon2id_hash,$pw)
</html>};
}
else{
- print "Location: /\n\n";
+ if (not $logout and defined $id_cookie){
+ $login_notif = q{<span id="failure">You got a cookie problem.<br>
+ <b>Clean them and log again</b></span>};
+ }
+ if (length($pw) > 0){
+ $login_notif = q{<span id="failure">Your typed password seems<br>
+ to be incorrect.<br>Try again.</span>};
+ }
+
+ print "Content-type: text/html\n\n",
+qq{<!DOCTYPE html>
+<html lang="fr">
+<head>
+ <meta charset="utf-8">
+ <link rel="icon" type="image/x-icon" href="/favicon.ico">
+ <link rel="stylesheet" type="text/css" href="/styles.css">
+<title>$text_strings{landingpage_title}</title>
+</head>
+<body>
+ <h1>$text_strings{landingpage_title}</h1>
+<form action="/cgi-bin/gpigeon.cgi" method="POST">
+ <table id="loginbox">
+ <tbody>
+ <tr>
+ <td>Password :</td>
+ <td><input type="password" name="password"></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td id="loginerr">$login_notif</td>
+ </tr>
+ <tr id="authbtn">
+ <td></td>
+ <td><input type="submit" value="$text_strings{loginbtn}"></td>
+ </tr>
+ </tbody>
+ </table>
+ </form>
+
+<p><a href="http://git.les-miquelots.net/gpigeon"
+ title="gpigeon download link">Source code here.</a> It is similar to <a href="https://hawkpost.co/">hawkpost.co</a>.</p>
+
+</body>
+</html>};
}
diff --git a/index.html b/index.html
deleted file mode 100644
index e5f3e13..0000000
--- a/index.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <title>GPIGEON - Login</title>
- <meta charset="utf-8">
- <link rel="icon" type="image/x-icon" href="/favicon.ico">
- <link rel="stylesheet" type="text/css" href="styles.css">
- </head>
- <body>
- <h1>GPIGEON - Login</h1>
- <form action="/cgi-bin/gpigeon.cgi" method="POST">
- <table id="loginbox">
- <tbody>
- <tr>
- <td>Password :</td>
- <td><input type="password" name="password"></td>
- </tr>
- <tr id="authbtn">
- <td></td>
- <td><input type="submit" value="S'authentifier"></td>
- </tr>
- </tbody>
- </table>
- </form>
-
- <p><a href="http://git.les-miquelots.net/gpigeon" title="gpigeon download link">Source code here.</a> It is similar to <a href="https://hawkpost.co/">hawkpost.co</a>.</p>
- </body>
-</html>
diff --git a/link-tmpl-template.cgi b/link-tmpl-template.cgi
index 5c5237d..ec155af 100644
--- a/link-tmpl-template.cgi
+++ b/link-tmpl-template.cgi
@@ -23,7 +23,7 @@ use strict;
use CGI qw(param);
delete @ENV{qw(IFS PATH CDPATH BASH_ENV)};
-$ENV{'PATH'}="/usr/bin";
+$ENV{'PATH'}=q{bin_path_goes_here};
$ENV{TMPDIR} = q{tmp_dir_goes_here};
sub GetRFC822Date {
@@ -38,9 +38,8 @@ sub GetRFC822Date {
my $HAS_MAILSERVER = q{has_mailserver_goes_here};
my $msg_form_char_limit = q{msg_char_limit_goes_here};
-my $max_mb = q{100};
+my $max_mb = q{max_mb_goes_here};
my $mailaddr = q{your_addr_goes_here};
-my $mail_gpgid = q{gpgid_goes_here}; #0xlong keyid form
my $mailsender = q{sender_addr_goes_here};
my $mailsender_smtp = q{smtp_domain_goes_here};
my $mailsender_port = q{smtp_port_goes_here};
@@ -49,7 +48,8 @@ my $GPG_HOMEDIR = q{gpg_homedir_goes_here};
my $cgi_query_get = CGI->new;
my $msg_form = $cgi_query_get->param('msg');
my $length_msg_form = length $msg_form;
-my ($smtp, $enc_msg, $error_processing_msg) = undef;
+my ($smtp, $enc_msg) = undef;
+my $error_processing_msg = '<!-- undef notif -->';
$CGI::POST_MAX = 1024*1024*$max_mb; # 100Mo limit
if (defined $length_msg_form and $length_msg_form > $msg_form_char_limit){
@@ -144,22 +144,18 @@ print qq{<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="/styles.css">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta charset="UTF-8">
- <title>{link_web_title}</title>
+ <title>GPIGEON - Message form</title>
</head>
<body>
- <p id="msgbelow">{type_msg_below}:</p>
+ <p id="msgbelow">Type your message below:</p>
<form method="POST" enctype="multipart/form-data">
- <textarea id="msg" wrap="off" cols="50" rows="30" name="msg"></textarea><br>
-};
-if (defined $error_processing_msg){
- printf $error_processing_msg;
-}
-printf q{
+ <textarea id="msg" wrap="off" cols="50" rows="30" name="msg"></textarea><br>
+ $error_processing_msg
<label for="filechoice" id="msgbelow">
(Optional) file upload:
<input id="filechoice" type="file" name="file">
</label>
- <input id="sendbtn" type="submit" value="{link_send_btn}">
+ <input id="sendbtn" type="submit" value="Send">
</form>
</body>
</html> };
diff --git a/styles.css b/styles.css
index ff3687e..50ab8ad 100644
--- a/styles.css
+++ b/styles.css
@@ -41,6 +41,14 @@ h1, #msgbelow{
border:1px solid black;
}
+#logoutbtn {
+ display: inline;
+ float:right;
+ top: 0;
+ right: 0;
+ position:absolute;
+}
+
#msg{
display:block;
margin-left:auto;
@@ -65,7 +73,7 @@ h1, #msgbelow{
color:red;
}
-#loginbox {
+#loginbox #loginerr{
border:none;
margin-right:auto;
margin-left:auto
@@ -116,6 +124,10 @@ h1, #msgbelow{
font-size:0.8em;
}
+ h1{
+ font-size:1.5em;
+ }
+
#linkstable th,td{
padding:3px;
}
@@ -131,6 +143,13 @@ h1, #msgbelow{
line-height:15px;
}
+ #logoutbtn {
+ float:none;
+ top:unset;
+ right:unset;
+ position:revert;
+ }
+
#mailfield{
padding: 3px;
}