Compare commits
11 commits
6301cbb595
...
807e0c3586
Author | SHA1 | Date | |
---|---|---|---|
807e0c3586 | |||
34c065a788 | |||
11bc449966 | |||
51b25e1580 | |||
b0327c0a4e | |||
30302dfb84 | |||
48692b4765 | |||
bcc9f7f196 | |||
0464bcd6ba | |||
40fa248e31 | |||
99257788e5 |
14 changed files with 254 additions and 150 deletions
|
@ -1,3 +1,29 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
cp /var/www/html/sample-config/* /var/www/html/config/
|
echo Removing old sample files…
|
||||||
|
rm /var/www/html/config/*.sample.ini
|
||||||
|
|
||||||
|
function write_file() {
|
||||||
|
while read line;
|
||||||
|
do
|
||||||
|
first_char=${line:0:1}
|
||||||
|
|
||||||
|
if [[ $first_char != ";" ]]; then
|
||||||
|
line="; "$line
|
||||||
|
fi
|
||||||
|
echo $line >> $2
|
||||||
|
done < $1
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Setting up new sample config files…
|
||||||
|
def_conf="/var/www/html/default-config/config.default.ini"
|
||||||
|
new_conf="/var/www/html/config/config.sample.ini"
|
||||||
|
write_file $def_conf $new_conf
|
||||||
|
|
||||||
|
def_serv="/var/www/html/default-config/services.default.ini"
|
||||||
|
new_serv="/var/www/html/config/services.sample.ini"
|
||||||
|
write_file $def_serv $new_serv
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo Running HTTPD…
|
||||||
exec apache2-foreground
|
exec apache2-foreground
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en" dir="ltr">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>DAVDiscover Dashboard Example</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>This is to show the basic output of DAVDiscover, displaying the first few URLs</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -22,30 +22,36 @@ class Init {
|
||||||
$loader->request_page();
|
$loader->request_page();
|
||||||
}
|
}
|
||||||
private function get_config(){
|
private function get_config(){
|
||||||
// define the config file location
|
// parse the default config file for default values
|
||||||
$config = Core::root_dir()."/config/config.ini";
|
$default_config = parse_ini_file(Core::root_dir()."/default-config/config.default.ini", true);
|
||||||
|
// define the custom config file location
|
||||||
|
$config_file = Core::root_dir()."/config/config.ini";
|
||||||
|
$config = array();
|
||||||
|
if (file_exists($config_file)) {
|
||||||
|
// if a custom config file exists then parse that file too
|
||||||
|
$config = parse_ini_file($config_file, true);
|
||||||
|
}
|
||||||
|
// merge the default config with the custom config
|
||||||
|
Core::$Config = array_merge($default_config,$config);
|
||||||
|
Core::$Config["PrimaryDomain"] = Core::$Config["Domain"][0];
|
||||||
|
|
||||||
// if it doesn't exist, use the sample file
|
// parse the default services file for default values
|
||||||
// YOU REALLY SHOULD HAVE YOUR OWN CONFIG FILE!!!
|
$default_services = parse_ini_file(Core::root_dir()."/default-config/services.default.ini", true);
|
||||||
|
|
||||||
if (!file_exists($config)) {
|
// define the custom services file location
|
||||||
$config = Core::root_dir()."/sample-config/config.sample.ini";
|
$services_file = Core::root_dir()."/config/services.ini";
|
||||||
|
$services = array();
|
||||||
|
if (file_exists($services_file)) {
|
||||||
|
// if a custom config file exists then parse that file too
|
||||||
|
$services = parse_ini_file($services_file, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// define services file location
|
// merge the default config with the custom config
|
||||||
$services = Core::root_dir()."/config/services.ini";
|
// using replace recursive as the config file contains arrays itself
|
||||||
|
Core::$Config["Services"] = array_replace_recursive($default_services,$services);
|
||||||
|
|
||||||
// if it doesn't exist, use the sample file
|
// get the current git commit, if it exists. For testing
|
||||||
// YOU REALLY SHOULD HAVE YOUR OWN SERVICES FILE!!!
|
|
||||||
|
|
||||||
if (!file_exists($services)) {
|
|
||||||
$services = Core::root_dir()."/sample-config/services.sample.ini";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Store the config settings in the Core::Config variable
|
|
||||||
// the "true" means it's going to parse the headers as well.
|
|
||||||
Core::$Config = parse_ini_file($config, true);
|
|
||||||
Core::$Config["Services"] = parse_ini_file($services, true);
|
|
||||||
Core::$Config["CommitID"] = Core::get_current_git_commit();
|
Core::$Config["CommitID"] = Core::get_current_git_commit();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php class Core {
|
<?php class Core {
|
||||||
public static $Config;
|
public static $Config;
|
||||||
public const VERSION = "0.0.2";
|
public const VERSION = "0.0.6";
|
||||||
public static $CurrentPage;
|
public static $CurrentPage;
|
||||||
public static function root_dir(){
|
public static function root_dir(){
|
||||||
return $_SERVER['DOCUMENT_ROOT'];
|
return $_SERVER['DOCUMENT_ROOT'];
|
||||||
|
|
|
@ -29,10 +29,6 @@ class Loader {
|
||||||
Core::$CurrentPage = $p;
|
Core::$CurrentPage = $p;
|
||||||
}
|
}
|
||||||
require_once(Core::root_dir()."/public/respond.php");
|
require_once(Core::root_dir()."/public/respond.php");
|
||||||
// } else {
|
|
||||||
// Core::$CurrentPage = "Error";
|
|
||||||
// require_once(Core::RootDir()."/public/error.php");
|
|
||||||
// }
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Responder {
|
||||||
private function get_response(){
|
private function get_response(){
|
||||||
$resp = false;
|
$resp = false;
|
||||||
// Handle the requested URL, using as many known autoconfiguration urls as possible
|
// Handle the requested URL, using as many known autoconfiguration urls as possible
|
||||||
switch (Core::$CurrentPage){
|
switch (strtolower(Core::$CurrentPage)){
|
||||||
case "get/test":
|
case "get/test":
|
||||||
$resp = $this->dummy_response();
|
$resp = $this->dummy_response();
|
||||||
break;
|
break;
|
||||||
|
@ -49,13 +49,14 @@ class Responder {
|
||||||
$resp = $this->moz_auto_config();
|
$resp = $this->moz_auto_config();
|
||||||
break;
|
break;
|
||||||
case "autodiscover/autodiscover.xml":
|
case "autodiscover/autodiscover.xml":
|
||||||
case "Autodiscover/Autodiscover.xml":
|
|
||||||
$resp = $this->ms_autodiscover();
|
$resp = $this->ms_autodiscover();
|
||||||
break;
|
break;
|
||||||
case "autodiscover/autodiscover.json":
|
case "autodiscover/autodiscover.json":
|
||||||
case "Autodiscover/Autodiscover.json":
|
|
||||||
$resp = $this->ms_autodiscover_json();
|
$resp = $this->ms_autodiscover_json();
|
||||||
break;
|
break;
|
||||||
|
case "get/config":
|
||||||
|
$resp = $this->get_config();
|
||||||
|
break;
|
||||||
case "none":
|
case "none":
|
||||||
case "test":
|
case "test":
|
||||||
case "home":
|
case "home":
|
||||||
|
@ -67,6 +68,26 @@ class Responder {
|
||||||
}
|
}
|
||||||
return $resp;
|
return $resp;
|
||||||
}
|
}
|
||||||
|
private function get_config(){
|
||||||
|
$response = new Response();
|
||||||
|
$response->message = "Here's your config...";
|
||||||
|
foreach (Core::$Config as $k => $v){
|
||||||
|
$response->content[$k] = $v;
|
||||||
|
}
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
private function get_username($service,$email_address) {
|
||||||
|
$username = "%EMAILADDRESS%";
|
||||||
|
if(!$service["UsernameIsFQDN"]) {
|
||||||
|
preg_match("/^[^@]+/",$email_address,$matches);
|
||||||
|
if (count($matches) > 0){
|
||||||
|
$username = $matches[0];
|
||||||
|
}
|
||||||
|
} else if ($service["RequireLogonDomain"]) {
|
||||||
|
$username = preg_replace("/[^@]+$/",Core::$Config["LogonDomain"],$email_address,1);
|
||||||
|
}
|
||||||
|
return $username;
|
||||||
|
}
|
||||||
private function all_urls(){
|
private function all_urls(){
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
// Not really useful, unless some lovely app developers want to parse it for their app :)
|
// Not really useful, unless some lovely app developers want to parse it for their app :)
|
||||||
|
@ -75,6 +96,9 @@ class Responder {
|
||||||
|
|
||||||
// Cycle through each service and add to payload
|
// Cycle through each service and add to payload
|
||||||
foreach (Core::$Config["Services"] as $key => $service){
|
foreach (Core::$Config["Services"] as $key => $service){
|
||||||
|
if (!$service["Enabled"]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$response->content[$key] = $service;
|
$response->content[$key] = $service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +156,7 @@ class Response {
|
||||||
public $url;
|
public $url;
|
||||||
public $content_type = "json";
|
public $content_type = "json";
|
||||||
public $message;
|
public $message;
|
||||||
public $headers_set = false;
|
// public $headers_set = false;
|
||||||
public $content = array();
|
public $content = array();
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
// add requested page to response. I don't know why, but it could helpful for diagnostics at some point
|
// add requested page to response. I don't know why, but it could helpful for diagnostics at some point
|
||||||
|
|
|
@ -4,11 +4,10 @@
|
||||||
; The URL of this application
|
; The URL of this application
|
||||||
BaseURL = "https://autoconfig.example.com"
|
BaseURL = "https://autoconfig.example.com"
|
||||||
|
|
||||||
; Set the base email domain for use with this service
|
; Set the email domains for use with this service. The first one is primary.
|
||||||
Domain = example.com
|
; each will need their own DNS A record for autoconfig.domain.name
|
||||||
|
Domain[] = example.com
|
||||||
|
Domain[] = example2.com
|
||||||
|
|
||||||
; If you use a different domain to authenticate with, enter it here
|
; If you use a different domain to authenticate with, enter it here
|
||||||
LogonDomain = example.local
|
LogonDomain = example.local
|
||||||
|
|
||||||
; Change to true if you need the domain/logondomain to form part of the username
|
|
||||||
RequireAuthDomain = false
|
|
116
src/default-config/services.default.ini
Normal file
116
src/default-config/services.default.ini
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
; The Incoming mail Server Config
|
||||||
|
[InMail]
|
||||||
|
|
||||||
|
; Enable this service
|
||||||
|
Enabled = true
|
||||||
|
|
||||||
|
; Mail Type, i.e. IMAP, POP3
|
||||||
|
Type = "IMAP"
|
||||||
|
|
||||||
|
; Your IMAP server
|
||||||
|
Server = "imap.example.com"
|
||||||
|
|
||||||
|
; Your IMAP port
|
||||||
|
Port = 993
|
||||||
|
|
||||||
|
; The socket type : SSL, STARTTLS, or NONE
|
||||||
|
SocketType = SSL
|
||||||
|
|
||||||
|
; Use Secure Password Authentication
|
||||||
|
SPA = false
|
||||||
|
|
||||||
|
; Change to true if you need the domain/logondomain to form part of the username
|
||||||
|
UsernameIsFQDN = false
|
||||||
|
|
||||||
|
; Do you need to authenticate to your mail server? You should! so this should be false!
|
||||||
|
NoAuthRequired = false
|
||||||
|
|
||||||
|
; Authentication type,
|
||||||
|
;"password-cleartext" : Send password in the clear
|
||||||
|
; (dangerous, if SSL isn't used either).
|
||||||
|
; AUTH PLAIN, LOGIN or protocol-native login.
|
||||||
|
;"password-encrypted" : A secure encrypted password mechanism.
|
||||||
|
; Can be CRAM-MD5 or DIGEST-MD5. Not NTLM.
|
||||||
|
;"NTLM": Use NTLM (or NTLMv2 or successors),
|
||||||
|
; the Windows login mechanism.
|
||||||
|
Authentication = password-cleartext
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; The Outgoing mail server config
|
||||||
|
[OutMail]
|
||||||
|
|
||||||
|
; Enable this service
|
||||||
|
Enabled = true
|
||||||
|
|
||||||
|
; Mail type, likely to only be SMTP
|
||||||
|
Type = "SMTP"
|
||||||
|
|
||||||
|
; Your SMTP server
|
||||||
|
Server = "smtp.example.com"
|
||||||
|
|
||||||
|
; Your SMTP port
|
||||||
|
Port = 465
|
||||||
|
|
||||||
|
; The socket type : SSL, STARTTLS or NONE
|
||||||
|
SocketType = SSL
|
||||||
|
|
||||||
|
; See InMail > Authentication
|
||||||
|
Authentication = password-cleartext
|
||||||
|
|
||||||
|
; Use Secure Password Authentication
|
||||||
|
SPA = false
|
||||||
|
|
||||||
|
; Change to true if you need the domain/logondomain to form part of the username
|
||||||
|
UsernameIsFQDN = false
|
||||||
|
|
||||||
|
; Do you need to authenticate to your mail server? You should! so this should be false!
|
||||||
|
NoAuthRequired = false
|
||||||
|
|
||||||
|
; Use POP Authentication? You probably shouldn't be.
|
||||||
|
POPAuth = false
|
||||||
|
|
||||||
|
; This setting is here to limit errors, I'm not sure what it does yet.
|
||||||
|
SMTPLast = false
|
||||||
|
|
||||||
|
|
||||||
|
; Currently not implemented, see https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat
|
||||||
|
[Calendar]
|
||||||
|
; Disable this service
|
||||||
|
Enabled = false
|
||||||
|
Server = "https://example.com/remote.php/dav/"
|
||||||
|
Port = 443
|
||||||
|
Type = CalDAV
|
||||||
|
Authentication = http-basic
|
||||||
|
UsernameIsFQDN = false
|
||||||
|
|
||||||
|
; Currently not implemented, see https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat
|
||||||
|
[AddressBook]
|
||||||
|
; Disable this service
|
||||||
|
Enabled = false
|
||||||
|
Server = "https://example.com/remote.php/dav/"
|
||||||
|
Port = 443
|
||||||
|
Type = CardDAV
|
||||||
|
Authentication = http-basic
|
||||||
|
UsernameIsFQDN = false
|
||||||
|
|
||||||
|
; Currently not implemented, see https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat
|
||||||
|
[WebMail]
|
||||||
|
; Disable this service
|
||||||
|
Enabled = false
|
||||||
|
Server = https://mail.example.com
|
||||||
|
UsernameDivID = "username"
|
||||||
|
UsernameDivName = "username"
|
||||||
|
PasswordDivName = "password"
|
||||||
|
SubmitButtonID = "submit"
|
||||||
|
SubmitButtonName = "submit"
|
||||||
|
UsernameIsFQDN = false
|
||||||
|
|
||||||
|
|
||||||
|
; In theory, additional custom services can be configured and will be displayed with
|
||||||
|
; their options on the /get/all URL of this service. The third-party clients would need to
|
||||||
|
; check this service as part of their development for this to work
|
||||||
|
; Will not be shown in autodiscover.xml/json or config-v1.1.xml/autoconfig.xml
|
||||||
|
; i.e Nextcloud - ideally a nextcloud client could check autoconfig for this URL for ease of set up
|
||||||
|
;[Nextcloud]
|
||||||
|
;Server = https://nextcloud.example.com
|
|
@ -1,91 +1,64 @@
|
||||||
<?php
|
<?php
|
||||||
|
// Get some core information to help with generation.
|
||||||
// Errrrrrrrrgh, this is sooooo messy, I'm going to tidy this up
|
$services = Core::$Config["Services"];
|
||||||
// It's basically configuring the format of the email address dependent on
|
|
||||||
// variables set in the config file.
|
|
||||||
// i.e. if the domain isn't required for authentication then it strips the
|
|
||||||
// username back to just the pre-@ part. Or, if the username requires a different
|
|
||||||
// logon domain, then it replaces the email domain with the localdomain
|
|
||||||
//
|
|
||||||
// TODO: TIDY THIS UP!!
|
|
||||||
$conf = Core::$Config["Services"];
|
|
||||||
$data = Core::get_get_data();
|
$data = Core::get_get_data();
|
||||||
$email_provided = false;
|
if (isset($data["emailaddress"])) {
|
||||||
$display_name = false;
|
|
||||||
$emailaddress = false;
|
|
||||||
if ($data["emailaddress"]) {
|
|
||||||
$email_address = $data["emailaddress"];
|
$email_address = $data["emailaddress"];
|
||||||
$display_name = $email_address;
|
|
||||||
$email_provided = true;
|
|
||||||
} else if ($data["path"]) {
|
|
||||||
$query = parse_url($data["path"]);
|
|
||||||
$email_address = explode("=",$query["query"]);
|
|
||||||
if ($email_address[0] == "emailaddress") {
|
|
||||||
$email_address = $email[1];
|
|
||||||
$email_provided = true;
|
|
||||||
$display_name = $email_address;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ($email_provided) {
|
|
||||||
if(!Core::$Config["RequireAuthDomain"]) {
|
|
||||||
$email_address = str_ireplace("@".Core::$Config["Domain"],"",$email_address);
|
|
||||||
} else if (Core::$Config["LogonDomain"]) {
|
|
||||||
$email_address = str_ireplace(Core::$Config["Domain"],Core::$Config["LogonDomain"],$email_address);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The below link has config-v1.1.xml information
|
// The below link has config-v1.1.xml information
|
||||||
// https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat
|
// https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat
|
||||||
?>
|
?>
|
||||||
<clientConfig version="1.1">
|
<clientConfig version="1.1">
|
||||||
<emailProvider id="<?php echo Core::$Config["Domain"]?>">
|
<emailProvider id="<?php echo Core::$Config["PrimaryDomain"]?>">
|
||||||
<domain><?php echo Core::$Config["Domain"]?></domain>
|
<?php foreach (Core::$Config["Domain"] as $domain){ ?>
|
||||||
<displayName><?php echo $email_provided ? $display_name : "%EMAILADDRESS%" ;?></displayName>
|
<domain><?php echo $domain; ?></domain>
|
||||||
<?php if($conf["InMail"]){
|
<?php } ?>
|
||||||
$in = $conf["InMail"]; ?>
|
<displayName>%EMAILADDRESS%</displayName>
|
||||||
<incomingServer type="<?php echo strtolower($in["Type"]);?>">
|
<?php if($services["InMail"]&& $services["InMail"]["Enabled"]){
|
||||||
<hostname><?php echo $in["Server"];?></hostname>
|
$service = $services["InMail"]; ?>
|
||||||
<port><?php echo $in["Port"];?></port>
|
<incomingServer type="<?php echo strtolower($service["Type"]);?>">
|
||||||
<socketType><?php echo $in["SocketType"];?></socketType>
|
<hostname><?php echo $service["Server"];?></hostname>
|
||||||
<username><?php echo $email_provided ? $email_address : "%EMAILADDRESS%";?></username>
|
<port><?php echo $service["Port"];?></port>
|
||||||
<authentication><?php echo $in["Authentication"];?></authentication>
|
<socketType><?php echo $service["SocketType"];?></socketType>
|
||||||
|
<username><?php echo $this->get_username($service,$email_address); ?></username>
|
||||||
|
<authentication><?php echo $service["Authentication"];?></authentication>
|
||||||
</incomingServer>
|
</incomingServer>
|
||||||
<?php }
|
<?php }
|
||||||
if($conf["OutMail"]){
|
if($services["OutMail"]&& $services["OutMail"]["Enabled"]){
|
||||||
$out = $conf["OutMail"]; ?>
|
$service = $services["OutMail"]; ?>
|
||||||
<outgoingServer type="<?php echo strtolower($out["Type"]);?>">
|
<outgoingServer type="<?php echo strtolower($service["Type"]);?>">
|
||||||
<hostname><?php echo $out["Server"];?></hostname>
|
<hostname><?php echo $service["Server"];?></hostname>
|
||||||
<port><?php echo $out["Port"];?></port>
|
<port><?php echo $service["Port"];?></port>
|
||||||
<socketType><?php echo $out["SocketType"];?></socketType>
|
<socketType><?php echo $service["SocketType"];?></socketType>
|
||||||
<username><?php echo $email_provided ? $email_address : "%EMAILADDRESS%";?></username>
|
<username><?php echo $this->get_username($service,$email_address);?></username>
|
||||||
<authentication><?php echo $out["Authentication"];?></authentication>
|
<authentication><?php echo $service["Authentication"];?></authentication>
|
||||||
</outgoingServer>
|
</outgoingServer>
|
||||||
<?php }
|
<?php }
|
||||||
if ($conf["AddressBook"]) {
|
if ($services["AddressBook"] && $services["AddressBook"]["Enabled"]) {
|
||||||
$card = $conf["AddressBook"]; ?>
|
$service = $services["AddressBook"]; ?>
|
||||||
<addressBook type="<?php echo strtolower($card["Type"]); ?>">
|
<addressBook type="<?php echo strtolower($service["Type"]); ?>">
|
||||||
<username><?php echo $email_provided ? $email_address : "%EMAILADDRESS%";?></username>
|
<username><?php echo $this->get_username($service,$email_address);?></username>
|
||||||
<authentication><?php echo $card["Authentication"] ? $card["Authentication"] : "http-basic" ;?></authentication>
|
<authentication><?php echo $service["Authentication"];?></authentication>
|
||||||
<serverURL><?php echo $card["Server"];?></serverURL>
|
<serverURL><?php echo $service["Server"];?></serverURL>
|
||||||
</addressBook>
|
</addressBook>
|
||||||
<?php }
|
<?php }
|
||||||
if ($conf["Calendar"]){
|
if ($services["Calendar"] && $services["Calendar"]["Enabled"]){
|
||||||
$cal = $conf["Calendar"] ;?>
|
$service = $services["Calendar"] ;?>
|
||||||
<calendar type="<?php echo strtolower($cal["Type"]);?>">
|
<calendar type="<?php echo strtolower($service["Type"]);?>">
|
||||||
<username><?php echo $email_provided ? $email_address : "%EMAILADDRESS%";?></username>
|
<username><?php echo $this->get_username($service,$email_address);?></username>
|
||||||
<authentication><?php echo $card["Authentication"] ? $card["Authentication"] : "http-basic" ;?></authentication>
|
<authentication><?php echo $service["Authentication"];?></authentication>
|
||||||
<serverURL><?php echo $card["Server"];?></serverURL>
|
<serverURL><?php echo $service["Server"];?></serverURL>
|
||||||
</calendar>
|
</calendar>
|
||||||
<?php }
|
<?php }
|
||||||
if ($conf["WebMail"]) {
|
if ($services["WebMail"] && $services["WebMail"]["Enabled"]) {
|
||||||
$wm = $conf["WebMail"]; ?>
|
$service = $services["WebMail"]; ?>
|
||||||
<webMail>
|
<webMail>
|
||||||
<loginPage url="<?php echo $wm["Server"];?>" />
|
<loginPage url="<?php echo $service["Server"];?>" />
|
||||||
<loginPageInfo url="<?php echo $wm["Server"];?>">
|
<loginPageInfo url="<?php echo $service["Server"];?>">
|
||||||
<username><?php echo $email_provided ? $email_address : "%EMAILADDRESS%";?></username>
|
<username><?php echo $this->get_username($service,$email_address);?></username>
|
||||||
<usernameField id="<?php echo $wm["UsernameDivID"];?>" name="<?php echo $wm["UsernameDivName"];?>" />
|
<usernameField id="<?php echo $service["UsernameDivID"];?>" name="<?php echo $service["UsernameDivName"];?>" />
|
||||||
<passwordField name="<?php echo $wm["PasswordDivName"];?>" />
|
<passwordField name="<?php echo $service["PasswordDivName"];?>" />
|
||||||
<loginButton id="<?php echo $wm["SubmitButtonID"];?>" name="<?php echo $wm["SubmitButtonName"];?>"/>
|
<loginButton id="<?php echo $service["SubmitButtonID"];?>" name="<?php echo $service["SubmitButtonName"];?>"/>
|
||||||
</loginPageInfo>
|
</loginPageInfo>
|
||||||
</webMail>
|
</webMail>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
|
@ -8,38 +8,38 @@ preg_match("/\<EMailAddress\>(.*?)\<\/EMailAddress\>/", $data, $matches);
|
||||||
// <?xml version="1.0" \?\>
|
// <?xml version="1.0" \?\>
|
||||||
// <Autodiscover xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006">
|
// <Autodiscover xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006">
|
||||||
// <Request>
|
// <Request>
|
||||||
// <EMailAddress>psw@wilde.cloud</EMailAddress>
|
// <EMailAddress>your@email.address</EMailAddress>
|
||||||
// <AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema>
|
// <AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema>
|
||||||
// </Request>
|
// </Request>
|
||||||
// </Autodiscover>
|
// </Autodiscover>
|
||||||
|
|
||||||
echo '<?xml version="1.0" encoding="utf-8" ?>';?>
|
echo '<?xml version="1.0" encoding="utf-8" ?>';?>
|
||||||
<Autodiscover xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
|
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
|
||||||
<Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
|
<Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
|
||||||
<Account>
|
<Account>
|
||||||
<AccountType>email</AccountType>
|
<AccountType>email</AccountType>
|
||||||
<Action>settings</Action>
|
<Action>settings</Action>
|
||||||
<?php if ($conf["InMail"]){
|
<?php if ($conf["InMail"] && $conf["InMail"]["Enabled"]){
|
||||||
$in = $conf["InMail"];?>
|
$in = $conf["InMail"];?>
|
||||||
<Protocol>
|
<Protocol>
|
||||||
<Type><?php echo $in["Type"];?></Type>
|
<Type><?php echo $in["Type"];?></Type>
|
||||||
<Server><?php echo $in["Server"];?></Server>
|
<Server><?php echo $in["Server"];?></Server>
|
||||||
<Port><?php echo $in["Port"];?></Port>
|
<Port><?php echo $in["Port"];?></Port>
|
||||||
<DomainRequired><?php echo Core::$Config["RequireAuthDomain"] ? "on" : "off";?></DomainRequired>
|
<DomainRequired><?php echo Core::$Config["RequireAuthDomain"] ? "on" : "off";?></DomainRequired>
|
||||||
<LoginName><?php echo $matches[1]; ?></LoginName>
|
<LoginName><?php echo isset($matches[1]) ? $matches[1] : false ; ?></LoginName>
|
||||||
<SPA><?php echo $in["SPA"] ? "on" : "off";?></SPA>
|
<SPA><?php echo $in["SPA"] ? "on" : "off";?></SPA>
|
||||||
<SSL><?php echo $in["SocketType"] == "SSL" ? "on" : "off";?></SSL>
|
<SSL><?php echo $in["SocketType"] == "SSL" ? "on" : "off";?></SSL>
|
||||||
<AuthRequired><?php echo $in["NoAuthRequired"] ? "off" : "on";?></AuthRequired>
|
<AuthRequired><?php echo $in["NoAuthRequired"] ? "off" : "on";?></AuthRequired>
|
||||||
</Protocol>
|
</Protocol>
|
||||||
<?php }
|
<?php }
|
||||||
if ($conf["OutMail"]) {
|
if ($conf["OutMail"]&& $conf["OutMail"]["Enabled"]) {
|
||||||
$out = $conf["OutMail"];?>
|
$out = $conf["OutMail"];?>
|
||||||
<Protocol>
|
<Protocol>
|
||||||
<Type><?php echo $out["Type"];?></Type>
|
<Type><?php echo $out["Type"];?></Type>
|
||||||
<Server><?php echo $out["Server"];?></Server>
|
<Server><?php echo $out["Server"];?></Server>
|
||||||
<Port><?php echo $out["Port"];?></Port>
|
<Port><?php echo $out["Port"];?></Port>
|
||||||
<DomainRequired><?php echo Core::$Config["RequireAuthDomain"] ? "on" : "off";?></DomainRequired>
|
<DomainRequired><?php echo Core::$Config["RequireAuthDomain"] ? "on" : "off";?></DomainRequired>
|
||||||
<LoginName><?php echo $matches[1]; ?></LoginName>
|
<LoginName><?php echo isset($matches[1]) ? $matches[1] : false ; ?></LoginName>
|
||||||
<SPA><?php echo $in["SPA"] ? "on" : "off";?></SPA>
|
<SPA><?php echo $in["SPA"] ? "on" : "off";?></SPA>
|
||||||
<Encryption><?php echo $in["SocketType"];?></Encryption>
|
<Encryption><?php echo $in["SocketType"];?></Encryption>
|
||||||
<AuthRequired><?php echo $in["NoAuthRequired"] ? "off" : "on";?></AuthRequired>
|
<AuthRequired><?php echo $in["NoAuthRequired"] ? "off" : "on";?></AuthRequired>
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
[InMail]
|
|
||||||
Type = "IMAP"
|
|
||||||
Server = "imap.example.com"
|
|
||||||
Port = 993
|
|
||||||
SocketType = SSL
|
|
||||||
Authentication = password-cleartext
|
|
||||||
|
|
||||||
[OutMail]
|
|
||||||
Type = "SMTP"
|
|
||||||
Server = "smtp.example.com"
|
|
||||||
Port = 465
|
|
||||||
SocketType = SSL
|
|
||||||
Authentication = password-cleartext
|
|
||||||
|
|
||||||
; Currently not implemented
|
|
||||||
;[Calendar]
|
|
||||||
;Server = "https://example.com/remote.php/dav/"
|
|
||||||
;Port = 443
|
|
||||||
;Type = CalDAV
|
|
||||||
|
|
||||||
; Currently not implemented
|
|
||||||
;[AddressBook]
|
|
||||||
;Server = "https://example.com/remote.php/dav/"
|
|
||||||
;Port = 443
|
|
||||||
;Type = CardDAV
|
|
|
@ -1 +0,0 @@
|
||||||
<EMailAddress>psw@wilde.cloud</EMailAddress>
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
a2enmod rewrite
|
a2enmod rewrite
|
||||||
service apache2 stop
|
service apache2 stop
|
||||||
exec apache2-foreground
|
exec bash /entrypoint.sh
|
||||||
|
|
|
@ -5,6 +5,7 @@ podman run --name mailautoconf-test \
|
||||||
-v ./src:/var/www/html/ \
|
-v ./src:/var/www/html/ \
|
||||||
-v ./config:/var/www/html/config \
|
-v ./config:/var/www/html/config \
|
||||||
-v ./test-entry.sh:/test-entry.sh \
|
-v ./test-entry.sh:/test-entry.sh \
|
||||||
|
-v ./entrypoint.sh:/entrypoint.sh \
|
||||||
--entrypoint "/bin/bash" \
|
--entrypoint "/bin/bash" \
|
||||||
php:7.4-apache \
|
php:7.4-apache \
|
||||||
/test-entry.sh
|
/test-entry.sh
|
||||||
|
|
Loading…
Reference in a new issue