improved gnupg support
This commit is contained in:
parent
c1df42dfca
commit
11bae7c906
|
@ -54,7 +54,7 @@ use vars qw[$TEXT_ENCODE]; $TEXT_ENCODE='us-ascii'; # by ooyama for multibyte co
|
|||
|
||||
# "pagedata" contains the hdf tree for clearsilver
|
||||
# "pagename" refers to the template file that should be used
|
||||
# "ui_set" is the selected kind of interface ("normal", "gnupg", ...)
|
||||
# "ui_set" is the selected kind of interface ("default", "gnupg", ...)
|
||||
# "ui_template" is one of "basic", "normal" and "expert"
|
||||
use vars qw[$pagedata $pagename $error $customError $warning $customWarning $success];
|
||||
use vars qw[$ui_set $ui_template];
|
||||
|
@ -214,6 +214,26 @@ elsif ($action eq '' || $action eq 'list_select') {
|
|||
$error = 'ParameterMissing';
|
||||
$pagename = 'list_select';
|
||||
}
|
||||
} elsif (($action eq 'gnupg_ask') || ($action eq 'gnupg_do')) {
|
||||
# User wants to manage keys (only for encrypted mailing lists)
|
||||
my $subset = $q->param('gnupg_subset');
|
||||
if (defined($q->param('list')) && ($subset ne '')) {
|
||||
if (($subset =~ /^[\w]*$/) && (-e "$TEMPLATE_DIR/gnupg_$subset" . ".cs")) {
|
||||
$pagename = 'gnupg_' . $subset;
|
||||
} else {
|
||||
$pagename = '';
|
||||
}
|
||||
if ($pagename ne '') {
|
||||
$success = 'UpdateGnupg' if (($action eq 'gnupg_do') && &update_gnupg());
|
||||
} else {
|
||||
$error = 'UnknownGnupgPage';
|
||||
warn "missing gnupg page: $subset";
|
||||
$pagename = 'list_select';
|
||||
}
|
||||
} else {
|
||||
$error = 'ParameterMissing';
|
||||
$pagename = 'list_select';
|
||||
}
|
||||
} elsif ($action eq 'textfiles') {
|
||||
# Edit DIR/text ...
|
||||
if (defined($q->param('list'))) {
|
||||
|
@ -309,17 +329,17 @@ sub load_hdf {
|
|||
# initialize the data for clearsilver
|
||||
my $hdf = ClearSilver::HDF->new();
|
||||
|
||||
$hdf->readFile($LANGUAGE_DIR . '/' . $HTML_LANGUAGE . '.hdf');
|
||||
|
||||
&fatal_error("Template dir ($TEMPLATE_DIR) not found!") unless (-e $TEMPLATE_DIR);
|
||||
$hdf->setValue("TemplateDir", "$TEMPLATE_DIR/");
|
||||
&fatal_error("Language data dir ($LANGUAGE_DIR) not found!") unless (-e $LANGUAGE_DIR);
|
||||
$hdf->setValue("LanguageDir", "$LANGUAGE_DIR/");
|
||||
|
||||
# the "ui_set" may be changed later according to the type of list, that we encounter
|
||||
$ui_set = 'default';
|
||||
&fatal_error("Template dir ($TEMPLATE_DIR) not found!") unless (-e $TEMPLATE_DIR);
|
||||
$hdf->setValue("TemplateDir", "$TEMPLATE_DIR/");
|
||||
|
||||
# TODO: put some language detection and "web_lang" handling here
|
||||
$hdf->readFile($LANGUAGE_DIR . '/' . $HTML_LANGUAGE . '.hdf');
|
||||
|
||||
# "normal", "basic" and "expert" should be supported
|
||||
# TODO: should be selected via web interface
|
||||
$ui_template = "normal";
|
||||
$hdf->setValue("Config.UI.LinkAttrs.web_lang", $HTML_LANGUAGE);
|
||||
$hdf->setValue("Config.UI.LinkAttrs.template", $ui_template);
|
||||
|
@ -469,12 +489,14 @@ sub set_pagedata4list
|
|||
&set_pagedata4list_common($listname, $part_type);
|
||||
|
||||
# is this list encrypted?
|
||||
if (&is_list_encrypted($listname)) {
|
||||
if (&is_list_gnupg($listname)) {
|
||||
# some encryption specific stuff
|
||||
&set_pagedata4list_encrypted($listname);
|
||||
&set_pagedata4list_gnupg($listname);
|
||||
$ui_set = "gnupg";
|
||||
} else {
|
||||
# do the non-encryption configuration
|
||||
&set_pagedata4list_normal($listname, $part_type);
|
||||
$ui_set = "default";
|
||||
}
|
||||
|
||||
return (0==0);
|
||||
|
@ -484,7 +506,7 @@ sub set_pagedata4list
|
|||
|
||||
# extract hdf-data for encrypted lists
|
||||
# non-encrypted lists should not use this function
|
||||
sub set_pagedata4list_encrypted() {
|
||||
sub set_pagedata4list_gnupg() {
|
||||
my ($listname) = @_;
|
||||
my ($gpg_list, %config, $item, @gpg_keys, $gpg_key, %hash);
|
||||
|
||||
|
@ -502,13 +524,16 @@ sub set_pagedata4list_encrypted() {
|
|||
foreach $gpg_key (@gpg_keys) {
|
||||
%hash = $gpg_key;
|
||||
$pagedata->setValue("Data.List.gnupg_keys.public." . $hash{id}, $hash{uid});
|
||||
warn "pubkey: $hash{uid}";
|
||||
}
|
||||
|
||||
# retrieve the currently available secret keys
|
||||
@gpg_keys = $gpg_list->get_secret_keys();
|
||||
foreach $gpg_key (@gpg_keys) {
|
||||
# TODO: %hash is broken!
|
||||
%hash = $gpg_key;
|
||||
$pagedata->setValue("Data.List.gnupg_keys.secret." . $hash{id}, $hash{uid});
|
||||
warn "seckey: " . $hash{uid};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -715,7 +740,7 @@ sub get_list_part
|
|||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
sub is_list_encrypted {
|
||||
sub is_list_gnupg {
|
||||
my ($listname) = @_;
|
||||
return (1==0) unless ($GPG_SUPPORT);
|
||||
|
||||
|
@ -1174,6 +1199,12 @@ sub extract_options_from_params()
|
|||
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
sub update_gnupg {
|
||||
return (0==0);
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
sub update_config {
|
||||
# Save the new user entered config ...
|
||||
|
||||
|
|
12
lang/de.hdf
12
lang/de.hdf
|
@ -19,6 +19,10 @@ Lang {
|
|||
ConfigArchive = Archivierung
|
||||
ConfigProcess = Verarbeitung
|
||||
ConfigAll = Übersicht
|
||||
KeyManagement = Schlüsselverwaltung
|
||||
KeysPublic = öffentliche Schlüssel
|
||||
KeysSecret = private Schlüssel
|
||||
KeysGenerate = Schlüssel anlegen
|
||||
TextFiles = Texte
|
||||
ListSelect = Auswahl einer Liste
|
||||
Properties = Eigenschaften von
|
||||
|
@ -44,6 +48,9 @@ Lang {
|
|||
ListDelete = Löschung von
|
||||
FileSelect = Auswählen eines Textbausteins
|
||||
FileEdit = Bearbeitung des Textbausteins
|
||||
GnupgPublic = Öffentliche Schlüssel
|
||||
GnupgSecret = Private Schlüssel
|
||||
GnupgGenerate = Erzeugen eines Schlüssels
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,6 +60,7 @@ Lang {
|
|||
DeleteAddress = Adresse(n) entfernen
|
||||
AddAddress = Adresse(n) hinzufügen
|
||||
UpdateConfiguration = Einstellungen speichern
|
||||
UpdateGnupg = Schlüsselring aktualisieren
|
||||
EditFile = Datei bearbeiten
|
||||
SaveFile = Datei speichern
|
||||
ResetFile = Angepassten Textbaustein verwerfen
|
||||
|
@ -64,7 +72,8 @@ Lang {
|
|||
ParameterMissing = Diese Aktion benätigt weitere Parameter!
|
||||
Forbidden = Fehler: dir fehlen die notwendigen Rechte für diese Aktion
|
||||
InvalidFileName = Der Dateiname ist nicht zulässig.
|
||||
UnknownConfigPage = Die gähle Konfigurations-Seite existiert nicht!
|
||||
UnknownConfigPage = Diese Konfigurations-Seite existiert nicht!
|
||||
UnknownGnupgPage = Diese GnuPG-Seite existiert nicht!
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,6 +113,7 @@ Lang {
|
|||
CreateList = Die neue Liste wurde erfolgreich angelegt.
|
||||
DeleteList = Die Mailingliste wurde gelöscht.
|
||||
UpdateConfig = Die neuen Einstellungen wurden erfolgreich gespeichert.
|
||||
UpdateGnupg = Der Schlüsselring wurde erfolgreich geändert.
|
||||
SaveFile = Die Datei wurde gespeichert.
|
||||
ResetFile = Der angepasste Textbaustein wurde entfernt. Zukünftig wird stattdessen der systemweite Standard-Baustein verwendet.
|
||||
}
|
||||
|
|
10
lang/en.hdf
10
lang/en.hdf
|
@ -19,6 +19,10 @@ Lang {
|
|||
ConfigArchive = archive
|
||||
ConfigProcess = processing
|
||||
ConfigAll = overview
|
||||
KeyManagement = Key management
|
||||
KeysPublic = public keys
|
||||
KeysSecret = secret keys
|
||||
KeysGenerate = generate key
|
||||
TextFiles = Text files
|
||||
ListSelect = Choose a list
|
||||
Properties = Properties of
|
||||
|
@ -44,6 +48,9 @@ Lang {
|
|||
ListDelete = Delete list
|
||||
FileSelect = Choose a file for editing
|
||||
FileEdit = Editing file
|
||||
GnupgPublic = Public keys
|
||||
GnupgSecret = Secret keys
|
||||
GnupgGenerate = Generate a new keypair
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,6 +60,7 @@ Lang {
|
|||
DeleteAddress = Delete address(es)
|
||||
AddAddress = Add address(es)
|
||||
UpdateConfiguration = Update configuration
|
||||
UpdateGnupg = Update keyring
|
||||
EditFile = Edit file
|
||||
SaveFile = Save file
|
||||
ResetFile = Remove customized file
|
||||
|
@ -65,6 +73,7 @@ Lang {
|
|||
Forbidden = Error: you are not allowed to do this!
|
||||
InvalidFileName = The name of the file is invalid!
|
||||
UnknownConfigPage = The chosen config page is invalid!
|
||||
UnknownGnupgPage = The chosen gnupg page is invalid!
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,6 +113,7 @@ Lang {
|
|||
CreateList = The new mailing list was successfully created.
|
||||
DeleteList = The mailing list was successfully removed.
|
||||
UpdateConfig = The mailing list's configuration was successfully changed.
|
||||
UpdateGnupg = The keyring was successfully changed.
|
||||
SaveFile = The file was saved.
|
||||
ResetFile = The customized text file was successfully removed. From now on, the system-wide default text file will be used instead of it.
|
||||
}
|
||||
|
|
0
template/config_options/gpg_allow_key_submission
Normal file
0
template/config_options/gpg_allow_key_submission
Normal file
0
template/config_options/gpg_encrypt_to_all
Normal file
0
template/config_options/gpg_encrypt_to_all
Normal file
0
template/config_options/gpg_nokey_nocrypt
Normal file
0
template/config_options/gpg_nokey_nocrypt
Normal file
0
template/config_options/gpg_require_subscriber
Normal file
0
template/config_options/gpg_require_subscriber
Normal file
0
template/config_options/gpg_sign_messages
Normal file
0
template/config_options/gpg_sign_messages
Normal file
0
template/config_options/gpg_verified_key_required
Normal file
0
template/config_options/gpg_verified_key_required
Normal file
|
@ -3,7 +3,7 @@
|
|||
<?cs var:html_escape(Lang.Misc.AllowedToEdit) ?>
|
||||
<ul><li><input type="text"
|
||||
name="webusers" value="<?cs if:Data.List.WebUsers
|
||||
?>var:html_escape(Data.List.WebUsers) ?><?cs
|
||||
?><?cs var:html_escape(Data.List.WebUsers) ?><?cs
|
||||
else ?><?cs
|
||||
var:html_escape(Data.WebUser.UserName)
|
||||
?><?cs /if ?>" size="40" /><br/>
|
||||
|
|
32
template/gnupg_public.cs
Normal file
32
template/gnupg_public.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
<div class="title">
|
||||
<h1><?cs var:html_escape(Lang.Title.GnupgPublic) ?></h1>
|
||||
</div>
|
||||
|
||||
<div class="introduction">
|
||||
<p><?cs var:html_escape(Lang.Introduction.GnupgPublic) ?></p>
|
||||
</div>
|
||||
|
||||
<fieldset class="form">
|
||||
<legend><?cs var:html_escape(Lang.Legend.GnupgPublic) ?> </legend>
|
||||
|
||||
<form method="post" action="<?cs call:link("","","","","","") ?>" enctype="application/x-www-form-urlencoded">
|
||||
<input type="hidden" name="gnupg_subset" value="public" />
|
||||
|
||||
<?cs call:show_options(UI.Options.Keymanagement.Public) ?>
|
||||
|
||||
<?cs if:subcount(Data.List.gnupg_keys.public) > 0 ?>
|
||||
<ul>
|
||||
<?cs each:key = Data.List.gnupg_keys.public
|
||||
?><li><?cs var:name(key) ?> - <?cs var:key ?></li>
|
||||
<?cs /each ?>
|
||||
</ul><?cs /if ?>
|
||||
|
||||
<!-- include default form values -->
|
||||
<?cs include:TemplateDir + '/form_common.cs' ?>
|
||||
|
||||
<input type="hidden" name="action" value="gnupg_do" />
|
||||
<button type="submit" name="send" value="do"><?cs var:html_escape(Lang.Buttons.UpdateGnupg) ?></button>
|
||||
|
||||
</form>
|
||||
|
||||
</fieldset>
|
|
@ -110,6 +110,33 @@
|
|||
var:html_escape(Lang.Menue.ConfigAll) ?></a></li><?cs /if ?>
|
||||
</ul></li>
|
||||
|
||||
<?cs if:subcount(UI.Navigation.Keymanagement) > 0
|
||||
?><li><font class="no_link"><?cs var:html_escape(Lang.Menue.KeyManagement)
|
||||
?></font>
|
||||
<ul>
|
||||
<?cs if:UI.Navigation.Keymanagement.SecretKeys == 1
|
||||
?><li><a <?cs if:(Data.Action == "gnupg_public")
|
||||
?> class="nav_active"<?cs /if ?>
|
||||
href="<?cs call:link("list",Data.List.Name,"action","gnupg_ask",
|
||||
"gnupg_subset","public") ?>"
|
||||
title="<?cs var:html_escape(Lang.Menue.KeysPublic) ?>"><?cs
|
||||
var:html_escape(Lang.Menue.KeysPublic) ?></a></li><?cs /if ?>
|
||||
<?cs if:UI.Navigation.Keymanagement.SecretKeys == 1
|
||||
?><li><a <?cs if:(Data.Action == "gnupg_secret")
|
||||
?> class="nav_active"<?cs /if ?>
|
||||
href="<?cs call:link("list",Data.List.Name,"action","gnupg_ask",
|
||||
"gnupg_subset","secret") ?>"
|
||||
title="<?cs var:html_escape(Lang.Menue.KeysSecret) ?>"><?cs
|
||||
var:html_escape(Lang.Menue.KeysSecret) ?></a></li><?cs /if ?>
|
||||
<?cs if:UI.Navigation.Keymanagement.GenerateKey == 1
|
||||
?><li><a <?cs if:(Data.Action == "gnupg_generate")
|
||||
?> class="nav_active"<?cs /if ?>
|
||||
href="<?cs call:link("list",Data.List.Name,"action","gnupg_ask",
|
||||
"gnupg_subset","generate") ?>"
|
||||
title="<?cs var:html_escape(Lang.Menue.KeysGenerate) ?>"><?cs
|
||||
var:html_escape(Lang.Menue.KeysGenerate) ?></a></li><?cs /if ?>
|
||||
</ul></li><?cs /if ?>
|
||||
|
||||
<?cs if:UI.Navigation.TextEdit == 1
|
||||
?><li><a <?cs if:((Data.Action == "textfiles")
|
||||
|| (Data.Action == "textfile_edit")) ?> class="nav_active"<?cs /if ?>
|
||||
|
|
60
template/ui/gnupg/normal.hdf
Normal file
60
template/ui/gnupg/normal.hdf
Normal file
|
@ -0,0 +1,60 @@
|
|||
UI {
|
||||
|
||||
Navigation {
|
||||
ListSelect = 1
|
||||
ListCreate = 1
|
||||
Subscribers {
|
||||
Subscribers = 1
|
||||
}
|
||||
|
||||
Config {
|
||||
Main = 1
|
||||
}
|
||||
|
||||
Keymanagement {
|
||||
PublicKeys = 1
|
||||
SecretKeys = 1
|
||||
GenerateKey = 1
|
||||
}
|
||||
|
||||
TextEdit = 1
|
||||
ListDelete = 1
|
||||
|
||||
Help = 1
|
||||
}
|
||||
|
||||
|
||||
Options {
|
||||
|
||||
Create {
|
||||
# TODO: was soll hier ein?
|
||||
Listname = create_listname
|
||||
Listaddress = create_listaddress
|
||||
Listlanguage = lang_select
|
||||
Mysql = mysql
|
||||
Webuser = webusers
|
||||
}
|
||||
|
||||
|
||||
Config {
|
||||
Main {
|
||||
#Language = lang_select
|
||||
#Charset = charset_select
|
||||
SignMessages = gpg_sign_messages
|
||||
EncryptToAll = gpg_encrypt_to_all
|
||||
AllowKeySubmission = gpg_allow_key_submission
|
||||
NokeyNocrypt = gpg_nokey_nocrypt
|
||||
VerifiedKeyReq = gpg_verified_key_required
|
||||
RequireSub = gpg_require_subscriber
|
||||
WebUsers = webusers
|
||||
}
|
||||
|
||||
Keymanagement {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in a new issue