mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-10-26 07:46:35 +01:00
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
yum autoremove epel-release -y
|
||||
rm -f /etc/yum.repos.d/epel.repo
|
||||
rm -f /etc/yum.repos.d/epel.repo.rpmsave
|
||||
yum install epel-release -y
|
||||
#some provider's centos7 template come with incorrect or misconfigured epel.repo
|
||||
if systemctl is-active named | grep -q 'active'; then
|
||||
systemctl stop named
|
||||
systemctl disable named
|
||||
echo "Disabling named to aviod powerdns conflicts..."
|
||||
else
|
||||
echo "named is not installed or active, to next step..."
|
||||
fi
|
||||
# above if will check if server has named.service running that occupies port 53 which makes powerdns failed to start
|
||||
yum clean all
|
||||
yum update -y
|
||||
yum install wget which curl -y
|
||||
setenforce 0
|
||||
sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
|
||||
wget https://mirror.cyberpanel.net/install-cn.tar.gz
|
||||
tar xzvf install-cn.tar.gz
|
||||
cd install-cn
|
||||
chmod +x install.py
|
||||
server_ip="$(wget -qO- http://whatismyip.akamai.com/)"
|
||||
python install.py $server_ip
|
||||
8
install-cn/FileManager/.idea/FIleManager.iml
generated
8
install-cn/FileManager/.idea/FIleManager.iml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
8
install-cn/FileManager/.idea/modules.xml
generated
8
install-cn/FileManager/.idea/modules.xml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/FIleManager.iml" filepath="$PROJECT_DIR$/.idea/FIleManager.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
249
install-cn/FileManager/.idea/workspace.xml
generated
249
install-cn/FileManager/.idea/workspace.xml
generated
@@ -1,249 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="9320a755-b878-4593-8eac-7d773157fabd" name="Default" comment="" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="fileManager.php" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/php/fileManager.php">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="689">
|
||||
<caret line="610" column="5" lean-forward="true" selection-start-line="610" selection-start-column="5" selection-end-line="610" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="n#listDir#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#listForTable#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#readFileContents#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#writeFileContents#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#createNewFolder#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#createNewFile#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#deleteFolderOrFile#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#compress#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#extract#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#moveFileAndFolders#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#copyFileAndFolders#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#renameFileOrFolder#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="CSS File" />
|
||||
<option value="HTML File" />
|
||||
<option value="JavaScript File" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>../../assets</find>
|
||||
<find>ajax/libs/angularjs/1.2.12/angular.js</find>
|
||||
<find>AbnTestController</find>
|
||||
<find>AbnTest</find>
|
||||
<find>listAction</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>assets</replace>
|
||||
</replaceStrings>
|
||||
</component>
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/assets/prac.js" />
|
||||
<option value="$PROJECT_DIR$/javaprac.html" />
|
||||
<option value="$PROJECT_DIR$/admin-blog.html" />
|
||||
<option value="$PROJECT_DIR$/tree.html" />
|
||||
<option value="$PROJECT_DIR$/js/tree.js" />
|
||||
<option value="$PROJECT_DIR$/js/fileManager.js" />
|
||||
<option value="$PROJECT_DIR$/css/fileManager.css" />
|
||||
<option value="$PROJECT_DIR$/index.html" />
|
||||
<option value="$PROJECT_DIR$/php/fileManager.php" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
|
||||
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
|
||||
<component name="JsGulpfileManager">
|
||||
<detection-done>true</detection-done>
|
||||
<sorting>DEFINITION_ORDER</sorting>
|
||||
</component>
|
||||
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="x" value="1402" />
|
||||
<option name="y" value="4" />
|
||||
<option name="width" value="1299" />
|
||||
<option name="height" value="764" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
||||
<flattenPackages />
|
||||
<showMembers />
|
||||
<showModules />
|
||||
<showLibraryContents />
|
||||
<hideEmptyPackages />
|
||||
<abbreviatePackageNames />
|
||||
<autoscrollToSource />
|
||||
<autoscrollFromSource />
|
||||
<sortByType />
|
||||
<manualOrder />
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scratches" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="FileManager" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="FileManager" type="2a2b976b:PhpTreeStructureProvider$1" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="FileManager" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="FileManager" type="2a2b976b:PhpTreeStructureProvider$1" />
|
||||
<item name="php" type="2a2b976b:PhpTreeStructureProvider$1" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="DefaultHtmlFileTemplate" value="HTML File" />
|
||||
<property name="list.type.of.created.stylesheet" value="CSS" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ShelveChangesManager" show_recycled="false">
|
||||
<option name="remove_strategy" value="false" />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="9320a755-b878-4593-8eac-7d773157fabd" name="Default" comment="" />
|
||||
<created>1511505785266</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1511505785266</updated>
|
||||
<workItem from="1511505786403" duration="25402000" />
|
||||
<workItem from="1512371928726" duration="717000" />
|
||||
<workItem from="1512401006678" duration="9000" />
|
||||
<workItem from="1512401100852" duration="2365000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="28493000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="1431" y="-4" width="1301" height="772" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.21214451" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32934132" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="VcsContentAnnotationSettings">
|
||||
<option name="myLimit" value="2678400000" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<option name="time" value="1" />
|
||||
</breakpoint-manager>
|
||||
<watches-manager />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/php/fileManager.php">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#listDir#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#listForTable#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#readFileContents#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#writeFileContents#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#createNewFolder#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#createNewFile#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#deleteFolderOrFile#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#compress#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#extract#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#moveFileAndFolders#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#copyFileAndFolders#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#renameFileOrFolder#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/assets/prac.js" />
|
||||
<entry file="file://$PROJECT_DIR$/index-alt.html" />
|
||||
<entry file="file://$PROJECT_DIR$/admin-blog.html" />
|
||||
<entry file="file://$PROJECT_DIR$/javaprac.html" />
|
||||
<entry file="file://$PROJECT_DIR$/js/tree.js" />
|
||||
<entry file="file://$PROJECT_DIR$/tree.html" />
|
||||
<entry file="file://$PROJECT_DIR$/js/fileManager.js" />
|
||||
<entry file="file://$PROJECT_DIR$/css/fileManager.css" />
|
||||
<entry file="file://$PROJECT_DIR$/index.html" />
|
||||
<entry file="file://$PROJECT_DIR$/php/fileManager.php">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="689">
|
||||
<caret line="610" column="5" lean-forward="true" selection-start-line="610" selection-start-column="5" selection-end-line="610" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="n#listDir#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#listForTable#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#readFileContents#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#writeFileContents#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#createNewFolder#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#createNewFile#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#deleteFolderOrFile#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#compress#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#extract#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#moveFileAndFolders#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#copyFileAndFolders#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
<element signature="n#renameFileOrFolder#0;n#fileManager#0;n#!!top" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,108 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Caller{
|
||||
|
||||
private $basePath = null;
|
||||
|
||||
public function __construct($basePath = null)
|
||||
{
|
||||
$this->basePath = $basePath ?: dirname(__DIR__);
|
||||
}
|
||||
|
||||
public function requestHandler()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' and isset($_POST['method'])) {
|
||||
|
||||
switch ($_POST['method']) {
|
||||
case 'upload':
|
||||
$this->uploadFile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function uploadFile(){
|
||||
try {
|
||||
if (!empty($_FILES)) {
|
||||
|
||||
if($this->return_bytes(ini_get('upload_max_filesize')) < $_SERVER['CONTENT_LENGTH']){
|
||||
throw new Exception("Size of uploaded file is greater than upload limit!");
|
||||
}
|
||||
|
||||
$completePath = $this->cleanInput($_POST['completePath']);
|
||||
$fileName = $this->cleanInput($_FILES['file']['name']);
|
||||
$homePath = $this->cleanInput($_POST['home']);
|
||||
|
||||
$tempPath = $_FILES['file']['tmp_name'];
|
||||
$uploadPath = $completePath . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
$pos = strpos($uploadPath, $homePath);
|
||||
|
||||
if ($pos === false) {
|
||||
throw new Exception("Not allowed to upload in this path!");
|
||||
}
|
||||
|
||||
|
||||
if(move_uploaded_file($tempPath, $uploadPath)==true){
|
||||
$answer = array(
|
||||
'uploadStatus' => 1,
|
||||
'answer' => 'File transfer completed',
|
||||
'error_message' => "None",
|
||||
'fileName' => $_FILES['file']['name']
|
||||
);
|
||||
$json = json_encode($answer);
|
||||
echo $json;
|
||||
}
|
||||
else{
|
||||
throw new Exception("Can not move uploaded file to destination location!");
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
throw new Exception("No Files to upload!");
|
||||
}
|
||||
}
|
||||
catch(Exception $e) {
|
||||
$answer = array(
|
||||
'uploadStatus' => 0,
|
||||
'answer' => 'No files',
|
||||
'error_message' => $e->getMessage(),
|
||||
'fileName' => $_FILES['file']['name'],
|
||||
);
|
||||
$json = json_encode($answer);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function return_bytes($val) {
|
||||
$val = trim($val);
|
||||
$last = strtolower($val[strlen($val)-1]);
|
||||
switch($last) {
|
||||
// The 'G' modifier is available since PHP 5.1.0
|
||||
case 'g':
|
||||
$val *= 1024;
|
||||
case 'm':
|
||||
$val *= 1024;
|
||||
case 'k':
|
||||
$val *= 1024;
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
private function cleanInput($input) {
|
||||
$search = array(
|
||||
'@<script[^>]*?>.*?</script>@si',
|
||||
'@<[\/\!]*?[^<>]*?>@si',
|
||||
'@<style[^>]*?>.*?</style>@siU',
|
||||
'@<![\s\S]*?--[ \t\n\r]*>@'
|
||||
);
|
||||
$output = preg_replace($search, '', $input);
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$caller = new Caller("/");
|
||||
$caller->requestHandler();
|
||||
@@ -1,633 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
class fileManager
|
||||
{
|
||||
|
||||
private $basePath = null;
|
||||
|
||||
public function requestHandler()
|
||||
{
|
||||
$postdata = file_get_contents("php://input");
|
||||
$request = json_decode($postdata);
|
||||
|
||||
if (isset($request->method)) {
|
||||
|
||||
switch ($request->method) {
|
||||
case 'list':
|
||||
$this->listDir($request->completeStartingPath);
|
||||
break;
|
||||
case 'listForTable':
|
||||
$home = $this->cleanInput($request->home);
|
||||
$completeStartingPath = $this->cleanInput($request->completeStartingPath);
|
||||
$this->listForTable($home,$completeStartingPath);
|
||||
break;
|
||||
case 'readFileContents':
|
||||
$this->readFileContents($request->fileName);
|
||||
break;
|
||||
case 'writeFileContents':
|
||||
$this->writeFileContents($request->fileName, $request->fileContent);
|
||||
break;
|
||||
case 'createNewFolder':
|
||||
$folderName = $this->cleanInput($request->folderName);
|
||||
$this->createNewFolder($folderName);
|
||||
break;
|
||||
case 'createNewFile':
|
||||
$fileName = $this->cleanInput($request->fileName);
|
||||
$this->createNewFile($fileName);
|
||||
break;
|
||||
case 'deleteFolderOrFile':
|
||||
$this->deleteFolderOrFile($request->path, $request->fileAndFolders);
|
||||
break;
|
||||
case 'compress':
|
||||
$compressedFileName = $this->cleanInput($request->compressedFileName);
|
||||
$this->compress($request->basePath, $request->listOfFiles, $compressedFileName, $request->compressionType);
|
||||
break;
|
||||
case 'extract':
|
||||
$extractionLocation = $this->cleanInput($request->extractionLocation);
|
||||
$this->extract($request->home,$request->basePath,$request->fileToExtract,$request->extractionType,$extractionLocation);
|
||||
break;
|
||||
case 'move':
|
||||
$this->moveFileAndFolders($request->home,$request->basePath,$request->newPath,$request->fileAndFolders);
|
||||
break;
|
||||
case 'copy':
|
||||
$this->copyFileAndFolders($request->home,$request->basePath,$request->newPath,$request->fileAndFolders);
|
||||
break;
|
||||
case 'rename':
|
||||
$newFileName = $this->cleanInput($request->newFileName);
|
||||
$this->renameFileOrFolder($request->basePath,$request->existingName,$newFileName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function listDir($basePath)
|
||||
{
|
||||
try {
|
||||
$path = "";
|
||||
$listPath = $basePath . $path;
|
||||
$files = scandir($listPath);
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"fetchStatus" => 1
|
||||
);
|
||||
$counter = 0;
|
||||
|
||||
$tempDir = array();
|
||||
$tempFiles = array();
|
||||
|
||||
// sorting files at end
|
||||
|
||||
foreach ($files as $dirFile) {
|
||||
|
||||
$completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
|
||||
if (is_dir($completePath) == true) {
|
||||
array_push($tempDir, $dirFile);
|
||||
} else {
|
||||
array_push($tempFiles, $dirFile);
|
||||
}
|
||||
}
|
||||
|
||||
$result = array_merge($tempDir, $tempFiles);
|
||||
|
||||
foreach ($result as $dirFile) {
|
||||
if ($dirFile == "." or $dirFile == "..") {
|
||||
continue;
|
||||
}
|
||||
$arrayCounter = 0;
|
||||
$tempArray = array($dirFile);
|
||||
$arrayCounter += 1;
|
||||
$completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
|
||||
$tempArray[$arrayCounter] = $completePath;
|
||||
$arrayCounter += 1;
|
||||
|
||||
if (is_dir($completePath) == true) {
|
||||
$list = true;
|
||||
$tempArray[$arrayCounter] = $list;
|
||||
} else {
|
||||
$list = false;
|
||||
$tempArray[$arrayCounter] = $list;
|
||||
}
|
||||
|
||||
$json_data[(string)$counter] = $tempArray;
|
||||
$counter += 1;
|
||||
|
||||
}
|
||||
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} catch (Exception $e) {
|
||||
$answer = array(
|
||||
'uploadStatus' => 0,
|
||||
'answer' => [1, 2, 3],
|
||||
'error_message' => $e->getMessage(),
|
||||
);
|
||||
$json = json_encode($answer);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function listForTable($home,$basePath)
|
||||
{
|
||||
try {
|
||||
|
||||
$pos = strpos($basePath, $home);
|
||||
|
||||
if ($pos === false) {
|
||||
throw new Exception("Not allowed to browse this path, going back home!");
|
||||
}
|
||||
|
||||
$path = "";
|
||||
$listPath = $basePath . $path;
|
||||
$files = scandir($listPath);
|
||||
$json_data = array("error_message" => "None",
|
||||
"fetchStatus" => 1
|
||||
);
|
||||
$counter = 0;
|
||||
|
||||
$tempDir = array();
|
||||
$tempFiles = array();
|
||||
|
||||
// sorting files at end
|
||||
|
||||
foreach ($files as $dirFile) {
|
||||
|
||||
$completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
|
||||
if (is_dir($completePath) == true) {
|
||||
array_push($tempDir, $dirFile);
|
||||
} else {
|
||||
array_push($tempFiles, $dirFile);
|
||||
}
|
||||
}
|
||||
|
||||
$result = array_merge($tempDir, $tempFiles);
|
||||
|
||||
foreach ($result as $dirFile) {
|
||||
if ($dirFile == "." or $dirFile == "..") {
|
||||
continue;
|
||||
}
|
||||
$arrayCounter = 0;
|
||||
$tempArray = array($dirFile);
|
||||
$arrayCounter += 1;
|
||||
$completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
|
||||
$tempArray[$arrayCounter] = $completePath;
|
||||
$arrayCounter += 1;
|
||||
|
||||
// find last modified
|
||||
|
||||
$lastModified = date("F d Y H:i:s.", filemtime($completePath));
|
||||
$tempArray[$arrayCounter] = $lastModified;
|
||||
$arrayCounter += 1;
|
||||
|
||||
// find size of file
|
||||
|
||||
$fileSize = (int)(filesize($completePath) / 1024);
|
||||
$tempArray[$arrayCounter] = $fileSize;
|
||||
$arrayCounter += 1;
|
||||
|
||||
// find permissions of file
|
||||
|
||||
|
||||
$tempArray[$arrayCounter] = substr(sprintf('%o', fileperms($completePath)), -4);;
|
||||
$arrayCounter += 1;
|
||||
|
||||
|
||||
// Deciding if the current path is file or dir.
|
||||
|
||||
if (is_dir($completePath) == true) {
|
||||
$list = true;
|
||||
$tempArray[$arrayCounter] = $list;
|
||||
} else {
|
||||
$list = false;
|
||||
$tempArray[$arrayCounter] = $list;
|
||||
}
|
||||
|
||||
$json_data[(string)$counter] = $tempArray;
|
||||
$counter += 1;
|
||||
|
||||
}
|
||||
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} catch (Exception $e) {
|
||||
$answer = array(
|
||||
'fetchStatus' => 0,
|
||||
'error_message' => $e->getMessage(),
|
||||
);
|
||||
$json = json_encode($answer);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function readFileContents($pathToFile)
|
||||
{
|
||||
|
||||
try {
|
||||
$listPath = $pathToFile;
|
||||
$contentsofFile = file_get_contents($pathToFile);
|
||||
|
||||
if ($contentsofFile !== false) {
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"fetchStatus" => 1,
|
||||
"fileContents" => $contentsofFile
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} else {
|
||||
throw new Exception("Can not read the file Contents");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"fetchStatus" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function writeFileContents($pathToFile, $fileContent)
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
|
||||
$contentsofFile = file_put_contents($pathToFile, $fileContent);
|
||||
|
||||
if ($contentsofFile !== false) {
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"saveStatus" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} else {
|
||||
throw new Exception("Can not write the file Contents.");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"saveStatus" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function createNewFolder($folderName)
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
|
||||
$returnVal = mkdir($folderName);
|
||||
|
||||
if ($returnVal !== false) {
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"createStatus" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} else {
|
||||
throw new Exception("Can not create Folder");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"createStatus" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function createNewFile($fileName)
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
|
||||
if (touch($fileName)) {
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"createStatus" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} else {
|
||||
throw new Exception("Can not create file!");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"createStatus" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function deleteFolderOrFile($basePath, $fileAndFolders)
|
||||
{
|
||||
try {
|
||||
|
||||
foreach ($fileAndFolders as $path) {
|
||||
|
||||
$path = $basePath . DIRECTORY_SEPARATOR . $path;
|
||||
|
||||
if (is_dir($path) == true) {
|
||||
$commandToExecute = 'rm -rf ' . "'".$path ."'";
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
exec($commandToExecute, $programOutput);
|
||||
} else {
|
||||
if (unlink($path)) {
|
||||
continue;
|
||||
} else {
|
||||
throw new Exception("Can not delete!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"deleteStatus" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"deleteStatus" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function compress($basePath, $listOfFiles, $compressedFileName, $compressionType)
|
||||
{
|
||||
try {
|
||||
|
||||
chdir($basePath);
|
||||
|
||||
if ($compressionType == "zip") {
|
||||
|
||||
$compressedFileName = $basePath . DIRECTORY_SEPARATOR . $compressedFileName . ".zip";
|
||||
|
||||
$commandToExecute = 'zip -r ' . $compressedFileName . ' ';
|
||||
|
||||
foreach ($listOfFiles as $file) {
|
||||
$completePathToFile = $file;
|
||||
$commandToExecute = $commandToExecute ."'". $completePathToFile ."'". ' ';
|
||||
}
|
||||
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
|
||||
exec($commandToExecute, $programOutput);
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => $commandToExecute,
|
||||
"compressed" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
else {
|
||||
|
||||
$compressedFileName = $basePath . DIRECTORY_SEPARATOR . $compressedFileName . ".tar.gz";
|
||||
|
||||
$commandToExecute = 'tar -czvf ' . $compressedFileName . ' ';
|
||||
|
||||
foreach ($listOfFiles as $file) {
|
||||
$completePathToFile = $file;
|
||||
$commandToExecute = $commandToExecute ."'". $completePathToFile ."'". ' ';
|
||||
}
|
||||
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
|
||||
exec($commandToExecute, $programOutput);
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"compressed" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"compressed" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
}
|
||||
|
||||
private function extract($home,$basePath,$completeFileToExtract, $extractionType, $extractionLocation)
|
||||
{
|
||||
try {
|
||||
|
||||
$pos = strpos($extractionLocation, $home);
|
||||
|
||||
if ($pos === false) {
|
||||
throw new Exception("Not allowed to extact in this path, please choose location inside home!");
|
||||
}
|
||||
|
||||
if ($extractionType == "zip") {
|
||||
|
||||
$commandToExecute = 'unzip -o ' . $completeFileToExtract . ' -d ' . $extractionLocation;
|
||||
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
|
||||
exec($commandToExecute, $programOutput);
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => $commandToExecute,
|
||||
"extracted" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} else {
|
||||
|
||||
$commandToExecute = 'tar xf ' . $completeFileToExtract . ' -C ' . $extractionLocation;
|
||||
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
|
||||
exec($commandToExecute, $programOutput);
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"extracted" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
|
||||
|
||||
}
|
||||
}catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"extracted" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
}
|
||||
|
||||
private function moveFileAndFolders($home,$basePath, $newPath, $fileAndFolders)
|
||||
{
|
||||
try {
|
||||
|
||||
$pos = strpos($newPath, $home);
|
||||
|
||||
if ($pos === false) {
|
||||
throw new Exception("Not allowed to move in this path, please choose location inside home!");
|
||||
}
|
||||
|
||||
if(!file_exists($newPath)){
|
||||
if(!mkdir($newPath, 0777, true)){
|
||||
$json_data = array(
|
||||
"error_message" => "Can not create the new folder, it already exists!",
|
||||
"moved" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($fileAndFolders as $path) {
|
||||
|
||||
$completePathToFile = $basePath . DIRECTORY_SEPARATOR . $path;
|
||||
$completeNewPath = $newPath . DIRECTORY_SEPARATOR . $path;
|
||||
|
||||
$commandToExecute = 'mv ' ."'". $completePathToFile . "'" . ' ' . "'" . $completeNewPath . "'";
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
exec($commandToExecute, $programOutput);
|
||||
}
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"moved" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"moved" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function copyFileAndFolders($home,$basePath, $newPath, $fileAndFolders)
|
||||
{
|
||||
try {
|
||||
|
||||
$pos = strpos($newPath, $home);
|
||||
|
||||
if ($pos === false) {
|
||||
throw new Exception("Not allowed to move in this path, please choose location inside home!");
|
||||
}
|
||||
|
||||
if(!file_exists($newPath)){
|
||||
if(!mkdir($newPath, 0777, true)){
|
||||
throw new Exception("Can not create the new folder, it already exists!");
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($fileAndFolders as $path) {
|
||||
|
||||
$completePathToFile = $basePath . DIRECTORY_SEPARATOR . $path;
|
||||
$completeNewPath = $newPath . DIRECTORY_SEPARATOR . $path;
|
||||
|
||||
$commandToExecute = 'cp ' ."'". $completePathToFile . "'" . ' ' . "'" . $completeNewPath . "'";
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
exec($commandToExecute, $programOutput);
|
||||
}
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"copied" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"copied" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function renameFileOrFolder($basePath, $currentName, $newName)
|
||||
{
|
||||
try {
|
||||
|
||||
$completeOldPath = $basePath . DIRECTORY_SEPARATOR . $currentName;
|
||||
$completeNewPath = $basePath . DIRECTORY_SEPARATOR . $newName;
|
||||
|
||||
$commandToExecute = 'mv ' ."'". $completeOldPath . "'" . ' ' . "'" . $completeNewPath . "'";
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
exec($commandToExecute, $programOutput);
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"renamed" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"renamed" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function cleanInput($input) {
|
||||
$search = array(
|
||||
'@<script[^>]*?>.*?</script>@si', // Strip out javascript
|
||||
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
|
||||
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
|
||||
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments
|
||||
);
|
||||
$output = preg_replace($search, '', $input);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
$caller = new fileManager();
|
||||
$caller->requestHandler();
|
||||
@@ -1,4 +0,0 @@
|
||||
[cyberpanel]
|
||||
name=Cyber Panel
|
||||
baseurl=http://repo.cyberpersons.com
|
||||
gpgcheck=0
|
||||
@@ -1,8 +0,0 @@
|
||||
server:
|
||||
hide-version: yes
|
||||
ip4-only: yes
|
||||
server-count: 2
|
||||
tcp-count: 50
|
||||
identity: "CyberCP"
|
||||
zonesdir: "/usr/local/lsws/conf/zones"
|
||||
|
||||
@@ -1,609 +0,0 @@
|
||||
# Autogenerated configuration file template
|
||||
#################################
|
||||
# 8bit-dns Allow 8bit dns queries
|
||||
#
|
||||
# 8bit-dns=no
|
||||
|
||||
#################################
|
||||
# allow-axfr-ips Allow zonetransfers only to these subnets
|
||||
#
|
||||
# allow-axfr-ips=127.0.0.0/8,::1
|
||||
|
||||
#################################
|
||||
# allow-dnsupdate-from A global setting to allow DNS updates from these IP ranges.
|
||||
#
|
||||
# allow-dnsupdate-from=127.0.0.0/8,::1
|
||||
|
||||
#################################
|
||||
# allow-notify-from Allow AXFR NOTIFY from these IP ranges. If empty, drop all incoming notifies.
|
||||
#
|
||||
# allow-notify-from=0.0.0.0/0,::/0
|
||||
|
||||
#################################
|
||||
# allow-unsigned-notify Allow unsigned notifications for TSIG secured domains
|
||||
#
|
||||
# allow-unsigned-notify=yes
|
||||
|
||||
#################################
|
||||
# allow-unsigned-supermaster Allow supermasters to create zones without TSIG signed NOTIFY
|
||||
#
|
||||
# allow-unsigned-supermaster=yes
|
||||
|
||||
#################################
|
||||
# also-notify When notifying a domain, also notify these nameservers
|
||||
#
|
||||
# also-notify=
|
||||
|
||||
#################################
|
||||
# any-to-tcp Answer ANY queries with tc=1, shunting to TCP
|
||||
#
|
||||
# any-to-tcp=yes
|
||||
|
||||
#################################
|
||||
# api Enable/disable the REST API (including HTTP listener)
|
||||
#
|
||||
# api=no
|
||||
|
||||
#################################
|
||||
# api-key Static pre-shared authentication key for access to the REST API
|
||||
#
|
||||
# api-key=
|
||||
|
||||
#################################
|
||||
# api-logfile Location of the server logfile (used by the REST API)
|
||||
#
|
||||
# api-logfile=/var/log/pdns.log
|
||||
|
||||
#################################
|
||||
# api-readonly Disallow data modification through the REST API when set
|
||||
#
|
||||
# api-readonly=no
|
||||
|
||||
#################################
|
||||
# axfr-lower-serial Also AXFR a zone from a master with a lower serial
|
||||
#
|
||||
# axfr-lower-serial=no
|
||||
|
||||
#################################
|
||||
# cache-ttl Seconds to store packets in the PacketCache
|
||||
#
|
||||
# cache-ttl=20
|
||||
|
||||
#################################
|
||||
# carbon-interval Number of seconds between carbon (graphite) updates
|
||||
#
|
||||
# carbon-interval=30
|
||||
|
||||
#################################
|
||||
# carbon-ourname If set, overrides our reported hostname for carbon stats
|
||||
#
|
||||
# carbon-ourname=
|
||||
|
||||
#################################
|
||||
# carbon-server If set, send metrics in carbon (graphite) format to this server IP address
|
||||
#
|
||||
# carbon-server=
|
||||
|
||||
#################################
|
||||
# chroot If set, chroot to this directory for more security
|
||||
#
|
||||
# chroot=
|
||||
|
||||
#################################
|
||||
# config-dir Location of configuration directory (pdns.conf)
|
||||
#
|
||||
# config-dir=/etc/pdns
|
||||
|
||||
#################################
|
||||
# config-name Name of this virtual configuration - will rename the binary image
|
||||
#
|
||||
# config-name=
|
||||
|
||||
#################################
|
||||
# control-console Debugging switch - don't use
|
||||
#
|
||||
# control-console=no
|
||||
|
||||
#################################
|
||||
# daemon Operate as a daemon
|
||||
#
|
||||
daemon=no
|
||||
|
||||
#################################
|
||||
# default-ksk-algorithms Default KSK algorithms
|
||||
#
|
||||
# default-ksk-algorithms=ecdsa256
|
||||
|
||||
#################################
|
||||
# default-ksk-size Default KSK size (0 means default)
|
||||
#
|
||||
# default-ksk-size=0
|
||||
|
||||
#################################
|
||||
# default-soa-edit Default SOA-EDIT value
|
||||
#
|
||||
# default-soa-edit=
|
||||
|
||||
#################################
|
||||
# default-soa-edit-signed Default SOA-EDIT value for signed zones
|
||||
#
|
||||
# default-soa-edit-signed=
|
||||
|
||||
#################################
|
||||
# default-soa-mail mail address to insert in the SOA record if none set in the backend
|
||||
#
|
||||
# default-soa-mail=
|
||||
|
||||
#################################
|
||||
# default-soa-name name to insert in the SOA record if none set in the backend
|
||||
#
|
||||
# default-soa-name=a.misconfigured.powerdns.server
|
||||
|
||||
#################################
|
||||
# default-ttl Seconds a result is valid if not set otherwise
|
||||
#
|
||||
# default-ttl=3600
|
||||
|
||||
#################################
|
||||
# default-zsk-algorithms Default ZSK algorithms
|
||||
#
|
||||
# default-zsk-algorithms=
|
||||
|
||||
#################################
|
||||
# default-zsk-size Default ZSK size (0 means default)
|
||||
#
|
||||
# default-zsk-size=0
|
||||
|
||||
#################################
|
||||
# direct-dnskey Fetch DNSKEY RRs from backend during DNSKEY synthesis
|
||||
#
|
||||
# direct-dnskey=no
|
||||
|
||||
#################################
|
||||
# disable-axfr Disable zonetransfers but do allow TCP queries
|
||||
#
|
||||
# disable-axfr=no
|
||||
|
||||
#################################
|
||||
# disable-axfr-rectify Disable the rectify step during an outgoing AXFR. Only required for regression testing.
|
||||
#
|
||||
# disable-axfr-rectify=no
|
||||
|
||||
#################################
|
||||
# disable-syslog Disable logging to syslog, useful when running inside a supervisor that logs stdout
|
||||
#
|
||||
# disable-syslog=no
|
||||
|
||||
#################################
|
||||
# disable-tcp Do not listen to TCP queries
|
||||
#
|
||||
# disable-tcp=no
|
||||
|
||||
#################################
|
||||
# distributor-threads Default number of Distributor (backend) threads to start
|
||||
#
|
||||
# distributor-threads=3
|
||||
|
||||
#################################
|
||||
# dname-processing If we should support DNAME records
|
||||
#
|
||||
# dname-processing=no
|
||||
|
||||
#################################
|
||||
# dnssec-key-cache-ttl Seconds to cache DNSSEC keys from the database
|
||||
#
|
||||
# dnssec-key-cache-ttl=30
|
||||
|
||||
#################################
|
||||
# dnsupdate Enable/Disable DNS update (RFC2136) support. Default is no.
|
||||
#
|
||||
# dnsupdate=no
|
||||
|
||||
#################################
|
||||
# do-ipv6-additional-processing Do AAAA additional processing
|
||||
#
|
||||
# do-ipv6-additional-processing=yes
|
||||
|
||||
#################################
|
||||
# domain-metadata-cache-ttl Seconds to cache domain metadata from the database
|
||||
#
|
||||
# domain-metadata-cache-ttl=60
|
||||
|
||||
#################################
|
||||
# edns-subnet-processing If we should act on EDNS Subnet options
|
||||
#
|
||||
# edns-subnet-processing=no
|
||||
|
||||
#################################
|
||||
# entropy-source If set, read entropy from this file
|
||||
#
|
||||
# entropy-source=/dev/urandom
|
||||
|
||||
#################################
|
||||
# expand-alias Expand ALIAS records
|
||||
#
|
||||
# expand-alias=no
|
||||
|
||||
#################################
|
||||
# forward-dnsupdate A global setting to allow DNS update packages that are for a Slave domain, to be forwarded to the master.
|
||||
#
|
||||
# forward-dnsupdate=yes
|
||||
|
||||
#################################
|
||||
# forward-notify IP addresses to forward received notifications to regardless of master or slave settings
|
||||
#
|
||||
# forward-notify=
|
||||
|
||||
#################################
|
||||
# guardian Run within a guardian process
|
||||
#
|
||||
guardian=no
|
||||
|
||||
#################################
|
||||
# include-dir Include *.conf files from this directory
|
||||
#
|
||||
# include-dir=
|
||||
|
||||
#################################
|
||||
# launch Which backends to launch and order to query them in
|
||||
#
|
||||
# launch=
|
||||
|
||||
launch=gmysql
|
||||
gmysql-host=127.0.0.1
|
||||
gmysql-port=3307
|
||||
gmysql-user=cyberpanel
|
||||
gmysql-password=1qaz@9xvps
|
||||
gmysql-dbname=cyberpanel
|
||||
|
||||
#################################
|
||||
# load-modules Load this module - supply absolute or relative path
|
||||
#
|
||||
# load-modules=
|
||||
|
||||
#################################
|
||||
# local-address Local IP addresses to which we bind
|
||||
#
|
||||
# local-address=0.0.0.0
|
||||
|
||||
#################################
|
||||
# local-address-nonexist-fail Fail to start if one or more of the local-address's do not exist on this server
|
||||
#
|
||||
# local-address-nonexist-fail=yes
|
||||
|
||||
#################################
|
||||
# local-ipv6 Local IP address to which we bind
|
||||
#
|
||||
# local-ipv6=::
|
||||
|
||||
#################################
|
||||
# local-ipv6-nonexist-fail Fail to start if one or more of the local-ipv6 addresses do not exist on this server
|
||||
#
|
||||
# local-ipv6-nonexist-fail=yes
|
||||
|
||||
#################################
|
||||
# local-port The port on which we listen
|
||||
#
|
||||
# local-port=53
|
||||
|
||||
#################################
|
||||
# log-dns-details If PDNS should log DNS non-erroneous details
|
||||
#
|
||||
# log-dns-details=no
|
||||
|
||||
#################################
|
||||
# log-dns-queries If PDNS should log all incoming DNS queries
|
||||
#
|
||||
# log-dns-queries=no
|
||||
|
||||
#################################
|
||||
# logging-facility Log under a specific facility
|
||||
#
|
||||
# logging-facility=
|
||||
|
||||
#################################
|
||||
# loglevel Amount of logging. Higher is more. Do not set below 3
|
||||
#
|
||||
# loglevel=4
|
||||
|
||||
#################################
|
||||
# lua-axfr-script Script to be used to edit incoming AXFRs
|
||||
#
|
||||
# lua-axfr-script=
|
||||
|
||||
#################################
|
||||
# lua-dnsupdate-policy-script Lua script with DNS update policy handler
|
||||
#
|
||||
# lua-dnsupdate-policy-script=
|
||||
|
||||
#################################
|
||||
# lua-prequery-script Lua script with prequery handler (DO NOT USE)
|
||||
#
|
||||
# lua-prequery-script=
|
||||
|
||||
#################################
|
||||
# master Act as a master
|
||||
#
|
||||
# master=no
|
||||
|
||||
#################################
|
||||
# max-cache-entries Maximum number of entries in the query cache
|
||||
#
|
||||
# max-cache-entries=1000000
|
||||
|
||||
#################################
|
||||
# max-ent-entries Maximum number of empty non-terminals in a zone
|
||||
#
|
||||
# max-ent-entries=100000
|
||||
|
||||
#################################
|
||||
# max-nsec3-iterations Limit the number of NSEC3 hash iterations
|
||||
#
|
||||
# max-nsec3-iterations=500
|
||||
|
||||
#################################
|
||||
# max-packet-cache-entries Maximum number of entries in the packet cache
|
||||
#
|
||||
# max-packet-cache-entries=1000000
|
||||
|
||||
#################################
|
||||
# max-queue-length Maximum queuelength before considering situation lost
|
||||
#
|
||||
# max-queue-length=5000
|
||||
|
||||
#################################
|
||||
# max-signature-cache-entries Maximum number of signatures cache entries
|
||||
#
|
||||
# max-signature-cache-entries=
|
||||
|
||||
#################################
|
||||
# max-tcp-connections Maximum number of TCP connections
|
||||
#
|
||||
# max-tcp-connections=20
|
||||
|
||||
#################################
|
||||
# max-tcp-connections-per-client Maximum number of simultaneous TCP connections per client
|
||||
#
|
||||
# max-tcp-connections-per-client=0
|
||||
|
||||
#################################
|
||||
# module-dir Default directory for modules
|
||||
#
|
||||
# module-dir=/usr/lib64/pdns
|
||||
|
||||
#################################
|
||||
# negquery-cache-ttl Seconds to store negative query results in the QueryCache
|
||||
#
|
||||
# negquery-cache-ttl=60
|
||||
|
||||
#################################
|
||||
# no-shuffle Set this to prevent random shuffling of answers - for regression testing
|
||||
#
|
||||
# no-shuffle=off
|
||||
|
||||
#################################
|
||||
# non-local-bind Enable binding to non-local addresses by using FREEBIND / BINDANY socket options
|
||||
#
|
||||
# non-local-bind=no
|
||||
|
||||
#################################
|
||||
# only-notify Only send AXFR NOTIFY to these IP addresses or netmasks
|
||||
#
|
||||
# only-notify=0.0.0.0/0,::/0
|
||||
|
||||
#################################
|
||||
# out-of-zone-additional-processing Do out of zone additional processing
|
||||
#
|
||||
# out-of-zone-additional-processing=yes
|
||||
|
||||
#################################
|
||||
# outgoing-axfr-expand-alias Expand ALIAS records during outgoing AXFR
|
||||
#
|
||||
# outgoing-axfr-expand-alias=no
|
||||
|
||||
#################################
|
||||
# overload-queue-length Maximum queuelength moving to packetcache only
|
||||
#
|
||||
# overload-queue-length=0
|
||||
|
||||
#################################
|
||||
# prevent-self-notification Don't send notifications to what we think is ourself
|
||||
#
|
||||
# prevent-self-notification=yes
|
||||
|
||||
#################################
|
||||
# query-cache-ttl Seconds to store query results in the QueryCache
|
||||
#
|
||||
# query-cache-ttl=20
|
||||
|
||||
#################################
|
||||
# query-local-address Source IP address for sending queries
|
||||
#
|
||||
# query-local-address=0.0.0.0
|
||||
|
||||
#################################
|
||||
# query-local-address6 Source IPv6 address for sending queries
|
||||
#
|
||||
# query-local-address6=::
|
||||
|
||||
#################################
|
||||
# query-logging Hint backends that queries should be logged
|
||||
#
|
||||
# query-logging=no
|
||||
|
||||
#################################
|
||||
# queue-limit Maximum number of milliseconds to queue a query
|
||||
#
|
||||
# queue-limit=1500
|
||||
|
||||
#################################
|
||||
# receiver-threads Default number of receiver threads to start
|
||||
#
|
||||
# receiver-threads=1
|
||||
|
||||
#################################
|
||||
# resolver Use this resolver for ALIAS and the internal stub resolver
|
||||
#
|
||||
# resolver=no
|
||||
|
||||
#################################
|
||||
# retrieval-threads Number of AXFR-retrieval threads for slave operation
|
||||
#
|
||||
# retrieval-threads=2
|
||||
|
||||
#################################
|
||||
# reuseport Enable higher performance on compliant kernels by using SO_REUSEPORT allowing each receiver thread to open its own socket
|
||||
#
|
||||
# reuseport=no
|
||||
|
||||
#################################
|
||||
# security-poll-suffix Domain name from which to query security update notifications
|
||||
#
|
||||
# security-poll-suffix=secpoll.powerdns.com.
|
||||
|
||||
#################################
|
||||
# server-id Returned when queried for 'server.id' TXT or NSID, defaults to hostname - disabled or custom
|
||||
#
|
||||
# server-id=
|
||||
|
||||
#################################
|
||||
# setgid If set, change group id to this gid for more security
|
||||
#
|
||||
setgid=pdns
|
||||
|
||||
#################################
|
||||
# setuid If set, change user id to this uid for more security
|
||||
#
|
||||
setuid=pdns
|
||||
|
||||
#################################
|
||||
# signing-threads Default number of signer threads to start
|
||||
#
|
||||
# signing-threads=3
|
||||
|
||||
#################################
|
||||
# slave Act as a slave
|
||||
#
|
||||
# slave=no
|
||||
|
||||
#################################
|
||||
# slave-cycle-interval Schedule slave freshness checks once every .. seconds
|
||||
#
|
||||
# slave-cycle-interval=60
|
||||
|
||||
#################################
|
||||
# slave-renotify If we should send out notifications for slaved updates
|
||||
#
|
||||
# slave-renotify=no
|
||||
|
||||
#################################
|
||||
# soa-expire-default Default SOA expire
|
||||
#
|
||||
# soa-expire-default=604800
|
||||
|
||||
#################################
|
||||
# soa-minimum-ttl Default SOA minimum ttl
|
||||
#
|
||||
# soa-minimum-ttl=3600
|
||||
|
||||
#################################
|
||||
# soa-refresh-default Default SOA refresh
|
||||
#
|
||||
# soa-refresh-default=10800
|
||||
|
||||
#################################
|
||||
# soa-retry-default Default SOA retry
|
||||
#
|
||||
# soa-retry-default=3600
|
||||
|
||||
#################################
|
||||
# socket-dir Where the controlsocket will live, /var/run when unset and not chrooted
|
||||
#
|
||||
# socket-dir=
|
||||
|
||||
#################################
|
||||
# tcp-control-address If set, PowerDNS can be controlled over TCP on this address
|
||||
#
|
||||
# tcp-control-address=
|
||||
|
||||
#################################
|
||||
# tcp-control-port If set, PowerDNS can be controlled over TCP on this address
|
||||
#
|
||||
# tcp-control-port=53000
|
||||
|
||||
#################################
|
||||
# tcp-control-range If set, remote control of PowerDNS is possible over these networks only
|
||||
#
|
||||
# tcp-control-range=127.0.0.0/8, 10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, ::1/128, fe80::/10
|
||||
|
||||
#################################
|
||||
# tcp-control-secret If set, PowerDNS can be controlled over TCP after passing this secret
|
||||
#
|
||||
# tcp-control-secret=
|
||||
|
||||
#################################
|
||||
# tcp-fast-open Enable TCP Fast Open support on the listening sockets, using the supplied numerical value as the queue size
|
||||
#
|
||||
# tcp-fast-open=0
|
||||
|
||||
#################################
|
||||
# traceback-handler Enable the traceback handler (Linux only)
|
||||
#
|
||||
# traceback-handler=yes
|
||||
|
||||
#################################
|
||||
# trusted-notification-proxy IP address of incoming notification proxy
|
||||
#
|
||||
# trusted-notification-proxy=
|
||||
|
||||
#################################
|
||||
# udp-truncation-threshold Maximum UDP response size before we truncate
|
||||
#
|
||||
# udp-truncation-threshold=1680
|
||||
|
||||
#################################
|
||||
# version-string PowerDNS version in packets - full, anonymous, powerdns or custom
|
||||
#
|
||||
# version-string=full
|
||||
|
||||
#################################
|
||||
# webserver Start a webserver for monitoring (api=yes also enables the HTTP listener)
|
||||
#
|
||||
# webserver=no
|
||||
|
||||
#################################
|
||||
# webserver-address IP Address of webserver/API to listen on
|
||||
#
|
||||
# webserver-address=127.0.0.1
|
||||
|
||||
#################################
|
||||
# webserver-allow-from Webserver/API access is only allowed from these subnets
|
||||
#
|
||||
# webserver-allow-from=127.0.0.1,::1
|
||||
|
||||
#################################
|
||||
# webserver-password Password required for accessing the webserver
|
||||
#
|
||||
# webserver-password=
|
||||
|
||||
#################################
|
||||
# webserver-port Port of webserver/API to listen on
|
||||
#
|
||||
# webserver-port=8081
|
||||
|
||||
#################################
|
||||
# webserver-print-arguments If the webserver should print arguments
|
||||
#
|
||||
# webserver-print-arguments=no
|
||||
|
||||
#################################
|
||||
# write-pid Write a PID file
|
||||
#
|
||||
# write-pid=yes
|
||||
|
||||
#################################
|
||||
# xfr-max-received-mbytes Maximum number of megabytes received from an incoming XFR
|
||||
#
|
||||
# xfr-max-received-mbytes=100
|
||||
|
||||
|
||||
@@ -1,476 +0,0 @@
|
||||
# ACCESS(5) ACCESS(5)
|
||||
#
|
||||
# NAME
|
||||
# access - Postfix SMTP server access table
|
||||
#
|
||||
# SYNOPSIS
|
||||
# postmap /etc/postfix/access
|
||||
#
|
||||
# postmap -q "string" /etc/postfix/access
|
||||
#
|
||||
# postmap -q - /etc/postfix/access <inputfile
|
||||
#
|
||||
# DESCRIPTION
|
||||
# This document describes access control on remote SMTP
|
||||
# client information: host names, network addresses, and
|
||||
# envelope sender or recipient addresses; it is implemented
|
||||
# by the Postfix SMTP server. See header_checks(5) or
|
||||
# body_checks(5) for access control on the content of email
|
||||
# messages.
|
||||
#
|
||||
# Normally, the access(5) table is specified as a text file
|
||||
# that serves as input to the postmap(1) command. The
|
||||
# result, an indexed file in dbm or db format, is used for
|
||||
# fast searching by the mail system. Execute the command
|
||||
# "postmap /etc/postfix/access" to rebuild an indexed file
|
||||
# after changing the corresponding text file.
|
||||
#
|
||||
# When the table is provided via other means such as NIS,
|
||||
# LDAP or SQL, the same lookups are done as for ordinary
|
||||
# indexed files.
|
||||
#
|
||||
# Alternatively, the table can be provided as a regular-
|
||||
# expression map where patterns are given as regular expres-
|
||||
# sions, or lookups can be directed to TCP-based server. In
|
||||
# those cases, the lookups are done in a slightly different
|
||||
# way as described below under "REGULAR EXPRESSION TABLES"
|
||||
# or "TCP-BASED TABLES".
|
||||
#
|
||||
# CASE FOLDING
|
||||
# The search string is folded to lowercase before database
|
||||
# lookup. As of Postfix 2.3, the search string is not case
|
||||
# folded with database types such as regexp: or pcre: whose
|
||||
# lookup fields can match both upper and lower case.
|
||||
#
|
||||
# TABLE FORMAT
|
||||
# The input format for the postmap(1) command is as follows:
|
||||
#
|
||||
# pattern action
|
||||
# When pattern matches a mail address, domain or host
|
||||
# address, perform the corresponding action.
|
||||
#
|
||||
# blank lines and comments
|
||||
# Empty lines and whitespace-only lines are ignored,
|
||||
# as are lines whose first non-whitespace character
|
||||
# is a `#'.
|
||||
#
|
||||
# multi-line text
|
||||
# A logical line starts with non-whitespace text. A
|
||||
# line that starts with whitespace continues a logi-
|
||||
# cal line.
|
||||
#
|
||||
# EMAIL ADDRESS PATTERNS
|
||||
# With lookups from indexed files such as DB or DBM, or from
|
||||
# networked tables such as NIS, LDAP or SQL, patterns are
|
||||
# tried in the order as listed below:
|
||||
#
|
||||
# user@domain
|
||||
# Matches the specified mail address.
|
||||
#
|
||||
# domain.tld
|
||||
# Matches domain.tld as the domain part of an email
|
||||
# address.
|
||||
#
|
||||
# The pattern domain.tld also matches subdomains, but
|
||||
# only when the string smtpd_access_maps is listed in
|
||||
# the Postfix parent_domain_matches_subdomains con-
|
||||
# figuration setting.
|
||||
#
|
||||
# .domain.tld
|
||||
# Matches subdomains of domain.tld, but only when the
|
||||
# string smtpd_access_maps is not listed in the Post-
|
||||
# fix parent_domain_matches_subdomains configuration
|
||||
# setting.
|
||||
#
|
||||
# user@ Matches all mail addresses with the specified user
|
||||
# part.
|
||||
#
|
||||
# Note: lookup of the null sender address is not possible
|
||||
# with some types of lookup table. By default, Postfix uses
|
||||
# <> as the lookup key for such addresses. The value is
|
||||
# specified with the smtpd_null_access_lookup_key parameter
|
||||
# in the Postfix main.cf file.
|
||||
#
|
||||
# EMAIL ADDRESS EXTENSION
|
||||
# When a mail address localpart contains the optional recip-
|
||||
# ient delimiter (e.g., user+foo@domain), the lookup order
|
||||
# becomes: user+foo@domain, user@domain, domain, user+foo@,
|
||||
# and user@.
|
||||
#
|
||||
# HOST NAME/ADDRESS PATTERNS
|
||||
# With lookups from indexed files such as DB or DBM, or from
|
||||
# networked tables such as NIS, LDAP or SQL, the following
|
||||
# lookup patterns are examined in the order as listed:
|
||||
#
|
||||
# domain.tld
|
||||
# Matches domain.tld.
|
||||
#
|
||||
# The pattern domain.tld also matches subdomains, but
|
||||
# only when the string smtpd_access_maps is listed in
|
||||
# the Postfix parent_domain_matches_subdomains con-
|
||||
# figuration setting.
|
||||
#
|
||||
# .domain.tld
|
||||
# Matches subdomains of domain.tld, but only when the
|
||||
# string smtpd_access_maps is not listed in the Post-
|
||||
# fix parent_domain_matches_subdomains configuration
|
||||
# setting.
|
||||
#
|
||||
# net.work.addr.ess
|
||||
#
|
||||
# net.work.addr
|
||||
#
|
||||
# net.work
|
||||
#
|
||||
# net Matches the specified IPv4 host address or subnet-
|
||||
# work. An IPv4 host address is a sequence of four
|
||||
# decimal octets separated by ".".
|
||||
#
|
||||
# Subnetworks are matched by repeatedly truncating
|
||||
# the last ".octet" from the remote IPv4 host address
|
||||
# string until a match is found in the access table,
|
||||
# or until further truncation is not possible.
|
||||
#
|
||||
# NOTE 1: The access map lookup key must be in canon-
|
||||
# ical form: do not specify unnecessary null charac-
|
||||
# ters, and do not enclose network address informa-
|
||||
# tion with "[]" characters.
|
||||
#
|
||||
# NOTE 2: use the cidr lookup table type to specify
|
||||
# network/netmask patterns. See cidr_table(5) for
|
||||
# details.
|
||||
#
|
||||
# net:work:addr:ess
|
||||
#
|
||||
# net:work:addr
|
||||
#
|
||||
# net:work
|
||||
#
|
||||
# net Matches the specified IPv6 host address or subnet-
|
||||
# work. An IPv6 host address is a sequence of three
|
||||
# to eight hexadecimal octet pairs separated by ":".
|
||||
#
|
||||
# Subnetworks are matched by repeatedly truncating
|
||||
# the last ":octetpair" from the remote IPv6 host
|
||||
# address string until a match is found in the access
|
||||
# table, or until further truncation is not possible.
|
||||
#
|
||||
# NOTE 1: the truncation and comparison are done with
|
||||
# the string representation of the IPv6 host address.
|
||||
# Thus, not all the ":" subnetworks will be tried.
|
||||
#
|
||||
# NOTE 2: The access map lookup key must be in canon-
|
||||
# ical form: do not specify unnecessary null charac-
|
||||
# ters, and do not enclose network address informa-
|
||||
# tion with "[]" characters.
|
||||
#
|
||||
# NOTE 3: use the cidr lookup table type to specify
|
||||
# network/netmask patterns. See cidr_table(5) for
|
||||
# details.
|
||||
#
|
||||
# IPv6 support is available in Postfix 2.2 and later.
|
||||
#
|
||||
# ACCEPT ACTIONS
|
||||
# OK Accept the address etc. that matches the pattern.
|
||||
#
|
||||
# all-numerical
|
||||
# An all-numerical result is treated as OK. This for-
|
||||
# mat is generated by address-based relay authoriza-
|
||||
# tion schemes such as pop-before-smtp.
|
||||
#
|
||||
# REJECT ACTIONS
|
||||
# Postfix version 2.3 and later support enhanced status
|
||||
# codes as defined in RFC 3463. When no code is specified
|
||||
# at the beginning of the text below, Postfix inserts a
|
||||
# default enhanced status code of "5.7.1" in the case of
|
||||
# reject actions, and "4.7.1" in the case of defer actions.
|
||||
# See "ENHANCED STATUS CODES" below.
|
||||
#
|
||||
# 4NN text
|
||||
#
|
||||
# 5NN text
|
||||
# Reject the address etc. that matches the pattern,
|
||||
# and respond with the numerical three-digit code and
|
||||
# text. 4NN means "try again later", while 5NN means
|
||||
# "do not try again".
|
||||
#
|
||||
# The following responses have special meaning for
|
||||
# the Postfix SMTP server:
|
||||
#
|
||||
# 421 text (Postfix 2.3 and later)
|
||||
#
|
||||
# 521 text (Postfix 2.6 and later)
|
||||
# After responding with the numerical three-
|
||||
# digit code and text, disconnect immediately
|
||||
# from the SMTP client. This frees up SMTP
|
||||
# server resources so that they can be made
|
||||
# available to another SMTP client.
|
||||
#
|
||||
# Note: The "521" response should be used only
|
||||
# with botnets and other malware where inter-
|
||||
# operability is of no concern. The "send 521
|
||||
# and disconnect" behavior is NOT defined in
|
||||
# the SMTP standard.
|
||||
#
|
||||
# REJECT optional text...
|
||||
# Reject the address etc. that matches the pattern.
|
||||
# Reply with "$access_map_reject_code optional
|
||||
# text..." when the optional text is specified, oth-
|
||||
# erwise reply with a generic error response message.
|
||||
#
|
||||
# DEFER optional text...
|
||||
# Reject the address etc. that matches the pattern.
|
||||
# Reply with "$access_map_defer_code optional
|
||||
# text..." when the optional text is specified, oth-
|
||||
# erwise reply with a generic error response message.
|
||||
#
|
||||
# This feature is available in Postfix 2.6 and later.
|
||||
#
|
||||
# DEFER_IF_REJECT optional text...
|
||||
# Defer the request if some later restriction would
|
||||
# result in a REJECT action. Reply with
|
||||
# "$access_map_defer_code 4.7.1 optional text..."
|
||||
# when the optional text is specified, otherwise
|
||||
# reply with a generic error response message.
|
||||
#
|
||||
# Prior to Postfix 2.6, the SMTP reply code is 450.
|
||||
#
|
||||
# This feature is available in Postfix 2.1 and later.
|
||||
#
|
||||
# DEFER_IF_PERMIT optional text...
|
||||
# Defer the request if some later restriction would
|
||||
# result in a an explicit or implicit PERMIT action.
|
||||
# Reply with "$access_map_defer_code 4.7.1 optional
|
||||
# text..." when the optional text is specified, oth-
|
||||
# erwise reply with a generic error response message.
|
||||
#
|
||||
# Prior to Postfix 2.6, the SMTP reply code is 450.
|
||||
#
|
||||
# This feature is available in Postfix 2.1 and later.
|
||||
#
|
||||
# OTHER ACTIONS
|
||||
# restriction...
|
||||
# Apply the named UCE restriction(s) (permit, reject,
|
||||
# reject_unauth_destination, and so on).
|
||||
#
|
||||
# BCC user@domain
|
||||
# Send one copy of the message to the specified
|
||||
# recipient.
|
||||
#
|
||||
# If multiple BCC actions are specified within the
|
||||
# same SMTP MAIL transaction, only the last action
|
||||
# will be used.
|
||||
#
|
||||
# This feature is not part of the stable Postfix
|
||||
# release.
|
||||
#
|
||||
# DISCARD optional text...
|
||||
# Claim successful delivery and silently discard the
|
||||
# message. Log the optional text if specified, oth-
|
||||
# erwise log a generic message.
|
||||
#
|
||||
# Note: this action currently affects all recipients
|
||||
# of the message. To discard only one recipient
|
||||
# without discarding the entire message, use the
|
||||
# transport(5) table to direct mail to the discard(8)
|
||||
# service.
|
||||
#
|
||||
# This feature is available in Postfix 2.0 and later.
|
||||
#
|
||||
# DUNNO Pretend that the lookup key was not found. This
|
||||
# prevents Postfix from trying substrings of the
|
||||
# lookup key (such as a subdomain name, or a network
|
||||
# address subnetwork).
|
||||
#
|
||||
# This feature is available in Postfix 2.0 and later.
|
||||
#
|
||||
# FILTER transport:destination
|
||||
# After the message is queued, send the entire mes-
|
||||
# sage through the specified external content filter.
|
||||
# The transport name specifies the first field of a
|
||||
# mail delivery agent definition in master.cf; the
|
||||
# syntax of the next-hop destination is described in
|
||||
# the manual page of the corresponding delivery
|
||||
# agent. More information about external content
|
||||
# filters is in the Postfix FILTER_README file.
|
||||
#
|
||||
# Note 1: do not use $number regular expression sub-
|
||||
# stitutions for transport or destination unless you
|
||||
# know that the information has a trusted origin.
|
||||
#
|
||||
# Note 2: this action overrides the main.cf con-
|
||||
# tent_filter setting, and affects all recipients of
|
||||
# the message. In the case that multiple FILTER
|
||||
# actions fire, only the last one is executed.
|
||||
#
|
||||
# Note 3: the purpose of the FILTER command is to
|
||||
# override message routing. To override the recipi-
|
||||
# ent's transport but not the next-hop destination,
|
||||
# specify an empty filter destination (Postfix 2.7
|
||||
# and later), or specify a transport:destination that
|
||||
# delivers through a different Postfix instance
|
||||
# (Postfix 2.6 and earlier). Other options are using
|
||||
# the recipient-dependent transport_maps or the sen-
|
||||
# der-dependent sender_dependent_default_transport-
|
||||
# _maps features.
|
||||
#
|
||||
# This feature is available in Postfix 2.0 and later.
|
||||
#
|
||||
# HOLD optional text...
|
||||
# Place the message on the hold queue, where it will
|
||||
# sit until someone either deletes it or releases it
|
||||
# for delivery. Log the optional text if specified,
|
||||
# otherwise log a generic message.
|
||||
#
|
||||
# Mail that is placed on hold can be examined with
|
||||
# the postcat(1) command, and can be destroyed or
|
||||
# released with the postsuper(1) command.
|
||||
#
|
||||
# Note: use "postsuper -r" to release mail that was
|
||||
# kept on hold for a significant fraction of $maxi-
|
||||
# mal_queue_lifetime or $bounce_queue_lifetime, or
|
||||
# longer. Use "postsuper -H" only for mail that will
|
||||
# not expire within a few delivery attempts.
|
||||
#
|
||||
# Note: this action currently affects all recipients
|
||||
# of the message.
|
||||
#
|
||||
# This feature is available in Postfix 2.0 and later.
|
||||
#
|
||||
# PREPEND headername: headervalue
|
||||
# Prepend the specified message header to the mes-
|
||||
# sage. When more than one PREPEND action executes,
|
||||
# the first prepended header appears before the sec-
|
||||
# ond etc. prepended header.
|
||||
#
|
||||
# Note: this action must execute before the message
|
||||
# content is received; it cannot execute in the con-
|
||||
# text of smtpd_end_of_data_restrictions.
|
||||
#
|
||||
# This feature is available in Postfix 2.1 and later.
|
||||
#
|
||||
# REDIRECT user@domain
|
||||
# After the message is queued, send the message to
|
||||
# the specified address instead of the intended
|
||||
# recipient(s).
|
||||
#
|
||||
# Note: this action overrides the FILTER action, and
|
||||
# currently affects all recipients of the message.
|
||||
#
|
||||
# This feature is available in Postfix 2.1 and later.
|
||||
#
|
||||
# WARN optional text...
|
||||
# Log a warning with the optional text, together with
|
||||
# client information and if available, with helo,
|
||||
# sender, recipient and protocol information.
|
||||
#
|
||||
# This feature is available in Postfix 2.1 and later.
|
||||
#
|
||||
# ENHANCED STATUS CODES
|
||||
# Postfix version 2.3 and later support enhanced status
|
||||
# codes as defined in RFC 3463. When an enhanced status
|
||||
# code is specified in an access table, it is subject to
|
||||
# modification. The following transformations are needed
|
||||
# when the same access table is used for client, helo,
|
||||
# sender, or recipient access restrictions; they happen
|
||||
# regardless of whether Postfix replies to a MAIL FROM, RCPT
|
||||
# TO or other SMTP command.
|
||||
#
|
||||
# o When a sender address matches a REJECT action, the
|
||||
# Postfix SMTP server will transform a recipient DSN
|
||||
# status (e.g., 4.1.1-4.1.6) into the corresponding
|
||||
# sender DSN status, and vice versa.
|
||||
#
|
||||
# o When non-address information matches a REJECT
|
||||
# action (such as the HELO command argument or the
|
||||
# client hostname/address), the Postfix SMTP server
|
||||
# will transform a sender or recipient DSN status
|
||||
# into a generic non-address DSN status (e.g.,
|
||||
# 4.0.0).
|
||||
#
|
||||
# REGULAR EXPRESSION TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# the table is given in the form of regular expressions. For
|
||||
# a description of regular expression lookup table syntax,
|
||||
# see regexp_table(5) or pcre_table(5).
|
||||
#
|
||||
# Each pattern is a regular expression that is applied to
|
||||
# the entire string being looked up. Depending on the appli-
|
||||
# cation, that string is an entire client hostname, an
|
||||
# entire client IP address, or an entire mail address. Thus,
|
||||
# no parent domain or parent network search is done,
|
||||
# user@domain mail addresses are not broken up into their
|
||||
# user@ and domain constituent parts, nor is user+foo broken
|
||||
# up into user and foo.
|
||||
#
|
||||
# Patterns are applied in the order as specified in the ta-
|
||||
# ble, until a pattern is found that matches the search
|
||||
# string.
|
||||
#
|
||||
# Actions are the same as with indexed file lookups, with
|
||||
# the additional feature that parenthesized substrings from
|
||||
# the pattern can be interpolated as $1, $2 and so on.
|
||||
#
|
||||
# TCP-BASED TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# lookups are directed to a TCP-based server. For a descrip-
|
||||
# tion of the TCP client/server lookup protocol, see tcp_ta-
|
||||
# ble(5). This feature is not available up to and including
|
||||
# Postfix version 2.4.
|
||||
#
|
||||
# Each lookup operation uses the entire query string once.
|
||||
# Depending on the application, that string is an entire
|
||||
# client hostname, an entire client IP address, or an entire
|
||||
# mail address. Thus, no parent domain or parent network
|
||||
# search is done, user@domain mail addresses are not broken
|
||||
# up into their user@ and domain constituent parts, nor is
|
||||
# user+foo broken up into user and foo.
|
||||
#
|
||||
# Actions are the same as with indexed file lookups.
|
||||
#
|
||||
# EXAMPLE
|
||||
# The following example uses an indexed file, so that the
|
||||
# order of table entries does not matter. The example per-
|
||||
# mits access by the client at address 1.2.3.4 but rejects
|
||||
# all other clients in 1.2.3.0/24. Instead of hash lookup
|
||||
# tables, some systems use dbm. Use the command "postconf
|
||||
# -m" to find out what lookup tables Postfix supports on
|
||||
# your system.
|
||||
#
|
||||
# /etc/postfix/main.cf:
|
||||
# smtpd_client_restrictions =
|
||||
# check_client_access hash:/etc/postfix/access
|
||||
#
|
||||
# /etc/postfix/access:
|
||||
# 1.2.3 REJECT
|
||||
# 1.2.3.4 OK
|
||||
#
|
||||
# Execute the command "postmap /etc/postfix/access" after
|
||||
# editing the file.
|
||||
#
|
||||
# BUGS
|
||||
# The table format does not understand quoting conventions.
|
||||
#
|
||||
# SEE ALSO
|
||||
# postmap(1), Postfix lookup table manager
|
||||
# smtpd(8), SMTP server
|
||||
# postconf(5), configuration parameters
|
||||
# transport(5), transport:nexthop syntax
|
||||
#
|
||||
# README FILES
|
||||
# Use "postconf readme_directory" or "postconf html_direc-
|
||||
# tory" to locate this information.
|
||||
# SMTPD_ACCESS_README, built-in SMTP server access control
|
||||
# DATABASE_README, Postfix lookup table overview
|
||||
#
|
||||
# LICENSE
|
||||
# The Secure Mailer license must be distributed with this
|
||||
# software.
|
||||
#
|
||||
# AUTHOR(S)
|
||||
# Wietse Venema
|
||||
# IBM T.J. Watson Research
|
||||
# P.O. Box 704
|
||||
# Yorktown Heights, NY 10598, USA
|
||||
#
|
||||
# ACCESS(5)
|
||||
@@ -1,278 +0,0 @@
|
||||
# CANONICAL(5) CANONICAL(5)
|
||||
#
|
||||
# NAME
|
||||
# canonical - Postfix canonical table format
|
||||
#
|
||||
# SYNOPSIS
|
||||
# postmap /etc/postfix/canonical
|
||||
#
|
||||
# postmap -q "string" /etc/postfix/canonical
|
||||
#
|
||||
# postmap -q - /etc/postfix/canonical <inputfile
|
||||
#
|
||||
# DESCRIPTION
|
||||
# The optional canonical(5) table specifies an address map-
|
||||
# ping for local and non-local addresses. The mapping is
|
||||
# used by the cleanup(8) daemon, before mail is stored into
|
||||
# the queue. The address mapping is recursive.
|
||||
#
|
||||
# Normally, the canonical(5) table is specified as a text
|
||||
# file that serves as input to the postmap(1) command. The
|
||||
# result, an indexed file in dbm or db format, is used for
|
||||
# fast searching by the mail system. Execute the command
|
||||
# "postmap /etc/postfix/canonical" to rebuild an indexed
|
||||
# file after changing the corresponding text file.
|
||||
#
|
||||
# When the table is provided via other means such as NIS,
|
||||
# LDAP or SQL, the same lookups are done as for ordinary
|
||||
# indexed files.
|
||||
#
|
||||
# Alternatively, the table can be provided as a regular-
|
||||
# expression map where patterns are given as regular expres-
|
||||
# sions, or lookups can be directed to TCP-based server. In
|
||||
# those cases, the lookups are done in a slightly different
|
||||
# way as described below under "REGULAR EXPRESSION TABLES"
|
||||
# or "TCP-BASED TABLES".
|
||||
#
|
||||
# By default the canonical(5) mapping affects both message
|
||||
# header addresses (i.e. addresses that appear inside mes-
|
||||
# sages) and message envelope addresses (for example, the
|
||||
# addresses that are used in SMTP protocol commands). This
|
||||
# is controlled with the canonical_classes parameter.
|
||||
#
|
||||
# NOTE: Postfix versions 2.2 and later rewrite message head-
|
||||
# ers from remote SMTP clients only if the client matches
|
||||
# the local_header_rewrite_clients parameter, or if the
|
||||
# remote_header_rewrite_domain configuration parameter spec-
|
||||
# ifies a non-empty value. To get the behavior before Post-
|
||||
# fix 2.2, specify "local_header_rewrite_clients =
|
||||
# static:all".
|
||||
#
|
||||
# Typically, one would use the canonical(5) table to replace
|
||||
# login names by Firstname.Lastname, or to clean up
|
||||
# addresses produced by legacy mail systems.
|
||||
#
|
||||
# The canonical(5) mapping is not to be confused with vir-
|
||||
# tual alias support or with local aliasing. To change the
|
||||
# destination but not the headers, use the virtual(5) or
|
||||
# aliases(5) map instead.
|
||||
#
|
||||
# CASE FOLDING
|
||||
# The search string is folded to lowercase before database
|
||||
# lookup. As of Postfix 2.3, the search string is not case
|
||||
# folded with database types such as regexp: or pcre: whose
|
||||
# lookup fields can match both upper and lower case.
|
||||
#
|
||||
# TABLE FORMAT
|
||||
# The input format for the postmap(1) command is as follows:
|
||||
#
|
||||
# pattern result
|
||||
# When pattern matches a mail address, replace it by
|
||||
# the corresponding result.
|
||||
#
|
||||
# blank lines and comments
|
||||
# Empty lines and whitespace-only lines are ignored,
|
||||
# as are lines whose first non-whitespace character
|
||||
# is a `#'.
|
||||
#
|
||||
# multi-line text
|
||||
# A logical line starts with non-whitespace text. A
|
||||
# line that starts with whitespace continues a logi-
|
||||
# cal line.
|
||||
#
|
||||
# TABLE SEARCH ORDER
|
||||
# With lookups from indexed files such as DB or DBM, or from
|
||||
# networked tables such as NIS, LDAP or SQL, patterns are
|
||||
# tried in the order as listed below:
|
||||
#
|
||||
# user@domain address
|
||||
# Replace user@domain by address. This form has the
|
||||
# highest precedence.
|
||||
#
|
||||
# This is useful to clean up addresses produced by
|
||||
# legacy mail systems. It can also be used to pro-
|
||||
# duce Firstname.Lastname style addresses, but see
|
||||
# below for a simpler solution.
|
||||
#
|
||||
# user address
|
||||
# Replace user@site by address when site is equal to
|
||||
# $myorigin, when site is listed in $mydestination,
|
||||
# or when it is listed in $inet_interfaces or
|
||||
# $proxy_interfaces.
|
||||
#
|
||||
# This form is useful for replacing login names by
|
||||
# Firstname.Lastname.
|
||||
#
|
||||
# @domain address
|
||||
# Replace other addresses in domain by address. This
|
||||
# form has the lowest precedence.
|
||||
#
|
||||
# Note: @domain is a wild-card. When this form is
|
||||
# applied to recipient addresses, the Postfix SMTP
|
||||
# server accepts mail for any recipient in domain,
|
||||
# regardless of whether that recipient exists. This
|
||||
# may turn your mail system into a backscatter
|
||||
# source: Postfix first accepts mail for non-existent
|
||||
# recipients and then tries to return that mail as
|
||||
# "undeliverable" to the often forged sender address.
|
||||
#
|
||||
# RESULT ADDRESS REWRITING
|
||||
# The lookup result is subject to address rewriting:
|
||||
#
|
||||
# o When the result has the form @otherdomain, the
|
||||
# result becomes the same user in otherdomain.
|
||||
#
|
||||
# o When "append_at_myorigin=yes", append "@$myorigin"
|
||||
# to addresses without "@domain".
|
||||
#
|
||||
# o When "append_dot_mydomain=yes", append ".$mydomain"
|
||||
# to addresses without ".domain".
|
||||
#
|
||||
# ADDRESS EXTENSION
|
||||
# When a mail address localpart contains the optional recip-
|
||||
# ient delimiter (e.g., user+foo@domain), the lookup order
|
||||
# becomes: user+foo@domain, user@domain, user+foo, user, and
|
||||
# @domain.
|
||||
#
|
||||
# The propagate_unmatched_extensions parameter controls
|
||||
# whether an unmatched address extension (+foo) is propa-
|
||||
# gated to the result of table lookup.
|
||||
#
|
||||
# REGULAR EXPRESSION TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# the table is given in the form of regular expressions. For
|
||||
# a description of regular expression lookup table syntax,
|
||||
# see regexp_table(5) or pcre_table(5).
|
||||
#
|
||||
# Each pattern is a regular expression that is applied to
|
||||
# the entire address being looked up. Thus, user@domain mail
|
||||
# addresses are not broken up into their user and @domain
|
||||
# constituent parts, nor is user+foo broken up into user and
|
||||
# foo.
|
||||
#
|
||||
# Patterns are applied in the order as specified in the ta-
|
||||
# ble, until a pattern is found that matches the search
|
||||
# string.
|
||||
#
|
||||
# Results are the same as with indexed file lookups, with
|
||||
# the additional feature that parenthesized substrings from
|
||||
# the pattern can be interpolated as $1, $2 and so on.
|
||||
#
|
||||
# TCP-BASED TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# lookups are directed to a TCP-based server. For a descrip-
|
||||
# tion of the TCP client/server lookup protocol, see tcp_ta-
|
||||
# ble(5). This feature is not available up to and including
|
||||
# Postfix version 2.4.
|
||||
#
|
||||
# Each lookup operation uses the entire address once. Thus,
|
||||
# user@domain mail addresses are not broken up into their
|
||||
# user and @domain constituent parts, nor is user+foo broken
|
||||
# up into user and foo.
|
||||
#
|
||||
# Results are the same as with indexed file lookups.
|
||||
#
|
||||
# BUGS
|
||||
# The table format does not understand quoting conventions.
|
||||
#
|
||||
# CONFIGURATION PARAMETERS
|
||||
# The following main.cf parameters are especially relevant.
|
||||
# The text below provides only a parameter summary. See
|
||||
# postconf(5) for more details including examples.
|
||||
#
|
||||
# canonical_classes
|
||||
# What addresses are subject to canonical address
|
||||
# mapping.
|
||||
#
|
||||
# canonical_maps
|
||||
# List of canonical mapping tables.
|
||||
#
|
||||
# recipient_canonical_maps
|
||||
# Address mapping lookup table for envelope and
|
||||
# header recipient addresses.
|
||||
#
|
||||
# sender_canonical_maps
|
||||
# Address mapping lookup table for envelope and
|
||||
# header sender addresses.
|
||||
#
|
||||
# propagate_unmatched_extensions
|
||||
# A list of address rewriting or forwarding mecha-
|
||||
# nisms that propagate an address extension from the
|
||||
# original address to the result. Specify zero or
|
||||
# more of canonical, virtual, alias, forward,
|
||||
# include, or generic.
|
||||
#
|
||||
# Other parameters of interest:
|
||||
#
|
||||
# inet_interfaces
|
||||
# The network interface addresses that this system
|
||||
# receives mail on. You need to stop and start Post-
|
||||
# fix when this parameter changes.
|
||||
#
|
||||
# local_header_rewrite_clients
|
||||
# Rewrite message header addresses in mail from these
|
||||
# clients and update incomplete addresses with the
|
||||
# domain name in $myorigin or $mydomain; either don't
|
||||
# rewrite message headers from other clients at all,
|
||||
# or rewrite message headers and update incomplete
|
||||
# addresses with the domain specified in the
|
||||
# remote_header_rewrite_domain parameter.
|
||||
#
|
||||
# proxy_interfaces
|
||||
# Other interfaces that this machine receives mail on
|
||||
# by way of a proxy agent or network address transla-
|
||||
# tor.
|
||||
#
|
||||
# masquerade_classes
|
||||
# List of address classes subject to masquerading:
|
||||
# zero or more of envelope_sender, envelope_recipi-
|
||||
# ent, header_sender, header_recipient.
|
||||
#
|
||||
# masquerade_domains
|
||||
# List of domains that hide their subdomain struc-
|
||||
# ture.
|
||||
#
|
||||
# masquerade_exceptions
|
||||
# List of user names that are not subject to address
|
||||
# masquerading.
|
||||
#
|
||||
# mydestination
|
||||
# List of domains that this mail system considers
|
||||
# local.
|
||||
#
|
||||
# myorigin
|
||||
# The domain that is appended to locally-posted mail.
|
||||
#
|
||||
# owner_request_special
|
||||
# Give special treatment to owner-xxx and xxx-request
|
||||
# addresses.
|
||||
#
|
||||
# remote_header_rewrite_domain
|
||||
# Don't rewrite message headers from remote clients
|
||||
# at all when this parameter is empty; otherwise, re-
|
||||
# write message headers and append the specified
|
||||
# domain name to incomplete addresses.
|
||||
#
|
||||
# SEE ALSO
|
||||
# cleanup(8), canonicalize and enqueue mail
|
||||
# postmap(1), Postfix lookup table manager
|
||||
# postconf(5), configuration parameters
|
||||
# virtual(5), virtual aliasing
|
||||
#
|
||||
# README FILES
|
||||
# Use "postconf readme_directory" or "postconf html_direc-
|
||||
# tory" to locate this information.
|
||||
# DATABASE_README, Postfix lookup table overview
|
||||
# ADDRESS_REWRITING_README, address rewriting guide
|
||||
#
|
||||
# LICENSE
|
||||
# The Secure Mailer license must be distributed with this
|
||||
# software.
|
||||
#
|
||||
# AUTHOR(S)
|
||||
# Wietse Venema
|
||||
# IBM T.J. Watson Research
|
||||
# P.O. Box 704
|
||||
# Yorktown Heights, NY 10598, USA
|
||||
#
|
||||
# CANONICAL(5)
|
||||
@@ -1,21 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDizCCAnOgAwIBAgIJAIJuX7vycgv0MA0GCSqGSIb3DQEBCwUAMFwxCzAJBgNV
|
||||
BAYTAlVTMQ8wDQYDVQQIDAZEZW5pYWwxFDASBgNVBAcMC1NwcmluZ2ZpZWxkMQww
|
||||
CgYDVQQKDANEaXMxGDAWBgNVBAMMD3d3dy5leGFtcGxlLmNvbTAeFw0xNzEwMTEw
|
||||
ODU3MzVaFw0yNzEwMDkwODU3MzVaMFwxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIDAZE
|
||||
ZW5pYWwxFDASBgNVBAcMC1NwcmluZ2ZpZWxkMQwwCgYDVQQKDANEaXMxGDAWBgNV
|
||||
BAMMD3d3dy5leGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
||||
ggEBANokcgV4eK3soeeLSuBP2Qi55RO/RSS53TQV7NpxgiKkKRYoMoUz7Hh1Vdc8
|
||||
nV7LfKYWxECzvBUWbRFrgYE768WI3HUcFGdtxm62Nskg+IL5Ik403dQ5QOZFKykX
|
||||
X9vEpBmGTgsOaP1fnaeV7qa69w666Wp1HrAul7MPi/uUklBDfjubGiZUD52pYEPD
|
||||
C/3N/+fH6rd6O7HzZMWpNSd4Yic3XBQjPmFRO33gmJDM5NEAIt026XI4n8AzQYI2
|
||||
VmgeGRax5vrs8hMPjM8QkAeUrWcmMkwa2hcVPrxKFu/kgvduP9RtoD0/n5M6Bhpc
|
||||
n1Jma6T1XmiKtbNqK5ToaAebS4MCAwEAAaNQME4wHQYDVR0OBBYEFAMyeCibjAJR
|
||||
cp3wpZhTwWwXWsnoMB8GA1UdIwQYMBaAFAMyeCibjAJRcp3wpZhTwWwXWsnoMAwG
|
||||
A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAKE+Dgv4hwhX0HGQ8oi1a5VN
|
||||
ij0uIn/hDmWPXVH5TxtPSR/GcjWH6csRl1VuSrXAxhppopD2NpvyUgOhvH7ZaY2C
|
||||
8BUs+KrQ4dB2ipW5MPgl7CfzAGip7/LzCFKdn26YBViNwAn8pwIJd79XcuhmbxzL
|
||||
N3zUQXv2uDSo6i7jkxlTglnsqP9N9/GdaVaNmcGGblAfXbiZGGa8/uboz3WdDO3c
|
||||
sIGf9J7RNrn0Q9Xq6K7Xk9qV8QOVVxp/ClwsG1Tq6ZR362wG44YBYc0H7/3AuySu
|
||||
p73fSvjg7cOzcG1z66Tiafpiqtfu6fWmDkZAVctH8NSf8wCfzwL+jgygo7NSLB8=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -1,4 +0,0 @@
|
||||
driver = mysql
|
||||
connect = host=127.0.0.1 dbname=cyberpanel user=cyberpanel password=1qaz@9xvps
|
||||
default_pass_scheme = PLAIN
|
||||
password_query = SELECT email as user, password FROM e_users WHERE email='%u';
|
||||
@@ -1,52 +0,0 @@
|
||||
protocols = imap pop3
|
||||
log_timestamp = "%Y-%m-%d %H:%M:%S "
|
||||
mail_location = maildir:/home/vmail/%d/%n/Maildir
|
||||
|
||||
ssl_cert = <cert.pem
|
||||
ssl_key = <key.pem
|
||||
|
||||
namespace {
|
||||
type = private
|
||||
separator = .
|
||||
prefix = INBOX.
|
||||
inbox = yes
|
||||
}
|
||||
|
||||
service auth {
|
||||
unix_listener auth-master {
|
||||
mode = 0600
|
||||
user = vmail
|
||||
}
|
||||
|
||||
unix_listener /var/spool/postfix/private/auth {
|
||||
mode = 0666
|
||||
user = postfix
|
||||
group = postfix
|
||||
}
|
||||
|
||||
user = root
|
||||
}
|
||||
|
||||
service auth-worker {
|
||||
user = root
|
||||
}
|
||||
|
||||
protocol lda {
|
||||
log_path = /home/vmail/dovecot-deliver.log
|
||||
auth_socket_path = /var/run/dovecot/auth-master
|
||||
postmaster_address = postmaster@example.com
|
||||
}
|
||||
|
||||
protocol pop3 {
|
||||
pop3_uidl_format = %08Xu%08Xv
|
||||
}
|
||||
|
||||
passdb {
|
||||
driver = sql
|
||||
args = /etc/dovecot/dovecot-sql.conf.ext
|
||||
}
|
||||
|
||||
userdb {
|
||||
driver = static
|
||||
args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
# GENERIC(5) GENERIC(5)
|
||||
#
|
||||
# NAME
|
||||
# generic - Postfix generic table format
|
||||
#
|
||||
# SYNOPSIS
|
||||
# postmap /etc/postfix/generic
|
||||
#
|
||||
# postmap -q "string" /etc/postfix/generic
|
||||
#
|
||||
# postmap -q - /etc/postfix/generic <inputfile
|
||||
#
|
||||
# DESCRIPTION
|
||||
# The optional generic(5) table specifies an address mapping
|
||||
# that applies when mail is delivered. This is the opposite
|
||||
# of canonical(5) mapping, which applies when mail is
|
||||
# received.
|
||||
#
|
||||
# Typically, one would use the generic(5) table on a system
|
||||
# that does not have a valid Internet domain name and that
|
||||
# uses something like localdomain.local instead. The
|
||||
# generic(5) table is then used by the smtp(8) client to
|
||||
# transform local mail addresses into valid Internet mail
|
||||
# addresses when mail has to be sent across the Internet.
|
||||
# See the EXAMPLE section at the end of this document.
|
||||
#
|
||||
# The generic(5) mapping affects both message header
|
||||
# addresses (i.e. addresses that appear inside messages) and
|
||||
# message envelope addresses (for example, the addresses
|
||||
# that are used in SMTP protocol commands).
|
||||
#
|
||||
# Normally, the generic(5) table is specified as a text file
|
||||
# that serves as input to the postmap(1) command. The
|
||||
# result, an indexed file in dbm or db format, is used for
|
||||
# fast searching by the mail system. Execute the command
|
||||
# "postmap /etc/postfix/generic" to rebuild an indexed file
|
||||
# after changing the corresponding text file.
|
||||
#
|
||||
# When the table is provided via other means such as NIS,
|
||||
# LDAP or SQL, the same lookups are done as for ordinary
|
||||
# indexed files.
|
||||
#
|
||||
# Alternatively, the table can be provided as a regular-
|
||||
# expression map where patterns are given as regular expres-
|
||||
# sions, or lookups can be directed to TCP-based server. In
|
||||
# those case, the lookups are done in a slightly different
|
||||
# way as described below under "REGULAR EXPRESSION TABLES"
|
||||
# or "TCP-BASED TABLES".
|
||||
#
|
||||
# CASE FOLDING
|
||||
# The search string is folded to lowercase before database
|
||||
# lookup. As of Postfix 2.3, the search string is not case
|
||||
# folded with database types such as regexp: or pcre: whose
|
||||
# lookup fields can match both upper and lower case.
|
||||
#
|
||||
# TABLE FORMAT
|
||||
# The input format for the postmap(1) command is as follows:
|
||||
#
|
||||
# pattern result
|
||||
# When pattern matches a mail address, replace it by
|
||||
# the corresponding result.
|
||||
#
|
||||
# blank lines and comments
|
||||
# Empty lines and whitespace-only lines are ignored,
|
||||
# as are lines whose first non-whitespace character
|
||||
# is a `#'.
|
||||
#
|
||||
# multi-line text
|
||||
# A logical line starts with non-whitespace text. A
|
||||
# line that starts with whitespace continues a logi-
|
||||
# cal line.
|
||||
#
|
||||
# TABLE SEARCH ORDER
|
||||
# With lookups from indexed files such as DB or DBM, or from
|
||||
# networked tables such as NIS, LDAP or SQL, patterns are
|
||||
# tried in the order as listed below:
|
||||
#
|
||||
# user@domain address
|
||||
# Replace user@domain by address. This form has the
|
||||
# highest precedence.
|
||||
#
|
||||
# user address
|
||||
# Replace user@site by address when site is equal to
|
||||
# $myorigin, when site is listed in $mydestination,
|
||||
# or when it is listed in $inet_interfaces or
|
||||
# $proxy_interfaces.
|
||||
#
|
||||
# @domain address
|
||||
# Replace other addresses in domain by address. This
|
||||
# form has the lowest precedence.
|
||||
#
|
||||
# RESULT ADDRESS REWRITING
|
||||
# The lookup result is subject to address rewriting:
|
||||
#
|
||||
# o When the result has the form @otherdomain, the
|
||||
# result becomes the same user in otherdomain.
|
||||
#
|
||||
# o When "append_at_myorigin=yes", append "@$myorigin"
|
||||
# to addresses without "@domain".
|
||||
#
|
||||
# o When "append_dot_mydomain=yes", append ".$mydomain"
|
||||
# to addresses without ".domain".
|
||||
#
|
||||
# ADDRESS EXTENSION
|
||||
# When a mail address localpart contains the optional recip-
|
||||
# ient delimiter (e.g., user+foo@domain), the lookup order
|
||||
# becomes: user+foo@domain, user@domain, user+foo, user, and
|
||||
# @domain.
|
||||
#
|
||||
# The propagate_unmatched_extensions parameter controls
|
||||
# whether an unmatched address extension (+foo) is propa-
|
||||
# gated to the result of table lookup.
|
||||
#
|
||||
# REGULAR EXPRESSION TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# the table is given in the form of regular expressions. For
|
||||
# a description of regular expression lookup table syntax,
|
||||
# see regexp_table(5) or pcre_table(5).
|
||||
#
|
||||
# Each pattern is a regular expression that is applied to
|
||||
# the entire address being looked up. Thus, user@domain mail
|
||||
# addresses are not broken up into their user and @domain
|
||||
# constituent parts, nor is user+foo broken up into user and
|
||||
# foo.
|
||||
#
|
||||
# Patterns are applied in the order as specified in the ta-
|
||||
# ble, until a pattern is found that matches the search
|
||||
# string.
|
||||
#
|
||||
# Results are the same as with indexed file lookups, with
|
||||
# the additional feature that parenthesized substrings from
|
||||
# the pattern can be interpolated as $1, $2 and so on.
|
||||
#
|
||||
# TCP-BASED TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# lookups are directed to a TCP-based server. For a descrip-
|
||||
# tion of the TCP client/server lookup protocol, see tcp_ta-
|
||||
# ble(5). This feature is not available up to and including
|
||||
# Postfix version 2.4.
|
||||
#
|
||||
# Each lookup operation uses the entire address once. Thus,
|
||||
# user@domain mail addresses are not broken up into their
|
||||
# user and @domain constituent parts, nor is user+foo broken
|
||||
# up into user and foo.
|
||||
#
|
||||
# Results are the same as with indexed file lookups.
|
||||
#
|
||||
# EXAMPLE
|
||||
# The following shows a generic mapping with an indexed
|
||||
# file. When mail is sent to a remote host via SMTP, this
|
||||
# replaces his@localdomain.local by his ISP mail address,
|
||||
# replaces her@localdomain.local by her ISP mail address,
|
||||
# and replaces other local addresses by his ISP account,
|
||||
# with an address extension of +local (this example assumes
|
||||
# that the ISP supports "+" style address extensions).
|
||||
#
|
||||
# /etc/postfix/main.cf:
|
||||
# smtp_generic_maps = hash:/etc/postfix/generic
|
||||
#
|
||||
# /etc/postfix/generic:
|
||||
# his@localdomain.local hisaccount@hisisp.example
|
||||
# her@localdomain.local heraccount@herisp.example
|
||||
# @localdomain.local hisaccount+local@hisisp.example
|
||||
#
|
||||
# Execute the command "postmap /etc/postfix/generic" when-
|
||||
# ever the table is changed. Instead of hash, some systems
|
||||
# use dbm database files. To find out what tables your sys-
|
||||
# tem supports use the command "postconf -m".
|
||||
#
|
||||
# BUGS
|
||||
# The table format does not understand quoting conventions.
|
||||
#
|
||||
# CONFIGURATION PARAMETERS
|
||||
# The following main.cf parameters are especially relevant.
|
||||
# The text below provides only a parameter summary. See
|
||||
# postconf(5) for more details including examples.
|
||||
#
|
||||
# smtp_generic_maps
|
||||
# Address mapping lookup table for envelope and
|
||||
# header sender and recipient addresses while deliv-
|
||||
# ering mail via SMTP.
|
||||
#
|
||||
# propagate_unmatched_extensions
|
||||
# A list of address rewriting or forwarding mecha-
|
||||
# nisms that propagate an address extension from the
|
||||
# original address to the result. Specify zero or
|
||||
# more of canonical, virtual, alias, forward,
|
||||
# include, or generic.
|
||||
#
|
||||
# Other parameters of interest:
|
||||
#
|
||||
# inet_interfaces
|
||||
# The network interface addresses that this system
|
||||
# receives mail on. You need to stop and start Post-
|
||||
# fix when this parameter changes.
|
||||
#
|
||||
# proxy_interfaces
|
||||
# Other interfaces that this machine receives mail on
|
||||
# by way of a proxy agent or network address transla-
|
||||
# tor.
|
||||
#
|
||||
# mydestination
|
||||
# List of domains that this mail system considers
|
||||
# local.
|
||||
#
|
||||
# myorigin
|
||||
# The domain that is appended to locally-posted mail.
|
||||
#
|
||||
# owner_request_special
|
||||
# Give special treatment to owner-xxx and xxx-request
|
||||
# addresses.
|
||||
#
|
||||
# SEE ALSO
|
||||
# postmap(1), Postfix lookup table manager
|
||||
# postconf(5), configuration parameters
|
||||
# smtp(8), Postfix SMTP client
|
||||
#
|
||||
# README FILES
|
||||
# Use "postconf readme_directory" or "postconf html_direc-
|
||||
# tory" to locate this information.
|
||||
# ADDRESS_REWRITING_README, address rewriting guide
|
||||
# DATABASE_README, Postfix lookup table overview
|
||||
# STANDARD_CONFIGURATION_README, configuration examples
|
||||
#
|
||||
# LICENSE
|
||||
# The Secure Mailer license must be distributed with this
|
||||
# software.
|
||||
#
|
||||
# HISTORY
|
||||
# A genericstable feature appears in the Sendmail MTA.
|
||||
#
|
||||
# This feature is available in Postfix 2.2 and later.
|
||||
#
|
||||
# AUTHOR(S)
|
||||
# Wietse Venema
|
||||
# IBM T.J. Watson Research
|
||||
# P.O. Box 704
|
||||
# Yorktown Heights, NY 10598, USA
|
||||
#
|
||||
# GENERIC(5)
|
||||
@@ -1,496 +0,0 @@
|
||||
# HEADER_CHECKS(5) HEADER_CHECKS(5)
|
||||
#
|
||||
# NAME
|
||||
# header_checks - Postfix built-in content inspection
|
||||
#
|
||||
# SYNOPSIS
|
||||
# header_checks = pcre:/etc/postfix/header_checks
|
||||
# mime_header_checks = pcre:/etc/postfix/mime_header_checks
|
||||
# nested_header_checks = pcre:/etc/postfix/nested_header_checks
|
||||
# body_checks = pcre:/etc/postfix/body_checks
|
||||
#
|
||||
# milter_header_checks = pcre:/etc/postfix/milter_header_checks
|
||||
#
|
||||
# smtp_header_checks = pcre:/etc/postfix/smtp_header_checks
|
||||
# smtp_mime_header_checks = pcre:/etc/postfix/smtp_mime_header_checks
|
||||
# smtp_nested_header_checks = pcre:/etc/postfix/smtp_nested_header_checks
|
||||
# smtp_body_checks = pcre:/etc/postfix/smtp_body_checks
|
||||
#
|
||||
# postmap -q "string" pcre:/etc/postfix/filename
|
||||
# postmap -q - pcre:/etc/postfix/filename <inputfile
|
||||
#
|
||||
# DESCRIPTION
|
||||
# This document describes access control on the content of
|
||||
# message headers and message body lines; it is implemented
|
||||
# by the Postfix cleanup(8) server before mail is queued.
|
||||
# See access(5) for access control on remote SMTP client
|
||||
# information.
|
||||
#
|
||||
# Each message header or message body line is compared
|
||||
# against a list of patterns. When a match is found the
|
||||
# corresponding action is executed, and the matching process
|
||||
# is repeated for the next message header or message body
|
||||
# line.
|
||||
#
|
||||
# Note: message headers are examined one logical header at a
|
||||
# time, even when a message header spans multiple lines.
|
||||
# Body lines are always examined one line at a time.
|
||||
#
|
||||
# For examples, see the EXAMPLES section at the end of this
|
||||
# manual page.
|
||||
#
|
||||
# Postfix header or body_checks are designed to stop a flood
|
||||
# of mail from worms or viruses; they do not decode attach-
|
||||
# ments, and they do not unzip archives. See the documents
|
||||
# referenced below in the README FILES section if you need
|
||||
# more sophisticated content analysis.
|
||||
#
|
||||
# FILTERS WHILE RECEIVING MAIL
|
||||
# Postfix implements the following four built-in content
|
||||
# inspection classes while receiving mail:
|
||||
#
|
||||
# header_checks (default: empty)
|
||||
# These are applied to initial message headers
|
||||
# (except for the headers that are processed with
|
||||
# mime_header_checks).
|
||||
#
|
||||
# mime_header_checks (default: $header_checks)
|
||||
# These are applied to MIME related message headers
|
||||
# only.
|
||||
#
|
||||
# This feature is available in Postfix 2.0 and later.
|
||||
#
|
||||
# nested_header_checks (default: $header_checks)
|
||||
# These are applied to message headers of attached
|
||||
# email messages (except for the headers that are
|
||||
# processed with mime_header_checks).
|
||||
#
|
||||
# This feature is available in Postfix 2.0 and later.
|
||||
#
|
||||
# body_checks
|
||||
# These are applied to all other content, including
|
||||
# multi-part message boundaries.
|
||||
#
|
||||
# With Postfix versions before 2.0, all content after
|
||||
# the initial message headers is treated as body con-
|
||||
# tent.
|
||||
#
|
||||
# FILTERS AFTER RECEIVING MAIL
|
||||
# Postfix supports a subset of the built-in content inspec-
|
||||
# tion classes after the message is received:
|
||||
#
|
||||
# milter_header_checks (default: empty)
|
||||
# These are applied to headers that are added with
|
||||
# Milter applications.
|
||||
#
|
||||
# This feature is available in Postfix 2.7 and later.
|
||||
#
|
||||
# FILTERS WHILE DELIVERING MAIL
|
||||
# Postfix supports all four content inspection classes while
|
||||
# delivering mail via SMTP.
|
||||
#
|
||||
# smtp_header_checks (default: empty)
|
||||
#
|
||||
# smtp_mime_header_checks (default: empty)
|
||||
#
|
||||
# smtp_nested_header_checks (default: empty)
|
||||
#
|
||||
# smtp_body_checks (default: empty)
|
||||
# These features are available in Postfix 2.5 and
|
||||
# later.
|
||||
#
|
||||
# COMPATIBILITY
|
||||
# With Postfix version 2.2 and earlier specify "postmap -fq"
|
||||
# to query a table that contains case sensitive patterns. By
|
||||
# default, regexp: and pcre: patterns are case insensitive.
|
||||
#
|
||||
# TABLE FORMAT
|
||||
# This document assumes that header and body_checks rules
|
||||
# are specified in the form of Postfix regular expression
|
||||
# lookup tables. Usually the best performance is obtained
|
||||
# with pcre (Perl Compatible Regular Expression) tables. The
|
||||
# regexp (POSIX regular expressions) tables are usually
|
||||
# slower, but more widely available. Use the command "post-
|
||||
# conf -m" to find out what lookup table types your Postfix
|
||||
# system supports.
|
||||
#
|
||||
# The general format of Postfix regular expression tables is
|
||||
# given below. For a discussion of specific pattern or
|
||||
# flags syntax, see pcre_table(5) or regexp_table(5),
|
||||
# respectively.
|
||||
#
|
||||
# /pattern/flags action
|
||||
# When /pattern/ matches the input string, execute
|
||||
# the corresponding action. See below for a list of
|
||||
# possible actions.
|
||||
#
|
||||
# !/pattern/flags action
|
||||
# When /pattern/ does not match the input string,
|
||||
# execute the corresponding action.
|
||||
#
|
||||
# if /pattern/flags
|
||||
#
|
||||
# endif Match the input string against the patterns between
|
||||
# if and endif, if and only if the same input string
|
||||
# also matches /pattern/. The if..endif can nest.
|
||||
#
|
||||
# Note: do not prepend whitespace to patterns inside
|
||||
# if..endif.
|
||||
#
|
||||
# if !/pattern/flags
|
||||
#
|
||||
# endif Match the input string against the patterns between
|
||||
# if and endif, if and only if the same input string
|
||||
# does not match /pattern/. The if..endif can nest.
|
||||
#
|
||||
# blank lines and comments
|
||||
# Empty lines and whitespace-only lines are ignored,
|
||||
# as are lines whose first non-whitespace character
|
||||
# is a `#'.
|
||||
#
|
||||
# multi-line text
|
||||
# A pattern/action line starts with non-whitespace
|
||||
# text. A line that starts with whitespace continues
|
||||
# a logical line.
|
||||
#
|
||||
# TABLE SEARCH ORDER
|
||||
# For each line of message input, the patterns are applied
|
||||
# in the order as specified in the table. When a pattern is
|
||||
# found that matches the input line, the corresponding
|
||||
# action is executed and then the next input line is
|
||||
# inspected.
|
||||
#
|
||||
# TEXT SUBSTITUTION
|
||||
# Substitution of substrings from the matched expression
|
||||
# into the action string is possible using the conventional
|
||||
# Perl syntax ($1, $2, etc.). The macros in the result
|
||||
# string may need to be written as ${n} or $(n) if they
|
||||
# aren't followed by whitespace.
|
||||
#
|
||||
# Note: since negated patterns (those preceded by !) return
|
||||
# a result when the expression does not match, substitutions
|
||||
# are not available for negated patterns.
|
||||
#
|
||||
# ACTIONS
|
||||
# Action names are case insensitive. They are shown in upper
|
||||
# case for consistency with other Postfix documentation.
|
||||
#
|
||||
# DISCARD optional text...
|
||||
# Claim successful delivery and silently discard the
|
||||
# message. Log the optional text if specified, oth-
|
||||
# erwise log a generic message.
|
||||
#
|
||||
# Note: this action disables further header or
|
||||
# body_checks inspection of the current message and
|
||||
# affects all recipients. To discard only one recip-
|
||||
# ient without discarding the entire message, use the
|
||||
# transport(5) table to direct mail to the discard(8)
|
||||
# service.
|
||||
#
|
||||
# This feature is available in Postfix 2.0 and later.
|
||||
#
|
||||
# This feature is not supported with smtp header/body
|
||||
# checks.
|
||||
#
|
||||
# DUNNO Pretend that the input line did not match any pat-
|
||||
# tern, and inspect the next input line. This action
|
||||
# can be used to shorten the table search.
|
||||
#
|
||||
# For backwards compatibility reasons, Postfix also
|
||||
# accepts OK but it is (and always has been) treated
|
||||
# as DUNNO.
|
||||
#
|
||||
# This feature is available in Postfix 2.1 and later.
|
||||
#
|
||||
# FILTER transport:destination
|
||||
# After the message is queued, send the entire mes-
|
||||
# sage through the specified external content filter.
|
||||
# The transport name specifies the first field of a
|
||||
# mail delivery agent definition in master.cf; the
|
||||
# syntax of the next-hop destination is described in
|
||||
# the manual page of the corresponding delivery
|
||||
# agent. More information about external content
|
||||
# filters is in the Postfix FILTER_README file.
|
||||
#
|
||||
# Note 1: do not use $number regular expression sub-
|
||||
# stitutions for transport or destination unless you
|
||||
# know that the information has a trusted origin.
|
||||
#
|
||||
# Note 2: this action overrides the main.cf con-
|
||||
# tent_filter setting, and affects all recipients of
|
||||
# the message. In the case that multiple FILTER
|
||||
# actions fire, only the last one is executed.
|
||||
#
|
||||
# Note 3: the purpose of the FILTER command is to
|
||||
# override message routing. To override the recipi-
|
||||
# ent's transport but not the next-hop destination,
|
||||
# specify an empty filter destination (Postfix 2.7
|
||||
# and later), or specify a transport:destination that
|
||||
# delivers through a different Postfix instance
|
||||
# (Postfix 2.6 and earlier). Other options are using
|
||||
# the recipient-dependent transport_maps or the sen-
|
||||
# der-dependent sender_dependent_default_transport-
|
||||
# _maps features.
|
||||
#
|
||||
# This feature is available in Postfix 2.0 and later.
|
||||
#
|
||||
# This feature is not supported with smtp header/body
|
||||
# checks.
|
||||
#
|
||||
# HOLD optional text...
|
||||
# Arrange for the message to be placed on the hold
|
||||
# queue, and inspect the next input line. The mes-
|
||||
# sage remains on hold until someone either deletes
|
||||
# it or releases it for delivery. Log the optional
|
||||
# text if specified, otherwise log a generic message.
|
||||
#
|
||||
# Mail that is placed on hold can be examined with
|
||||
# the postcat(1) command, and can be destroyed or
|
||||
# released with the postsuper(1) command.
|
||||
#
|
||||
# Note: use "postsuper -r" to release mail that was
|
||||
# kept on hold for a significant fraction of $maxi-
|
||||
# mal_queue_lifetime or $bounce_queue_lifetime, or
|
||||
# longer. Use "postsuper -H" only for mail that will
|
||||
# not expire within a few delivery attempts.
|
||||
#
|
||||
# Note: this action affects all recipients of the
|
||||
# message.
|
||||
#
|
||||
# This feature is available in Postfix 2.0 and later.
|
||||
#
|
||||
# This feature is not supported with smtp header/body
|
||||
# checks.
|
||||
#
|
||||
# IGNORE Delete the current line from the input, and inspect
|
||||
# the next input line.
|
||||
#
|
||||
# INFO optional text...
|
||||
# Log an "info:" record with the optional text... (or
|
||||
# log a generic text), and inspect the next input
|
||||
# line. This action is useful for routine logging or
|
||||
# for debugging.
|
||||
#
|
||||
# This feature is available in Postfix 2.8 and later.
|
||||
#
|
||||
# PREPEND text...
|
||||
# Prepend one line with the specified text, and
|
||||
# inspect the next input line.
|
||||
#
|
||||
# Notes:
|
||||
#
|
||||
# o The prepended text is output on a separate
|
||||
# line, immediately before the input that
|
||||
# triggered the PREPEND action.
|
||||
#
|
||||
# o The prepended text is not considered part of
|
||||
# the input stream: it is not subject to
|
||||
# header/body checks or address rewriting, and
|
||||
# it does not affect the way that Postfix adds
|
||||
# missing message headers.
|
||||
#
|
||||
# o When prepending text before a message header
|
||||
# line, the prepended text must begin with a
|
||||
# valid message header label.
|
||||
#
|
||||
# o This action cannot be used to prepend multi-
|
||||
# line text.
|
||||
#
|
||||
# This feature is available in Postfix 2.1 and later.
|
||||
#
|
||||
# This feature is not supported with mil-
|
||||
# ter_header_checks.
|
||||
#
|
||||
# REDIRECT user@domain
|
||||
# Write a message redirection request to the queue
|
||||
# file, and inspect the next input line. After the
|
||||
# message is queued, it will be sent to the specified
|
||||
# address instead of the intended recipient(s).
|
||||
#
|
||||
# Note: this action overrides the FILTER action, and
|
||||
# affects all recipients of the message. If multiple
|
||||
# REDIRECT actions fire, only the last one is exe-
|
||||
# cuted.
|
||||
#
|
||||
# This feature is available in Postfix 2.1 and later.
|
||||
#
|
||||
# This feature is not supported with smtp header/body
|
||||
# checks.
|
||||
#
|
||||
# REPLACE text...
|
||||
# Replace the current line with the specified text,
|
||||
# and inspect the next input line.
|
||||
#
|
||||
# This feature is available in Postfix 2.2 and later.
|
||||
# The description below applies to Postfix 2.2.2 and
|
||||
# later.
|
||||
#
|
||||
# Notes:
|
||||
#
|
||||
# o When replacing a message header line, the
|
||||
# replacement text must begin with a valid
|
||||
# header label.
|
||||
#
|
||||
# o The replaced text remains part of the input
|
||||
# stream. Unlike the result from the PREPEND
|
||||
# action, a replaced message header may be
|
||||
# subject to address rewriting and may affect
|
||||
# the way that Postfix adds missing message
|
||||
# headers.
|
||||
#
|
||||
# REJECT optional text...
|
||||
# Reject the entire message. Reply with optional
|
||||
# text... when the optional text is specified, other-
|
||||
# wise reply with a generic error message.
|
||||
#
|
||||
# Note: this action disables further header or
|
||||
# body_checks inspection of the current message and
|
||||
# affects all recipients.
|
||||
#
|
||||
# Postfix version 2.3 and later support enhanced sta-
|
||||
# tus codes. When no code is specified at the begin-
|
||||
# ning of optional text..., Postfix inserts a default
|
||||
# enhanced status code of "5.7.1".
|
||||
#
|
||||
# This feature is not supported with smtp header/body
|
||||
# checks.
|
||||
#
|
||||
# WARN optional text...
|
||||
# Log a "warning:" record with the optional text...
|
||||
# (or log a generic text), and inspect the next input
|
||||
# line. This action is useful for debugging and for
|
||||
# testing a pattern before applying more drastic
|
||||
# actions.
|
||||
#
|
||||
# BUGS
|
||||
# Empty lines never match, because some map types mis-behave
|
||||
# when given a zero-length search string. This limitation
|
||||
# may be removed for regular expression tables in a future
|
||||
# release.
|
||||
#
|
||||
# Many people overlook the main limitations of header and
|
||||
# body_checks rules.
|
||||
#
|
||||
# o These rules operate on one logical message header
|
||||
# or one body line at a time. A decision made for one
|
||||
# line is not carried over to the next line.
|
||||
#
|
||||
# o If text in the message body is encoded (RFC 2045)
|
||||
# then the rules need to be specified for the encoded
|
||||
# form.
|
||||
#
|
||||
# o Likewise, when message headers are encoded (RFC
|
||||
# 2047) then the rules need to be specified for the
|
||||
# encoded form.
|
||||
#
|
||||
# Message headers added by the cleanup(8) daemon itself are
|
||||
# excluded from inspection. Examples of such message headers
|
||||
# are From:, To:, Message-ID:, Date:.
|
||||
#
|
||||
# Message headers deleted by the cleanup(8) daemon will be
|
||||
# examined before they are deleted. Examples are: Bcc:, Con-
|
||||
# tent-Length:, Return-Path:.
|
||||
#
|
||||
# CONFIGURATION PARAMETERS
|
||||
# body_checks
|
||||
# Lookup tables with content filter rules for message
|
||||
# body lines. These filters see one physical line at
|
||||
# a time, in chunks of at most $line_length_limit
|
||||
# bytes.
|
||||
#
|
||||
# body_checks_size_limit
|
||||
# The amount of content per message body segment
|
||||
# (attachment) that is subjected to $body_checks fil-
|
||||
# tering.
|
||||
#
|
||||
# header_checks
|
||||
#
|
||||
# mime_header_checks (default: $header_checks)
|
||||
#
|
||||
# nested_header_checks (default: $header_checks)
|
||||
# Lookup tables with content filter rules for message
|
||||
# header lines: respectively, these are applied to
|
||||
# the initial message headers (not including MIME
|
||||
# headers), to the MIME headers anywhere in the mes-
|
||||
# sage, and to the initial headers of attached mes-
|
||||
# sages.
|
||||
#
|
||||
# Note: these filters see one logical message header
|
||||
# at a time, even when a message header spans multi-
|
||||
# ple lines. Message headers that are longer than
|
||||
# $header_size_limit characters are truncated.
|
||||
#
|
||||
# disable_mime_input_processing
|
||||
# While receiving mail, give no special treatment to
|
||||
# MIME related message headers; all text after the
|
||||
# initial message headers is considered to be part of
|
||||
# the message body. This means that header_checks is
|
||||
# applied to all the initial message headers, and
|
||||
# that body_checks is applied to the remainder of the
|
||||
# message.
|
||||
#
|
||||
# Note: when used in this manner, body_checks will
|
||||
# process a multi-line message header one line at a
|
||||
# time.
|
||||
#
|
||||
# EXAMPLES
|
||||
# Header pattern to block attachments with bad file name
|
||||
# extensions. For convenience, the PCRE /x flag is speci-
|
||||
# fied, so that there is no need to collapse the pattern
|
||||
# into a single line of text. The purpose of the
|
||||
# [[:xdigit:]] sub-expressions is to recognize Windows CLSID
|
||||
# strings.
|
||||
#
|
||||
# /etc/postfix/main.cf:
|
||||
# header_checks = pcre:/etc/postfix/header_checks.pcre
|
||||
#
|
||||
# /etc/postfix/header_checks.pcre:
|
||||
# /^Content-(Disposition|Type).*name\s*=\s*"?(.*(\.|=2E)(
|
||||
# ade|adp|asp|bas|bat|chm|cmd|com|cpl|crt|dll|exe|
|
||||
# hlp|ht[at]|
|
||||
# inf|ins|isp|jse?|lnk|md[betw]|ms[cipt]|nws|
|
||||
# \{[[:xdigit:]]{8}(?:-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}\}|
|
||||
# ops|pcd|pif|prf|reg|sc[frt]|sh[bsm]|swf|
|
||||
# vb[esx]?|vxd|ws[cfh]))(\?=)?"?\s*(;|$)/x
|
||||
# REJECT Attachment name "$2" may not end with ".$4"
|
||||
#
|
||||
# Body pattern to stop a specific HTML browser vulnerability
|
||||
# exploit.
|
||||
#
|
||||
# /etc/postfix/main.cf:
|
||||
# body_checks = regexp:/etc/postfix/body_checks
|
||||
#
|
||||
# /etc/postfix/body_checks:
|
||||
# /^<iframe src=(3D)?cid:.* height=(3D)?0 width=(3D)?0>$/
|
||||
# REJECT IFRAME vulnerability exploit
|
||||
#
|
||||
# SEE ALSO
|
||||
# cleanup(8), canonicalize and enqueue Postfix message
|
||||
# pcre_table(5), format of PCRE lookup tables
|
||||
# regexp_table(5), format of POSIX regular expression tables
|
||||
# postconf(1), Postfix configuration utility
|
||||
# postmap(1), Postfix lookup table management
|
||||
# postsuper(1), Postfix janitor
|
||||
# postcat(1), show Postfix queue file contents
|
||||
# RFC 2045, base64 and quoted-printable encoding rules
|
||||
# RFC 2047, message header encoding for non-ASCII text
|
||||
#
|
||||
# README FILES
|
||||
# Use "postconf readme_directory" or "postconf html_direc-
|
||||
# tory" to locate this information.
|
||||
# DATABASE_README, Postfix lookup table overview
|
||||
# CONTENT_INSPECTION_README, Postfix content inspection overview
|
||||
# BUILTIN_FILTER_README, Postfix built-in content inspection
|
||||
# BACKSCATTER_README, blocking returned forged mail
|
||||
#
|
||||
# LICENSE
|
||||
# The Secure Mailer license must be distributed with this
|
||||
# software.
|
||||
#
|
||||
# AUTHOR(S)
|
||||
# Wietse Venema
|
||||
# IBM T.J. Watson Research
|
||||
# P.O. Box 704
|
||||
# Yorktown Heights, NY 10598, USA
|
||||
#
|
||||
# HEADER_CHECKS(5)
|
||||
@@ -1,28 +0,0 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDaJHIFeHit7KHn
|
||||
i0rgT9kIueUTv0Ukud00FezacYIipCkWKDKFM+x4dVXXPJ1ey3ymFsRAs7wVFm0R
|
||||
a4GBO+vFiNx1HBRnbcZutjbJIPiC+SJONN3UOUDmRSspF1/bxKQZhk4LDmj9X52n
|
||||
le6muvcOuulqdR6wLpezD4v7lJJQQ347mxomVA+dqWBDwwv9zf/nx+q3ejux82TF
|
||||
qTUneGInN1wUIz5hUTt94JiQzOTRACLdNulyOJ/AM0GCNlZoHhkWseb67PITD4zP
|
||||
EJAHlK1nJjJMGtoXFT68Shbv5IL3bj/UbaA9P5+TOgYaXJ9SZmuk9V5oirWzaiuU
|
||||
6GgHm0uDAgMBAAECggEBANN6h6u0ClKa2K8vw+xInKCwD1wgjvi207M+Gjv/1Oie
|
||||
e1KGr8ug9fwlzI14rxwKbBJcefA8DvfmoOBFd+yA2ebL8uX5zfIjYz9LmTtNon7e
|
||||
5hopeHDY/IkAv4H7rivRrEEuihR/6NrSSnYAjbfIA+Gc5NMXLiQhV2H5jXzdoSb7
|
||||
LLbsi294f2F91anUspecM/Hk5/W4JOSllY8RtLWKTxqLN22ujnvZKFqMNB/RH3d1
|
||||
HrFc6jbn8Nb6C5B5VnSBw64RNbpZbCYntbDmb4DCp/+Z2llFNrFM1XxjaJBsrHnJ
|
||||
ZTGoVIPCo1DClP/YUEUP0RTIoM/LUJwfma2hq9MrQ3ECgYEA+pCyx+MnZPog7yLD
|
||||
paR4h4Eb37majfhILO1wJRXGnmCzkp63MOLxSEZIc/JvePlS6FYRdy/F1N6NnST2
|
||||
Z2PO6JaDWxDJOhcc8QSswQsTNkUKjdygbqw4adraltriheCy/9pI131MoMLBYPdg
|
||||
Rvnw2CrPNGwwdm3Wq64fGnL0m8sCgYEA3t+20ft4QqjMYgdNL/HHPiMpgdEIEdNN
|
||||
F+wMxhxcHKI2uR/ZMGGq7AauQcxtNfoPZbQkjKwUSnkJEf6lk5Gr6hb9bz1yviu6
|
||||
NycnxlWvXiqz+Sql2e8xqSdtsw2Vuv+vPBSiUdAz4vRO3MmL8KBfmY8WG+XP78bF
|
||||
HvXSetqwCCkCgYEA0GAhrgYErv8tAHKizlA3RElkyuvp0oNWUraresvfP7sf26FO
|
||||
q8Mv8XExs+s8NRjzj/Bz2fDKzzq9/p/MozLn0ZnKZ6NQFZU/JllC6c+yDIHiQxPl
|
||||
/+QNjkrJWodxtvClLA12Ym77mP4eH+vaD2ywlLUVWH1Y2ESEMIY/q5lKP30CgYEA
|
||||
kFO/SGvYjRJSiIjB63Je3FZY4sBCwYhcPEmYXBKxc7l4RpnhQ/t7fC03W1TOxE2S
|
||||
+wGVSaOF4FRRE14cS1viQE1zAT6Bt7UJef3ZPA7w6cItmgWMMX08Y5Ys6+64L8iz
|
||||
6exS0ThK4YXkLAY4oTK5te97GcXQyi2mKU53ZyeHJ0ECgYAtqdndLIkiirXplJ10
|
||||
9VkrDKZG/Zsqm7vQjl//ZPIDzWcwo3ehBvyt4U+mnjUt+WQ4+YpmZ8mxIv486ZsI
|
||||
2GqNZVrtKE+p2llmXYIw87/NofMB+D5AfodYzjJElO+X4YQSkCQIcZOVyL2BDBs5
|
||||
D5SV7kNMb2fRDwK1/mmYBscfEw==
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -1,706 +0,0 @@
|
||||
# Global Postfix configuration file. This file lists only a subset
|
||||
# of all parameters. For the syntax, and for a complete parameter
|
||||
# list, see the postconf(5) manual page (command: "man 5 postconf").
|
||||
#
|
||||
# For common configuration examples, see BASIC_CONFIGURATION_README
|
||||
# and STANDARD_CONFIGURATION_README. To find these documents, use
|
||||
# the command "postconf html_directory readme_directory", or go to
|
||||
# http://www.postfix.org/.
|
||||
#
|
||||
# For best results, change no more than 2-3 parameters at a time,
|
||||
# and test if Postfix still works after every change.
|
||||
|
||||
# SOFT BOUNCE
|
||||
#
|
||||
# The soft_bounce parameter provides a limited safety net for
|
||||
# testing. When soft_bounce is enabled, mail will remain queued that
|
||||
# would otherwise bounce. This parameter disables locally-generated
|
||||
# bounces, and prevents the SMTP server from rejecting mail permanently
|
||||
# (by changing 5xx replies into 4xx replies). However, soft_bounce
|
||||
# is no cure for address rewriting mistakes or mail routing mistakes.
|
||||
#
|
||||
#soft_bounce = no
|
||||
|
||||
# LOCAL PATHNAME INFORMATION
|
||||
#
|
||||
# The queue_directory specifies the location of the Postfix queue.
|
||||
# This is also the root directory of Postfix daemons that run chrooted.
|
||||
# See the files in examples/chroot-setup for setting up Postfix chroot
|
||||
# environments on different UNIX systems.
|
||||
#
|
||||
queue_directory = /var/spool/postfix
|
||||
|
||||
# The command_directory parameter specifies the location of all
|
||||
# postXXX commands.
|
||||
#
|
||||
command_directory = /usr/sbin
|
||||
|
||||
# The daemon_directory parameter specifies the location of all Postfix
|
||||
# daemon programs (i.e. programs listed in the master.cf file). This
|
||||
# directory must be owned by root.
|
||||
#
|
||||
daemon_directory = /usr/libexec/postfix
|
||||
|
||||
# The data_directory parameter specifies the location of Postfix-writable
|
||||
# data files (caches, random numbers). This directory must be owned
|
||||
# by the mail_owner account (see below).
|
||||
#
|
||||
data_directory = /var/lib/postfix
|
||||
|
||||
# QUEUE AND PROCESS OWNERSHIP
|
||||
#
|
||||
# The mail_owner parameter specifies the owner of the Postfix queue
|
||||
# and of most Postfix daemon processes. Specify the name of a user
|
||||
# account THAT DOES NOT SHARE ITS USER OR GROUP ID WITH OTHER ACCOUNTS
|
||||
# AND THAT OWNS NO OTHER FILES OR PROCESSES ON THE SYSTEM. In
|
||||
# particular, don't specify nobody or daemon. PLEASE USE A DEDICATED
|
||||
# USER.
|
||||
#
|
||||
mail_owner = postfix
|
||||
|
||||
# The default_privs parameter specifies the default rights used by
|
||||
# the local delivery agent for delivery to external file or command.
|
||||
# These rights are used in the absence of a recipient user context.
|
||||
# DO NOT SPECIFY A PRIVILEGED USER OR THE POSTFIX OWNER.
|
||||
#
|
||||
#default_privs = nobody
|
||||
|
||||
# INTERNET HOST AND DOMAIN NAMES
|
||||
#
|
||||
# The myhostname parameter specifies the internet hostname of this
|
||||
# mail system. The default is to use the fully-qualified domain name
|
||||
# from gethostname(). $myhostname is used as a default value for many
|
||||
# other configuration parameters.
|
||||
#
|
||||
#myhostname = host.domain.tld
|
||||
#myhostname = virtual.domain.tld
|
||||
|
||||
# The mydomain parameter specifies the local internet domain name.
|
||||
# The default is to use $myhostname minus the first component.
|
||||
# $mydomain is used as a default value for many other configuration
|
||||
# parameters.
|
||||
#
|
||||
#mydomain = domain.tld
|
||||
|
||||
# SENDING MAIL
|
||||
#
|
||||
# The myorigin parameter specifies the domain that locally-posted
|
||||
# mail appears to come from. The default is to append $myhostname,
|
||||
# which is fine for small sites. If you run a domain with multiple
|
||||
# machines, you should (1) change this to $mydomain and (2) set up
|
||||
# a domain-wide alias database that aliases each user to
|
||||
# user@that.users.mailhost.
|
||||
#
|
||||
# For the sake of consistency between sender and recipient addresses,
|
||||
# myorigin also specifies the default domain name that is appended
|
||||
# to recipient addresses that have no @domain part.
|
||||
#
|
||||
#myorigin = $myhostname
|
||||
#myorigin = $mydomain
|
||||
|
||||
# RECEIVING MAIL
|
||||
|
||||
# The inet_interfaces parameter specifies the network interface
|
||||
# addresses that this mail system receives mail on. By default,
|
||||
# the software claims all active interfaces on the machine. The
|
||||
# parameter also controls delivery of mail to user@[ip.address].
|
||||
#
|
||||
# See also the proxy_interfaces parameter, for network addresses that
|
||||
# are forwarded to us via a proxy or network address translator.
|
||||
#
|
||||
# Note: you need to stop/start Postfix when this parameter changes.
|
||||
#
|
||||
#inet_interfaces = all
|
||||
#inet_interfaces = $myhostname
|
||||
#inet_interfaces = $myhostname, localhost
|
||||
inet_interfaces = all
|
||||
|
||||
# Enable IPv4, and IPv6 if supported
|
||||
inet_protocols = all
|
||||
|
||||
# The proxy_interfaces parameter specifies the network interface
|
||||
# addresses that this mail system receives mail on by way of a
|
||||
# proxy or network address translation unit. This setting extends
|
||||
# the address list specified with the inet_interfaces parameter.
|
||||
#
|
||||
# You must specify your proxy/NAT addresses when your system is a
|
||||
# backup MX host for other domains, otherwise mail delivery loops
|
||||
# will happen when the primary MX host is down.
|
||||
#
|
||||
#proxy_interfaces =
|
||||
#proxy_interfaces = 1.2.3.4
|
||||
|
||||
# The mydestination parameter specifies the list of domains that this
|
||||
# machine considers itself the final destination for.
|
||||
#
|
||||
# These domains are routed to the delivery agent specified with the
|
||||
# local_transport parameter setting. By default, that is the UNIX
|
||||
# compatible delivery agent that lookups all recipients in /etc/passwd
|
||||
# and /etc/aliases or their equivalent.
|
||||
#
|
||||
# The default is $myhostname + localhost.$mydomain. On a mail domain
|
||||
# gateway, you should also include $mydomain.
|
||||
#
|
||||
# Do not specify the names of virtual domains - those domains are
|
||||
# specified elsewhere (see VIRTUAL_README).
|
||||
#
|
||||
# Do not specify the names of domains that this machine is backup MX
|
||||
# host for. Specify those names via the relay_domains settings for
|
||||
# the SMTP server, or use permit_mx_backup if you are lazy (see
|
||||
# STANDARD_CONFIGURATION_README).
|
||||
#
|
||||
# The local machine is always the final destination for mail addressed
|
||||
# to user@[the.net.work.address] of an interface that the mail system
|
||||
# receives mail on (see the inet_interfaces parameter).
|
||||
#
|
||||
# Specify a list of host or domain names, /file/name or type:table
|
||||
# patterns, separated by commas and/or whitespace. A /file/name
|
||||
# pattern is replaced by its contents; a type:table is matched when
|
||||
# a name matches a lookup key (the right-hand side is ignored).
|
||||
# Continue long lines by starting the next line with whitespace.
|
||||
#
|
||||
# See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS".
|
||||
#
|
||||
mydestination = localhost, localhost.localdomain
|
||||
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
|
||||
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
|
||||
# mail.$mydomain, www.$mydomain, ftp.$mydomain
|
||||
|
||||
# REJECTING MAIL FOR UNKNOWN LOCAL USERS
|
||||
#
|
||||
# The local_recipient_maps parameter specifies optional lookup tables
|
||||
# with all names or addresses of users that are local with respect
|
||||
# to $mydestination, $inet_interfaces or $proxy_interfaces.
|
||||
#
|
||||
# If this parameter is defined, then the SMTP server will reject
|
||||
# mail for unknown local users. This parameter is defined by default.
|
||||
#
|
||||
# To turn off local recipient checking in the SMTP server, specify
|
||||
# local_recipient_maps = (i.e. empty).
|
||||
#
|
||||
# The default setting assumes that you use the default Postfix local
|
||||
# delivery agent for local delivery. You need to update the
|
||||
# local_recipient_maps setting if:
|
||||
#
|
||||
# - You define $mydestination domain recipients in files other than
|
||||
# /etc/passwd, /etc/aliases, or the $virtual_alias_maps files.
|
||||
# For example, you define $mydestination domain recipients in
|
||||
# the $virtual_mailbox_maps files.
|
||||
#
|
||||
# - You redefine the local delivery agent in master.cf.
|
||||
#
|
||||
# - You redefine the "local_transport" setting in main.cf.
|
||||
#
|
||||
# - You use the "luser_relay", "mailbox_transport", or "fallback_transport"
|
||||
# feature of the Postfix local delivery agent (see local(8)).
|
||||
#
|
||||
# Details are described in the LOCAL_RECIPIENT_README file.
|
||||
#
|
||||
# Beware: if the Postfix SMTP server runs chrooted, you probably have
|
||||
# to access the passwd file via the proxymap service, in order to
|
||||
# overcome chroot restrictions. The alternative, having a copy of
|
||||
# the system passwd file in the chroot jail is just not practical.
|
||||
#
|
||||
# The right-hand side of the lookup tables is conveniently ignored.
|
||||
# In the left-hand side, specify a bare username, an @domain.tld
|
||||
# wild-card, or specify a user@domain.tld address.
|
||||
#
|
||||
#local_recipient_maps = unix:passwd.byname $alias_maps
|
||||
#local_recipient_maps = proxy:unix:passwd.byname $alias_maps
|
||||
#local_recipient_maps =
|
||||
|
||||
# The unknown_local_recipient_reject_code specifies the SMTP server
|
||||
# response code when a recipient domain matches $mydestination or
|
||||
# ${proxy,inet}_interfaces, while $local_recipient_maps is non-empty
|
||||
# and the recipient address or address local-part is not found.
|
||||
#
|
||||
# The default setting is 550 (reject mail) but it is safer to start
|
||||
# with 450 (try again later) until you are certain that your
|
||||
# local_recipient_maps settings are OK.
|
||||
#
|
||||
unknown_local_recipient_reject_code = 550
|
||||
|
||||
# TRUST AND RELAY CONTROL
|
||||
|
||||
# The mynetworks parameter specifies the list of "trusted" SMTP
|
||||
# clients that have more privileges than "strangers".
|
||||
#
|
||||
# In particular, "trusted" SMTP clients are allowed to relay mail
|
||||
# through Postfix. See the smtpd_recipient_restrictions parameter
|
||||
# in postconf(5).
|
||||
#
|
||||
# You can specify the list of "trusted" network addresses by hand
|
||||
# or you can let Postfix do it for you (which is the default).
|
||||
#
|
||||
# By default (mynetworks_style = subnet), Postfix "trusts" SMTP
|
||||
# clients in the same IP subnetworks as the local machine.
|
||||
# On Linux, this does works correctly only with interfaces specified
|
||||
# with the "ifconfig" command.
|
||||
#
|
||||
# Specify "mynetworks_style = class" when Postfix should "trust" SMTP
|
||||
# clients in the same IP class A/B/C networks as the local machine.
|
||||
# Don't do this with a dialup site - it would cause Postfix to "trust"
|
||||
# your entire provider's network. Instead, specify an explicit
|
||||
# mynetworks list by hand, as described below.
|
||||
#
|
||||
# Specify "mynetworks_style = host" when Postfix should "trust"
|
||||
# only the local machine.
|
||||
#
|
||||
#mynetworks_style = class
|
||||
#mynetworks_style = subnet
|
||||
#mynetworks_style = host
|
||||
|
||||
# Alternatively, you can specify the mynetworks list by hand, in
|
||||
# which case Postfix ignores the mynetworks_style setting.
|
||||
#
|
||||
# Specify an explicit list of network/netmask patterns, where the
|
||||
# mask specifies the number of bits in the network part of a host
|
||||
# address.
|
||||
#
|
||||
# You can also specify the absolute pathname of a pattern file instead
|
||||
# of listing the patterns here. Specify type:table for table-based lookups
|
||||
# (the value on the table right-hand side is not used).
|
||||
#
|
||||
#mynetworks = 168.100.189.0/28, 127.0.0.0/8
|
||||
#mynetworks = $config_directory/mynetworks
|
||||
#mynetworks = hash:/etc/postfix/network_table
|
||||
|
||||
# The relay_domains parameter restricts what destinations this system will
|
||||
# relay mail to. See the smtpd_recipient_restrictions description in
|
||||
# postconf(5) for detailed information.
|
||||
#
|
||||
# By default, Postfix relays mail
|
||||
# - from "trusted" clients (IP address matches $mynetworks) to any destination,
|
||||
# - from "untrusted" clients to destinations that match $relay_domains or
|
||||
# subdomains thereof, except addresses with sender-specified routing.
|
||||
# The default relay_domains value is $mydestination.
|
||||
#
|
||||
# In addition to the above, the Postfix SMTP server by default accepts mail
|
||||
# that Postfix is final destination for:
|
||||
# - destinations that match $inet_interfaces or $proxy_interfaces,
|
||||
# - destinations that match $mydestination
|
||||
# - destinations that match $virtual_alias_domains,
|
||||
# - destinations that match $virtual_mailbox_domains.
|
||||
# These destinations do not need to be listed in $relay_domains.
|
||||
#
|
||||
# Specify a list of hosts or domains, /file/name patterns or type:name
|
||||
# lookup tables, separated by commas and/or whitespace. Continue
|
||||
# long lines by starting the next line with whitespace. A file name
|
||||
# is replaced by its contents; a type:name table is matched when a
|
||||
# (parent) domain appears as lookup key.
|
||||
#
|
||||
# NOTE: Postfix will not automatically forward mail for domains that
|
||||
# list this system as their primary or backup MX host. See the
|
||||
# permit_mx_backup restriction description in postconf(5).
|
||||
#
|
||||
#relay_domains = $mydestination
|
||||
|
||||
# INTERNET OR INTRANET
|
||||
|
||||
# The relayhost parameter specifies the default host to send mail to
|
||||
# when no entry is matched in the optional transport(5) table. When
|
||||
# no relayhost is given, mail is routed directly to the destination.
|
||||
#
|
||||
# On an intranet, specify the organizational domain name. If your
|
||||
# internal DNS uses no MX records, specify the name of the intranet
|
||||
# gateway host instead.
|
||||
#
|
||||
# In the case of SMTP, specify a domain, host, host:port, [host]:port,
|
||||
# [address] or [address]:port; the form [host] turns off MX lookups.
|
||||
#
|
||||
# If you're connected via UUCP, see also the default_transport parameter.
|
||||
#
|
||||
#relayhost = $mydomain
|
||||
#relayhost = [gateway.my.domain]
|
||||
#relayhost = [mailserver.isp.tld]
|
||||
#relayhost = uucphost
|
||||
#relayhost = [an.ip.add.ress]
|
||||
|
||||
# REJECTING UNKNOWN RELAY USERS
|
||||
#
|
||||
# The relay_recipient_maps parameter specifies optional lookup tables
|
||||
# with all addresses in the domains that match $relay_domains.
|
||||
#
|
||||
# If this parameter is defined, then the SMTP server will reject
|
||||
# mail for unknown relay users. This feature is off by default.
|
||||
#
|
||||
# The right-hand side of the lookup tables is conveniently ignored.
|
||||
# In the left-hand side, specify an @domain.tld wild-card, or specify
|
||||
# a user@domain.tld address.
|
||||
#
|
||||
#relay_recipient_maps = hash:/etc/postfix/relay_recipients
|
||||
|
||||
# INPUT RATE CONTROL
|
||||
#
|
||||
# The in_flow_delay configuration parameter implements mail input
|
||||
# flow control. This feature is turned on by default, although it
|
||||
# still needs further development (it's disabled on SCO UNIX due
|
||||
# to an SCO bug).
|
||||
#
|
||||
# A Postfix process will pause for $in_flow_delay seconds before
|
||||
# accepting a new message, when the message arrival rate exceeds the
|
||||
# message delivery rate. With the default 100 SMTP server process
|
||||
# limit, this limits the mail inflow to 100 messages a second more
|
||||
# than the number of messages delivered per second.
|
||||
#
|
||||
# Specify 0 to disable the feature. Valid delays are 0..10.
|
||||
#
|
||||
#in_flow_delay = 1s
|
||||
|
||||
# ADDRESS REWRITING
|
||||
#
|
||||
# The ADDRESS_REWRITING_README document gives information about
|
||||
# address masquerading or other forms of address rewriting including
|
||||
# username->Firstname.Lastname mapping.
|
||||
|
||||
# ADDRESS REDIRECTION (VIRTUAL DOMAIN)
|
||||
#
|
||||
# The VIRTUAL_README document gives information about the many forms
|
||||
# of domain hosting that Postfix supports.
|
||||
|
||||
# "USER HAS MOVED" BOUNCE MESSAGES
|
||||
#
|
||||
# See the discussion in the ADDRESS_REWRITING_README document.
|
||||
|
||||
# TRANSPORT MAP
|
||||
#
|
||||
# See the discussion in the ADDRESS_REWRITING_README document.
|
||||
|
||||
# ALIAS DATABASE
|
||||
#
|
||||
# The alias_maps parameter specifies the list of alias databases used
|
||||
# by the local delivery agent. The default list is system dependent.
|
||||
#
|
||||
# On systems with NIS, the default is to search the local alias
|
||||
# database, then the NIS alias database. See aliases(5) for syntax
|
||||
# details.
|
||||
#
|
||||
# If you change the alias database, run "postalias /etc/aliases" (or
|
||||
# wherever your system stores the mail alias file), or simply run
|
||||
# "newaliases" to build the necessary DBM or DB file.
|
||||
#
|
||||
# It will take a minute or so before changes become visible. Use
|
||||
# "postfix reload" to eliminate the delay.
|
||||
#
|
||||
#alias_maps = dbm:/etc/aliases
|
||||
alias_maps = hash:/etc/aliases
|
||||
#alias_maps = hash:/etc/aliases, nis:mail.aliases
|
||||
#alias_maps = netinfo:/aliases
|
||||
|
||||
# The alias_database parameter specifies the alias database(s) that
|
||||
# are built with "newaliases" or "sendmail -bi". This is a separate
|
||||
# configuration parameter, because alias_maps (see above) may specify
|
||||
# tables that are not necessarily all under control by Postfix.
|
||||
#
|
||||
#alias_database = dbm:/etc/aliases
|
||||
#alias_database = dbm:/etc/mail/aliases
|
||||
alias_database = hash:/etc/aliases
|
||||
#alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases
|
||||
|
||||
# ADDRESS EXTENSIONS (e.g., user+foo)
|
||||
#
|
||||
# The recipient_delimiter parameter specifies the separator between
|
||||
# user names and address extensions (user+foo). See canonical(5),
|
||||
# local(8), relocated(5) and virtual(5) for the effects this has on
|
||||
# aliases, canonical, virtual, relocated and .forward file lookups.
|
||||
# Basically, the software tries user+foo and .forward+foo before
|
||||
# trying user and .forward.
|
||||
#
|
||||
#recipient_delimiter = +
|
||||
|
||||
# DELIVERY TO MAILBOX
|
||||
#
|
||||
# The home_mailbox parameter specifies the optional pathname of a
|
||||
# mailbox file relative to a user's home directory. The default
|
||||
# mailbox file is /var/spool/mail/user or /var/mail/user. Specify
|
||||
# "Maildir/" for qmail-style delivery (the / is required).
|
||||
#
|
||||
#home_mailbox = Mailbox
|
||||
#home_mailbox = Maildir/
|
||||
|
||||
# The mail_spool_directory parameter specifies the directory where
|
||||
# UNIX-style mailboxes are kept. The default setting depends on the
|
||||
# system type.
|
||||
#
|
||||
#mail_spool_directory = /var/mail
|
||||
#mail_spool_directory = /var/spool/mail
|
||||
|
||||
# The mailbox_command parameter specifies the optional external
|
||||
# command to use instead of mailbox delivery. The command is run as
|
||||
# the recipient with proper HOME, SHELL and LOGNAME environment settings.
|
||||
# Exception: delivery for root is done as $default_user.
|
||||
#
|
||||
# Other environment variables of interest: USER (recipient username),
|
||||
# EXTENSION (address extension), DOMAIN (domain part of address),
|
||||
# and LOCAL (the address localpart).
|
||||
#
|
||||
# Unlike other Postfix configuration parameters, the mailbox_command
|
||||
# parameter is not subjected to $parameter substitutions. This is to
|
||||
# make it easier to specify shell syntax (see example below).
|
||||
#
|
||||
# Avoid shell meta characters because they will force Postfix to run
|
||||
# an expensive shell process. Procmail alone is expensive enough.
|
||||
#
|
||||
# IF YOU USE THIS TO DELIVER MAIL SYSTEM-WIDE, YOU MUST SET UP AN
|
||||
# ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.
|
||||
#
|
||||
#mailbox_command = /some/where/procmail
|
||||
#mailbox_command = /some/where/procmail -a "$EXTENSION"
|
||||
|
||||
# The mailbox_transport specifies the optional transport in master.cf
|
||||
# to use after processing aliases and .forward files. This parameter
|
||||
# has precedence over the mailbox_command, fallback_transport and
|
||||
# luser_relay parameters.
|
||||
#
|
||||
# Specify a string of the form transport:nexthop, where transport is
|
||||
# the name of a mail delivery transport defined in master.cf. The
|
||||
# :nexthop part is optional. For more details see the sample transport
|
||||
# configuration file.
|
||||
#
|
||||
# NOTE: if you use this feature for accounts not in the UNIX password
|
||||
# file, then you must update the "local_recipient_maps" setting in
|
||||
# the main.cf file, otherwise the SMTP server will reject mail for
|
||||
# non-UNIX accounts with "User unknown in local recipient table".
|
||||
#
|
||||
# Cyrus IMAP over LMTP. Specify ``lmtpunix cmd="lmtpd"
|
||||
# listen="/var/imap/socket/lmtp" prefork=0'' in cyrus.conf.
|
||||
#mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp
|
||||
|
||||
# If using the cyrus-imapd IMAP server deliver local mail to the IMAP
|
||||
# server using LMTP (Local Mail Transport Protocol), this is prefered
|
||||
# over the older cyrus deliver program by setting the
|
||||
# mailbox_transport as below:
|
||||
#
|
||||
# mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp
|
||||
#
|
||||
# The efficiency of LMTP delivery for cyrus-imapd can be enhanced via
|
||||
# these settings.
|
||||
#
|
||||
# local_destination_recipient_limit = 300
|
||||
# local_destination_concurrency_limit = 5
|
||||
#
|
||||
# Of course you should adjust these settings as appropriate for the
|
||||
# capacity of the hardware you are using. The recipient limit setting
|
||||
# can be used to take advantage of the single instance message store
|
||||
# capability of Cyrus. The concurrency limit can be used to control
|
||||
# how many simultaneous LMTP sessions will be permitted to the Cyrus
|
||||
# message store.
|
||||
#
|
||||
# Cyrus IMAP via command line. Uncomment the "cyrus...pipe" and
|
||||
# subsequent line in master.cf.
|
||||
#mailbox_transport = cyrus
|
||||
|
||||
# The fallback_transport specifies the optional transport in master.cf
|
||||
# to use for recipients that are not found in the UNIX passwd database.
|
||||
# This parameter has precedence over the luser_relay parameter.
|
||||
#
|
||||
# Specify a string of the form transport:nexthop, where transport is
|
||||
# the name of a mail delivery transport defined in master.cf. The
|
||||
# :nexthop part is optional. For more details see the sample transport
|
||||
# configuration file.
|
||||
#
|
||||
# NOTE: if you use this feature for accounts not in the UNIX password
|
||||
# file, then you must update the "local_recipient_maps" setting in
|
||||
# the main.cf file, otherwise the SMTP server will reject mail for
|
||||
# non-UNIX accounts with "User unknown in local recipient table".
|
||||
#
|
||||
#fallback_transport = lmtp:unix:/var/lib/imap/socket/lmtp
|
||||
#fallback_transport =
|
||||
|
||||
# The luser_relay parameter specifies an optional destination address
|
||||
# for unknown recipients. By default, mail for unknown@$mydestination,
|
||||
# unknown@[$inet_interfaces] or unknown@[$proxy_interfaces] is returned
|
||||
# as undeliverable.
|
||||
#
|
||||
# The following expansions are done on luser_relay: $user (recipient
|
||||
# username), $shell (recipient shell), $home (recipient home directory),
|
||||
# $recipient (full recipient address), $extension (recipient address
|
||||
# extension), $domain (recipient domain), $local (entire recipient
|
||||
# localpart), $recipient_delimiter. Specify ${name?value} or
|
||||
# ${name:value} to expand value only when $name does (does not) exist.
|
||||
#
|
||||
# luser_relay works only for the default Postfix local delivery agent.
|
||||
#
|
||||
# NOTE: if you use this feature for accounts not in the UNIX password
|
||||
# file, then you must specify "local_recipient_maps =" (i.e. empty) in
|
||||
# the main.cf file, otherwise the SMTP server will reject mail for
|
||||
# non-UNIX accounts with "User unknown in local recipient table".
|
||||
#
|
||||
#luser_relay = $user@other.host
|
||||
#luser_relay = $local@other.host
|
||||
#luser_relay = admin+$local
|
||||
|
||||
# JUNK MAIL CONTROLS
|
||||
#
|
||||
# The controls listed here are only a very small subset. The file
|
||||
# SMTPD_ACCESS_README provides an overview.
|
||||
|
||||
# The header_checks parameter specifies an optional table with patterns
|
||||
# that each logical message header is matched against, including
|
||||
# headers that span multiple physical lines.
|
||||
#
|
||||
# By default, these patterns also apply to MIME headers and to the
|
||||
# headers of attached messages. With older Postfix versions, MIME and
|
||||
# attached message headers were treated as body text.
|
||||
#
|
||||
# For details, see "man header_checks".
|
||||
#
|
||||
#header_checks = regexp:/etc/postfix/header_checks
|
||||
|
||||
# FAST ETRN SERVICE
|
||||
#
|
||||
# Postfix maintains per-destination logfiles with information about
|
||||
# deferred mail, so that mail can be flushed quickly with the SMTP
|
||||
# "ETRN domain.tld" command, or by executing "sendmail -qRdomain.tld".
|
||||
# See the ETRN_README document for a detailed description.
|
||||
#
|
||||
# The fast_flush_domains parameter controls what destinations are
|
||||
# eligible for this service. By default, they are all domains that
|
||||
# this server is willing to relay mail to.
|
||||
#
|
||||
#fast_flush_domains = $relay_domains
|
||||
|
||||
# SHOW SOFTWARE VERSION OR NOT
|
||||
#
|
||||
# The smtpd_banner parameter specifies the text that follows the 220
|
||||
# code in the SMTP server's greeting banner. Some people like to see
|
||||
# the mail version advertised. By default, Postfix shows no version.
|
||||
#
|
||||
# You MUST specify $myhostname at the start of the text. That is an
|
||||
# RFC requirement. Postfix itself does not care.
|
||||
#
|
||||
#smtpd_banner = $myhostname ESMTP $mail_name
|
||||
#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
|
||||
|
||||
# PARALLEL DELIVERY TO THE SAME DESTINATION
|
||||
#
|
||||
# How many parallel deliveries to the same user or domain? With local
|
||||
# delivery, it does not make sense to do massively parallel delivery
|
||||
# to the same user, because mailbox updates must happen sequentially,
|
||||
# and expensive pipelines in .forward files can cause disasters when
|
||||
# too many are run at the same time. With SMTP deliveries, 10
|
||||
# simultaneous connections to the same domain could be sufficient to
|
||||
# raise eyebrows.
|
||||
#
|
||||
# Each message delivery transport has its XXX_destination_concurrency_limit
|
||||
# parameter. The default is $default_destination_concurrency_limit for
|
||||
# most delivery transports. For the local delivery agent the default is 2.
|
||||
|
||||
#local_destination_concurrency_limit = 2
|
||||
#default_destination_concurrency_limit = 20
|
||||
|
||||
# DEBUGGING CONTROL
|
||||
#
|
||||
# The debug_peer_level parameter specifies the increment in verbose
|
||||
# logging level when an SMTP client or server host name or address
|
||||
# matches a pattern in the debug_peer_list parameter.
|
||||
#
|
||||
debug_peer_level = 2
|
||||
|
||||
# The debug_peer_list parameter specifies an optional list of domain
|
||||
# or network patterns, /file/name patterns or type:name tables. When
|
||||
# an SMTP client or server host name or address matches a pattern,
|
||||
# increase the verbose logging level by the amount specified in the
|
||||
# debug_peer_level parameter.
|
||||
#
|
||||
#debug_peer_list = 127.0.0.1
|
||||
#debug_peer_list = some.domain
|
||||
|
||||
# The debugger_command specifies the external command that is executed
|
||||
# when a Postfix daemon program is run with the -D option.
|
||||
#
|
||||
# Use "command .. & sleep 5" so that the debugger can attach before
|
||||
# the process marches on. If you use an X-based debugger, be sure to
|
||||
# set up your XAUTHORITY environment variable before starting Postfix.
|
||||
#
|
||||
debugger_command =
|
||||
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
|
||||
ddd $daemon_directory/$process_name $process_id & sleep 5
|
||||
|
||||
# If you can't use X, use this to capture the call stack when a
|
||||
# daemon crashes. The result is in a file in the configuration
|
||||
# directory, and is named after the process name and the process ID.
|
||||
#
|
||||
# debugger_command =
|
||||
# PATH=/bin:/usr/bin:/usr/local/bin; export PATH; (echo cont;
|
||||
# echo where) | gdb $daemon_directory/$process_name $process_id 2>&1
|
||||
# >$config_directory/$process_name.$process_id.log & sleep 5
|
||||
#
|
||||
# Another possibility is to run gdb under a detached screen session.
|
||||
# To attach to the screen sesssion, su root and run "screen -r
|
||||
# <id_string>" where <id_string> uniquely matches one of the detached
|
||||
# sessions (from "screen -list").
|
||||
#
|
||||
# debugger_command =
|
||||
# PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH; screen
|
||||
# -dmS $process_name gdb $daemon_directory/$process_name
|
||||
# $process_id & sleep 1
|
||||
|
||||
# INSTALL-TIME CONFIGURATION INFORMATION
|
||||
#
|
||||
# The following parameters are used when installing a new Postfix version.
|
||||
#
|
||||
# sendmail_path: The full pathname of the Postfix sendmail command.
|
||||
# This is the Sendmail-compatible mail posting interface.
|
||||
#
|
||||
sendmail_path = /usr/sbin/sendmail.postfix
|
||||
|
||||
# newaliases_path: The full pathname of the Postfix newaliases command.
|
||||
# This is the Sendmail-compatible command to build alias databases.
|
||||
#
|
||||
newaliases_path = /usr/bin/newaliases.postfix
|
||||
|
||||
# mailq_path: The full pathname of the Postfix mailq command. This
|
||||
# is the Sendmail-compatible mail queue listing command.
|
||||
#
|
||||
mailq_path = /usr/bin/mailq.postfix
|
||||
|
||||
# setgid_group: The group for mail submission and queue management
|
||||
# commands. This must be a group name with a numerical group ID that
|
||||
# is not shared with other accounts, not even with the Postfix account.
|
||||
#
|
||||
setgid_group = postdrop
|
||||
|
||||
# html_directory: The location of the Postfix HTML documentation.
|
||||
#
|
||||
html_directory = no
|
||||
|
||||
# manpage_directory: The location of the Postfix on-line manual pages.
|
||||
#
|
||||
manpage_directory = /usr/share/man
|
||||
|
||||
# sample_directory: The location of the Postfix sample configuration files.
|
||||
# This parameter is obsolete as of Postfix 2.1.
|
||||
#
|
||||
sample_directory = /usr/share/doc/postfix-2.10.1/samples
|
||||
|
||||
# readme_directory: The location of the Postfix README files.
|
||||
#
|
||||
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
|
||||
|
||||
myhostname = server.example.com
|
||||
mynetworks = 127.0.0.0/8
|
||||
message_size_limit = 30720000
|
||||
virtual_alias_domains =
|
||||
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
|
||||
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
|
||||
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
|
||||
virtual_mailbox_base = /home/vmail
|
||||
virtual_uid_maps = static:5000
|
||||
virtual_gid_maps = static:5000
|
||||
smtpd_sasl_type = dovecot
|
||||
smtpd_sasl_path = private/auth
|
||||
smtpd_sasl_auth_enable = yes
|
||||
broken_sasl_auth_clients = yes
|
||||
smtpd_sasl_authenticated_header = yes
|
||||
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
|
||||
smtpd_use_tls = yes
|
||||
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
|
||||
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
|
||||
virtual_create_maildirsize = yes
|
||||
virtual_maildir_extended = yes
|
||||
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
|
||||
virtual_transport = dovecot
|
||||
dovecot_destination_recipient_limit = 1
|
||||
inet_interfaces = all
|
||||
smtp_tls_security_level = may
|
||||
@@ -1,129 +0,0 @@
|
||||
#
|
||||
# Postfix master process configuration file. For details on the format
|
||||
# of the file, see the master(5) manual page (command: "man 5 master").
|
||||
#
|
||||
# Do not forget to execute "postfix reload" after editing this file.
|
||||
#
|
||||
# ==========================================================================
|
||||
# service type private unpriv chroot wakeup maxproc command + args
|
||||
# (yes) (yes) (yes) (never) (100)
|
||||
# ==========================================================================
|
||||
smtp inet n - n - - smtpd
|
||||
#smtp inet n - n - 1 postscreen
|
||||
#smtpd pass - - n - - smtpd
|
||||
#dnsblog unix - - n - 0 dnsblog
|
||||
#tlsproxy unix - - n - 0 tlsproxy
|
||||
submission inet n - n - - smtpd
|
||||
-o syslog_name=postfix/submission
|
||||
-o smtpd_tls_security_level=encrypt
|
||||
-o smtpd_sasl_auth_enable=yes
|
||||
-o smtpd_reject_unlisted_recipient=no
|
||||
-o smtpd_client_restrictions=$mua_client_restrictions
|
||||
-o smtpd_helo_restrictions=$mua_helo_restrictions
|
||||
-o smtpd_sender_restrictions=$mua_sender_restrictions
|
||||
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
|
||||
-o milter_macro_daemon_name=ORIGINATING
|
||||
smtps inet n - n - - smtpd
|
||||
-o syslog_name=postfix/smtps
|
||||
-o smtpd_tls_wrappermode=yes
|
||||
-o smtpd_sasl_auth_enable=yes
|
||||
-o smtpd_reject_unlisted_recipient=no
|
||||
-o smtpd_client_restrictions=$mua_client_restrictions
|
||||
-o smtpd_helo_restrictions=$mua_helo_restrictions
|
||||
-o smtpd_sender_restrictions=$mua_sender_restrictions
|
||||
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
|
||||
-o milter_macro_daemon_name=ORIGINATING
|
||||
#628 inet n - n - - qmqpd
|
||||
pickup unix n - n 60 1 pickup
|
||||
cleanup unix n - n - 0 cleanup
|
||||
qmgr unix n - n 300 1 qmgr
|
||||
#qmgr unix n - n 300 1 oqmgr
|
||||
tlsmgr unix - - n 1000? 1 tlsmgr
|
||||
rewrite unix - - n - - trivial-rewrite
|
||||
bounce unix - - n - 0 bounce
|
||||
defer unix - - n - 0 bounce
|
||||
trace unix - - n - 0 bounce
|
||||
verify unix - - n - 1 verify
|
||||
flush unix n - n 1000? 0 flush
|
||||
proxymap unix - - n - - proxymap
|
||||
proxywrite unix - - n - 1 proxymap
|
||||
smtp unix - - n - - smtp
|
||||
relay unix - - n - - smtp
|
||||
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
|
||||
showq unix n - n - - showq
|
||||
error unix - - n - - error
|
||||
retry unix - - n - - error
|
||||
discard unix - - n - - discard
|
||||
local unix - n n - - local
|
||||
virtual unix - n n - - virtual
|
||||
lmtp unix - - n - - lmtp
|
||||
anvil unix - - n - 1 anvil
|
||||
scache unix - - n - 1 scache
|
||||
#
|
||||
# ====================================================================
|
||||
# Interfaces to non-Postfix software. Be sure to examine the manual
|
||||
# pages of the non-Postfix software to find out what options it wants.
|
||||
#
|
||||
# Many of the following services use the Postfix pipe(8) delivery
|
||||
# agent. See the pipe(8) man page for information about ${recipient}
|
||||
# and other message envelope options.
|
||||
# ====================================================================
|
||||
#
|
||||
# maildrop. See the Postfix MAILDROP_README file for details.
|
||||
# Also specify in main.cf: maildrop_destination_recipient_limit=1
|
||||
#
|
||||
#maildrop unix - n n - - pipe
|
||||
# flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
|
||||
#
|
||||
# ====================================================================
|
||||
#
|
||||
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
|
||||
#
|
||||
# Specify in cyrus.conf:
|
||||
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
|
||||
#
|
||||
# Specify in main.cf one or more of the following:
|
||||
# mailbox_transport = lmtp:inet:localhost
|
||||
# virtual_transport = lmtp:inet:localhost
|
||||
#
|
||||
# ====================================================================
|
||||
#
|
||||
# Cyrus 2.1.5 (Amos Gouaux)
|
||||
# Also specify in main.cf: cyrus_destination_recipient_limit=1
|
||||
#
|
||||
#cyrus unix - n n - - pipe
|
||||
# user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -r ${sender} -m ${extension} ${user}
|
||||
#
|
||||
# ====================================================================
|
||||
#
|
||||
# Old example of delivery via Cyrus.
|
||||
#
|
||||
#old-cyrus unix - n n - - pipe
|
||||
# flags=R user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -m ${extension} ${user}
|
||||
#
|
||||
# ====================================================================
|
||||
#
|
||||
# See the Postfix UUCP_README file for configuration details.
|
||||
#
|
||||
#uucp unix - n n - - pipe
|
||||
# flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
|
||||
#
|
||||
# ====================================================================
|
||||
#
|
||||
# Other external delivery methods.
|
||||
#
|
||||
#ifmail unix - n n - - pipe
|
||||
# flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
|
||||
#
|
||||
#bsmtp unix - n n - - pipe
|
||||
# flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
|
||||
#
|
||||
#scalemail-backend unix - n n - 2 pipe
|
||||
# flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
|
||||
# ${nexthop} ${user} ${extension}
|
||||
#
|
||||
#mailman unix - n n - - pipe
|
||||
# flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
|
||||
# ${nexthop} ${user}
|
||||
dovecot unix - n n - - pipe
|
||||
flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}
|
||||
@@ -1,5 +0,0 @@
|
||||
user = cyberpanel
|
||||
password = 1qaz@9xvps
|
||||
dbname = cyberpanel
|
||||
query = SELECT domain AS virtual FROM e_domains WHERE domain='%s'
|
||||
hosts = 127.0.0.1:3307
|
||||
@@ -1,5 +0,0 @@
|
||||
user = cyberpanel
|
||||
password = 1qaz@9xvps
|
||||
dbname = cyberpanel
|
||||
query = SELECT email FROM e_users WHERE email='%s'
|
||||
hosts = 127.0.0.1:3307
|
||||
@@ -1,5 +0,0 @@
|
||||
user = cyberpanel
|
||||
password = 1qaz@9xvps
|
||||
dbname = cyberpanel
|
||||
query = SELECT destination FROM e_forwardings WHERE source='%s'
|
||||
hosts = 127.0.0.1:3307
|
||||
@@ -1,5 +0,0 @@
|
||||
user = cyberpanel
|
||||
password = 1qaz@9xvps
|
||||
dbname = cyberpanel
|
||||
query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') FROM e_users WHERE email='%s'
|
||||
hosts = 127.0.0.1:3307
|
||||
@@ -1,171 +0,0 @@
|
||||
# RELOCATED(5) RELOCATED(5)
|
||||
#
|
||||
# NAME
|
||||
# relocated - Postfix relocated table format
|
||||
#
|
||||
# SYNOPSIS
|
||||
# postmap /etc/postfix/relocated
|
||||
#
|
||||
# DESCRIPTION
|
||||
# The optional relocated(5) table provides the information
|
||||
# that is used in "user has moved to new_location" bounce
|
||||
# messages.
|
||||
#
|
||||
# Normally, the relocated(5) table is specified as a text
|
||||
# file that serves as input to the postmap(1) command. The
|
||||
# result, an indexed file in dbm or db format, is used for
|
||||
# fast searching by the mail system. Execute the command
|
||||
# "postmap /etc/postfix/relocated" to rebuild an indexed
|
||||
# file after changing the corresponding relocated table.
|
||||
#
|
||||
# When the table is provided via other means such as NIS,
|
||||
# LDAP or SQL, the same lookups are done as for ordinary
|
||||
# indexed files.
|
||||
#
|
||||
# Alternatively, the table can be provided as a regular-
|
||||
# expression map where patterns are given as regular expres-
|
||||
# sions, or lookups can be directed to TCP-based server. In
|
||||
# those case, the lookups are done in a slightly different
|
||||
# way as described below under "REGULAR EXPRESSION TABLES"
|
||||
# or "TCP-BASED TABLES".
|
||||
#
|
||||
# Table lookups are case insensitive.
|
||||
#
|
||||
# CASE FOLDING
|
||||
# The search string is folded to lowercase before database
|
||||
# lookup. As of Postfix 2.3, the search string is not case
|
||||
# folded with database types such as regexp: or pcre: whose
|
||||
# lookup fields can match both upper and lower case.
|
||||
#
|
||||
# TABLE FORMAT
|
||||
# The input format for the postmap(1) command is as follows:
|
||||
#
|
||||
# o An entry has one of the following form:
|
||||
#
|
||||
# pattern new_location
|
||||
#
|
||||
# Where new_location specifies contact information
|
||||
# such as an email address, or perhaps a street
|
||||
# address or telephone number.
|
||||
#
|
||||
# o Empty lines and whitespace-only lines are ignored,
|
||||
# as are lines whose first non-whitespace character
|
||||
# is a `#'.
|
||||
#
|
||||
# o A logical line starts with non-whitespace text. A
|
||||
# line that starts with whitespace continues a logi-
|
||||
# cal line.
|
||||
#
|
||||
# TABLE SEARCH ORDER
|
||||
# With lookups from indexed files such as DB or DBM, or from
|
||||
# networked tables such as NIS, LDAP or SQL, patterns are
|
||||
# tried in the order as listed below:
|
||||
#
|
||||
# user@domain
|
||||
# Matches user@domain. This form has precedence over
|
||||
# all other forms.
|
||||
#
|
||||
# user Matches user@site when site is $myorigin, when site
|
||||
# is listed in $mydestination, or when site is listed
|
||||
# in $inet_interfaces or $proxy_interfaces.
|
||||
#
|
||||
# @domain
|
||||
# Matches other addresses in domain. This form has
|
||||
# the lowest precedence.
|
||||
#
|
||||
# ADDRESS EXTENSION
|
||||
# When a mail address localpart contains the optional recip-
|
||||
# ient delimiter (e.g., user+foo@domain), the lookup order
|
||||
# becomes: user+foo@domain, user@domain, user+foo, user, and
|
||||
# @domain.
|
||||
#
|
||||
# REGULAR EXPRESSION TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# the table is given in the form of regular expressions or
|
||||
# when lookups are directed to a TCP-based server. For a
|
||||
# description of regular expression lookup table syntax, see
|
||||
# regexp_table(5) or pcre_table(5). For a description of the
|
||||
# TCP client/server table lookup protocol, see tcp_table(5).
|
||||
# This feature is not available up to and including Postfix
|
||||
# version 2.4.
|
||||
#
|
||||
# Each pattern is a regular expression that is applied to
|
||||
# the entire address being looked up. Thus, user@domain mail
|
||||
# addresses are not broken up into their user and @domain
|
||||
# constituent parts, nor is user+foo broken up into user and
|
||||
# foo.
|
||||
#
|
||||
# Patterns are applied in the order as specified in the ta-
|
||||
# ble, until a pattern is found that matches the search
|
||||
# string.
|
||||
#
|
||||
# Results are the same as with indexed file lookups, with
|
||||
# the additional feature that parenthesized substrings from
|
||||
# the pattern can be interpolated as $1, $2 and so on.
|
||||
#
|
||||
# TCP-BASED TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# lookups are directed to a TCP-based server. For a descrip-
|
||||
# tion of the TCP client/server lookup protocol, see tcp_ta-
|
||||
# ble(5). This feature is not available up to and including
|
||||
# Postfix version 2.4.
|
||||
#
|
||||
# Each lookup operation uses the entire address once. Thus,
|
||||
# user@domain mail addresses are not broken up into their
|
||||
# user and @domain constituent parts, nor is user+foo broken
|
||||
# up into user and foo.
|
||||
#
|
||||
# Results are the same as with indexed file lookups.
|
||||
#
|
||||
# BUGS
|
||||
# The table format does not understand quoting conventions.
|
||||
#
|
||||
# CONFIGURATION PARAMETERS
|
||||
# The following main.cf parameters are especially relevant.
|
||||
# The text below provides only a parameter summary. See
|
||||
# postconf(5) for more details including examples.
|
||||
#
|
||||
# relocated_maps
|
||||
# List of lookup tables for relocated users or sites.
|
||||
#
|
||||
# Other parameters of interest:
|
||||
#
|
||||
# inet_interfaces
|
||||
# The network interface addresses that this system
|
||||
# receives mail on. You need to stop and start Post-
|
||||
# fix when this parameter changes.
|
||||
#
|
||||
# mydestination
|
||||
# List of domains that this mail system considers
|
||||
# local.
|
||||
#
|
||||
# myorigin
|
||||
# The domain that is appended to locally-posted mail.
|
||||
#
|
||||
# proxy_interfaces
|
||||
# Other interfaces that this machine receives mail on
|
||||
# by way of a proxy agent or network address transla-
|
||||
# tor.
|
||||
#
|
||||
# SEE ALSO
|
||||
# trivial-rewrite(8), address resolver
|
||||
# postmap(1), Postfix lookup table manager
|
||||
# postconf(5), configuration parameters
|
||||
#
|
||||
# README FILES
|
||||
# Use "postconf readme_directory" or "postconf html_direc-
|
||||
# tory" to locate this information.
|
||||
# DATABASE_README, Postfix lookup table overview
|
||||
# ADDRESS_REWRITING_README, address rewriting guide
|
||||
#
|
||||
# LICENSE
|
||||
# The Secure Mailer license must be distributed with this
|
||||
# software.
|
||||
#
|
||||
# AUTHOR(S)
|
||||
# Wietse Venema
|
||||
# IBM T.J. Watson Research
|
||||
# P.O. Box 704
|
||||
# Yorktown Heights, NY 10598, USA
|
||||
#
|
||||
# RELOCATED(5)
|
||||
@@ -1,294 +0,0 @@
|
||||
# TRANSPORT(5) TRANSPORT(5)
|
||||
#
|
||||
# NAME
|
||||
# transport - Postfix transport table format
|
||||
#
|
||||
# SYNOPSIS
|
||||
# postmap /etc/postfix/transport
|
||||
#
|
||||
# postmap -q "string" /etc/postfix/transport
|
||||
#
|
||||
# postmap -q - /etc/postfix/transport <inputfile
|
||||
#
|
||||
# DESCRIPTION
|
||||
# The optional transport(5) table specifies a mapping from
|
||||
# email addresses to message delivery transports and next-
|
||||
# hop destinations. Message delivery transports such as
|
||||
# local or smtp are defined in the master.cf file, and next-
|
||||
# hop destinations are typically hosts or domain names. The
|
||||
# table is searched by the trivial-rewrite(8) daemon.
|
||||
#
|
||||
# This mapping overrides the default transport:nexthop
|
||||
# selection that is built into Postfix:
|
||||
#
|
||||
# local_transport (default: local:$myhostname)
|
||||
# This is the default for final delivery to domains
|
||||
# listed with mydestination, and for [ipaddress] des-
|
||||
# tinations that match $inet_interfaces or
|
||||
# $proxy_interfaces. The default nexthop destination
|
||||
# is the MTA hostname.
|
||||
#
|
||||
# virtual_transport (default: virtual:)
|
||||
# This is the default for final delivery to domains
|
||||
# listed with virtual_mailbox_domains. The default
|
||||
# nexthop destination is the recipient domain.
|
||||
#
|
||||
# relay_transport (default: relay:)
|
||||
# This is the default for remote delivery to domains
|
||||
# listed with relay_domains. In order of decreasing
|
||||
# precedence, the nexthop destination is taken from
|
||||
# relay_transport, sender_dependent_relayhost_maps,
|
||||
# relayhost, or from the recipient domain.
|
||||
#
|
||||
# default_transport (default: smtp:)
|
||||
# This is the default for remote delivery to other
|
||||
# destinations. In order of decreasing precedence,
|
||||
# the nexthop destination is taken from sender_depen-
|
||||
# dent_default_transport_maps, default_transport,
|
||||
# sender_dependent_relayhost_maps, relayhost, or from
|
||||
# the recipient domain.
|
||||
#
|
||||
# Normally, the transport(5) table is specified as a text
|
||||
# file that serves as input to the postmap(1) command. The
|
||||
# result, an indexed file in dbm or db format, is used for
|
||||
# fast searching by the mail system. Execute the command
|
||||
# "postmap /etc/postfix/transport" to rebuild an indexed
|
||||
# file after changing the corresponding transport table.
|
||||
#
|
||||
# When the table is provided via other means such as NIS,
|
||||
# LDAP or SQL, the same lookups are done as for ordinary
|
||||
# indexed files.
|
||||
#
|
||||
# Alternatively, the table can be provided as a regular-
|
||||
# expression map where patterns are given as regular expres-
|
||||
# sions, or lookups can be directed to TCP-based server. In
|
||||
# those case, the lookups are done in a slightly different
|
||||
# way as described below under "REGULAR EXPRESSION TABLES"
|
||||
# or "TCP-BASED TABLES".
|
||||
#
|
||||
# CASE FOLDING
|
||||
# The search string is folded to lowercase before database
|
||||
# lookup. As of Postfix 2.3, the search string is not case
|
||||
# folded with database types such as regexp: or pcre: whose
|
||||
# lookup fields can match both upper and lower case.
|
||||
#
|
||||
# TABLE FORMAT
|
||||
# The input format for the postmap(1) command is as follows:
|
||||
#
|
||||
# pattern result
|
||||
# When pattern matches the recipient address or
|
||||
# domain, use the corresponding result.
|
||||
#
|
||||
# blank lines and comments
|
||||
# Empty lines and whitespace-only lines are ignored,
|
||||
# as are lines whose first non-whitespace character
|
||||
# is a `#'.
|
||||
#
|
||||
# multi-line text
|
||||
# A logical line starts with non-whitespace text. A
|
||||
# line that starts with whitespace continues a logi-
|
||||
# cal line.
|
||||
#
|
||||
# The pattern specifies an email address, a domain name, or
|
||||
# a domain name hierarchy, as described in section "TABLE
|
||||
# LOOKUP".
|
||||
#
|
||||
# The result is of the form transport:nexthop and specifies
|
||||
# how or where to deliver mail. This is described in section
|
||||
# "RESULT FORMAT".
|
||||
#
|
||||
# TABLE SEARCH ORDER
|
||||
# With lookups from indexed files such as DB or DBM, or from
|
||||
# networked tables such as NIS, LDAP or SQL, patterns are
|
||||
# tried in the order as listed below:
|
||||
#
|
||||
# user+extension@domain transport:nexthop
|
||||
# Deliver mail for user+extension@domain through
|
||||
# transport to nexthop.
|
||||
#
|
||||
# user@domain transport:nexthop
|
||||
# Deliver mail for user@domain through transport to
|
||||
# nexthop.
|
||||
#
|
||||
# domain transport:nexthop
|
||||
# Deliver mail for domain through transport to nex-
|
||||
# thop.
|
||||
#
|
||||
# .domain transport:nexthop
|
||||
# Deliver mail for any subdomain of domain through
|
||||
# transport to nexthop. This applies only when the
|
||||
# string transport_maps is not listed in the par-
|
||||
# ent_domain_matches_subdomains configuration set-
|
||||
# ting. Otherwise, a domain name matches itself and
|
||||
# its subdomains.
|
||||
#
|
||||
# * transport:nexthop
|
||||
# The special pattern * represents any address (i.e.
|
||||
# it functions as the wild-card pattern, and is
|
||||
# unique to Postfix transport tables).
|
||||
#
|
||||
# Note 1: the null recipient address is looked up as
|
||||
# $empty_address_recipient@$myhostname (default: mailer-dae-
|
||||
# mon@hostname).
|
||||
#
|
||||
# Note 2: user@domain or user+extension@domain lookup is
|
||||
# available in Postfix 2.0 and later.
|
||||
#
|
||||
# RESULT FORMAT
|
||||
# The lookup result is of the form transport:nexthop. The
|
||||
# transport field specifies a mail delivery transport such
|
||||
# as smtp or local. The nexthop field specifies where and
|
||||
# how to deliver mail.
|
||||
#
|
||||
# The transport field specifies the name of a mail delivery
|
||||
# transport (the first name of a mail delivery service entry
|
||||
# in the Postfix master.cf file).
|
||||
#
|
||||
# The interpretation of the nexthop field is transport
|
||||
# dependent. In the case of SMTP, specify a service on a
|
||||
# non-default port as host:service, and disable MX (mail
|
||||
# exchanger) DNS lookups with [host] or [host]:port. The []
|
||||
# form is required when you specify an IP address instead of
|
||||
# a hostname.
|
||||
#
|
||||
# A null transport and null nexthop result means "do not
|
||||
# change": use the delivery transport and nexthop informa-
|
||||
# tion that would be used when the entire transport table
|
||||
# did not exist.
|
||||
#
|
||||
# A non-null transport field with a null nexthop field
|
||||
# resets the nexthop information to the recipient domain.
|
||||
#
|
||||
# A null transport field with non-null nexthop field does
|
||||
# not modify the transport information.
|
||||
#
|
||||
# EXAMPLES
|
||||
# In order to deliver internal mail directly, while using a
|
||||
# mail relay for all other mail, specify a null entry for
|
||||
# internal destinations (do not change the delivery trans-
|
||||
# port or the nexthop information) and specify a wildcard
|
||||
# for all other destinations.
|
||||
#
|
||||
# my.domain :
|
||||
# .my.domain :
|
||||
# * smtp:outbound-relay.my.domain
|
||||
#
|
||||
# In order to send mail for example.com and its subdomains
|
||||
# via the uucp transport to the UUCP host named example:
|
||||
#
|
||||
# example.com uucp:example
|
||||
# .example.com uucp:example
|
||||
#
|
||||
# When no nexthop host name is specified, the destination
|
||||
# domain name is used instead. For example, the following
|
||||
# directs mail for user@example.com via the slow transport
|
||||
# to a mail exchanger for example.com. The slow transport
|
||||
# could be configured to run at most one delivery process at
|
||||
# a time:
|
||||
#
|
||||
# example.com slow:
|
||||
#
|
||||
# When no transport is specified, Postfix uses the transport
|
||||
# that matches the address domain class (see DESCRIPTION
|
||||
# above). The following sends all mail for example.com and
|
||||
# its subdomains to host gateway.example.com:
|
||||
#
|
||||
# example.com :[gateway.example.com]
|
||||
# .example.com :[gateway.example.com]
|
||||
#
|
||||
# In the above example, the [] suppress MX lookups. This
|
||||
# prevents mail routing loops when your machine is primary
|
||||
# MX host for example.com.
|
||||
#
|
||||
# In the case of delivery via SMTP, one may specify host-
|
||||
# name:service instead of just a host:
|
||||
#
|
||||
# example.com smtp:bar.example:2025
|
||||
#
|
||||
# This directs mail for user@example.com to host bar.example
|
||||
# port 2025. Instead of a numerical port a symbolic name may
|
||||
# be used. Specify [] around the hostname if MX lookups must
|
||||
# be disabled.
|
||||
#
|
||||
# The error mailer can be used to bounce mail:
|
||||
#
|
||||
# .example.com error:mail for *.example.com is not deliverable
|
||||
#
|
||||
# This causes all mail for user@anything.example.com to be
|
||||
# bounced.
|
||||
#
|
||||
# REGULAR EXPRESSION TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# the table is given in the form of regular expressions. For
|
||||
# a description of regular expression lookup table syntax,
|
||||
# see regexp_table(5) or pcre_table(5).
|
||||
#
|
||||
# Each pattern is a regular expression that is applied to
|
||||
# the entire address being looked up. Thus,
|
||||
# some.domain.hierarchy is not looked up via its parent
|
||||
# domains, nor is user+foo@domain looked up as user@domain.
|
||||
#
|
||||
# Patterns are applied in the order as specified in the ta-
|
||||
# ble, until a pattern is found that matches the search
|
||||
# string.
|
||||
#
|
||||
# The trivial-rewrite(8) server disallows regular expression
|
||||
# substitution of $1 etc. in regular expression lookup
|
||||
# tables, because that could open a security hole (Postfix
|
||||
# version 2.3 and later).
|
||||
#
|
||||
# TCP-BASED TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# lookups are directed to a TCP-based server. For a descrip-
|
||||
# tion of the TCP client/server lookup protocol, see tcp_ta-
|
||||
# ble(5). This feature is not available up to and including
|
||||
# Postfix version 2.4.
|
||||
#
|
||||
# Each lookup operation uses the entire recipient address
|
||||
# once. Thus, some.domain.hierarchy is not looked up via
|
||||
# its parent domains, nor is user+foo@domain looked up as
|
||||
# user@domain.
|
||||
#
|
||||
# Results are the same as with indexed file lookups.
|
||||
#
|
||||
# CONFIGURATION PARAMETERS
|
||||
# The following main.cf parameters are especially relevant.
|
||||
# The text below provides only a parameter summary. See
|
||||
# postconf(5) for more details including examples.
|
||||
#
|
||||
# empty_address_recipient
|
||||
# The address that is looked up instead of the null
|
||||
# sender address.
|
||||
#
|
||||
# parent_domain_matches_subdomains
|
||||
# List of Postfix features that use domain.tld pat-
|
||||
# terns to match sub.domain.tld (as opposed to
|
||||
# requiring .domain.tld patterns).
|
||||
#
|
||||
# transport_maps
|
||||
# List of transport lookup tables.
|
||||
#
|
||||
# SEE ALSO
|
||||
# trivial-rewrite(8), rewrite and resolve addresses
|
||||
# master(5), master.cf file format
|
||||
# postconf(5), configuration parameters
|
||||
# postmap(1), Postfix lookup table manager
|
||||
#
|
||||
# README FILES
|
||||
# Use "postconf readme_directory" or "postconf html_direc-
|
||||
# tory" to locate this information.
|
||||
# ADDRESS_REWRITING_README, address rewriting guide
|
||||
# DATABASE_README, Postfix lookup table overview
|
||||
# FILTER_README, external content filter
|
||||
#
|
||||
# LICENSE
|
||||
# The Secure Mailer license must be distributed with this
|
||||
# software.
|
||||
#
|
||||
# AUTHOR(S)
|
||||
# Wietse Venema
|
||||
# IBM T.J. Watson Research
|
||||
# P.O. Box 704
|
||||
# Yorktown Heights, NY 10598, USA
|
||||
#
|
||||
# TRANSPORT(5)
|
||||
@@ -1,294 +0,0 @@
|
||||
# VIRTUAL(5) VIRTUAL(5)
|
||||
#
|
||||
# NAME
|
||||
# virtual - Postfix virtual alias table format
|
||||
#
|
||||
# SYNOPSIS
|
||||
# postmap /etc/postfix/virtual
|
||||
#
|
||||
# postmap -q "string" /etc/postfix/virtual
|
||||
#
|
||||
# postmap -q - /etc/postfix/virtual <inputfile
|
||||
#
|
||||
# DESCRIPTION
|
||||
# The optional virtual(5) alias table rewrites recipient
|
||||
# addresses for all local, all virtual, and all remote mail
|
||||
# destinations. This is unlike the aliases(5) table which
|
||||
# is used only for local(8) delivery. Virtual aliasing is
|
||||
# recursive, and is implemented by the Postfix cleanup(8)
|
||||
# daemon before mail is queued.
|
||||
#
|
||||
# The main applications of virtual aliasing are:
|
||||
#
|
||||
# o To redirect mail for one address to one or more
|
||||
# addresses.
|
||||
#
|
||||
# o To implement virtual alias domains where all
|
||||
# addresses are aliased to addresses in other
|
||||
# domains.
|
||||
#
|
||||
# Virtual alias domains are not to be confused with
|
||||
# the virtual mailbox domains that are implemented
|
||||
# with the Postfix virtual(8) mail delivery agent.
|
||||
# With virtual mailbox domains, each recipient
|
||||
# address can have its own mailbox.
|
||||
#
|
||||
# Virtual aliasing is applied only to recipient envelope
|
||||
# addresses, and does not affect message headers. Use
|
||||
# canonical(5) mapping to rewrite header and envelope
|
||||
# addresses in general.
|
||||
#
|
||||
# Normally, the virtual(5) alias table is specified as a
|
||||
# text file that serves as input to the postmap(1) command.
|
||||
# The result, an indexed file in dbm or db format, is used
|
||||
# for fast searching by the mail system. Execute the command
|
||||
# "postmap /etc/postfix/virtual" to rebuild an indexed file
|
||||
# after changing the corresponding text file.
|
||||
#
|
||||
# When the table is provided via other means such as NIS,
|
||||
# LDAP or SQL, the same lookups are done as for ordinary
|
||||
# indexed files.
|
||||
#
|
||||
# Alternatively, the table can be provided as a regular-
|
||||
# expression map where patterns are given as regular expres-
|
||||
# sions, or lookups can be directed to TCP-based server. In
|
||||
# those case, the lookups are done in a slightly different
|
||||
# way as described below under "REGULAR EXPRESSION TABLES"
|
||||
# or "TCP-BASED TABLES".
|
||||
#
|
||||
# CASE FOLDING
|
||||
# The search string is folded to lowercase before database
|
||||
# lookup. As of Postfix 2.3, the search string is not case
|
||||
# folded with database types such as regexp: or pcre: whose
|
||||
# lookup fields can match both upper and lower case.
|
||||
#
|
||||
# TABLE FORMAT
|
||||
# The input format for the postmap(1) command is as follows:
|
||||
#
|
||||
# pattern result
|
||||
# When pattern matches a mail address, replace it by
|
||||
# the corresponding result.
|
||||
#
|
||||
# blank lines and comments
|
||||
# Empty lines and whitespace-only lines are ignored,
|
||||
# as are lines whose first non-whitespace character
|
||||
# is a `#'.
|
||||
#
|
||||
# multi-line text
|
||||
# A logical line starts with non-whitespace text. A
|
||||
# line that starts with whitespace continues a logi-
|
||||
# cal line.
|
||||
#
|
||||
# TABLE SEARCH ORDER
|
||||
# With lookups from indexed files such as DB or DBM, or from
|
||||
# networked tables such as NIS, LDAP or SQL, patterns are
|
||||
# tried in the order as listed below:
|
||||
#
|
||||
# user@domain address, address, ...
|
||||
# Redirect mail for user@domain to address. This
|
||||
# form has the highest precedence.
|
||||
#
|
||||
# user address, address, ...
|
||||
# Redirect mail for user@site to address when site is
|
||||
# equal to $myorigin, when site is listed in $mydes-
|
||||
# tination, or when it is listed in $inet_interfaces
|
||||
# or $proxy_interfaces.
|
||||
#
|
||||
# This functionality overlaps with functionality of
|
||||
# the local aliases(5) database. The difference is
|
||||
# that virtual(5) mapping can be applied to non-local
|
||||
# addresses.
|
||||
#
|
||||
# @domain address, address, ...
|
||||
# Redirect mail for other users in domain to address.
|
||||
# This form has the lowest precedence.
|
||||
#
|
||||
# Note: @domain is a wild-card. With this form, the
|
||||
# Postfix SMTP server accepts mail for any recipient
|
||||
# in domain, regardless of whether that recipient
|
||||
# exists. This may turn your mail system into a
|
||||
# backscatter source: Postfix first accepts mail for
|
||||
# non-existent recipients and then tries to return
|
||||
# that mail as "undeliverable" to the often forged
|
||||
# sender address.
|
||||
#
|
||||
# RESULT ADDRESS REWRITING
|
||||
# The lookup result is subject to address rewriting:
|
||||
#
|
||||
# o When the result has the form @otherdomain, the
|
||||
# result becomes the same user in otherdomain. This
|
||||
# works only for the first address in a multi-address
|
||||
# lookup result.
|
||||
#
|
||||
# o When "append_at_myorigin=yes", append "@$myorigin"
|
||||
# to addresses without "@domain".
|
||||
#
|
||||
# o When "append_dot_mydomain=yes", append ".$mydomain"
|
||||
# to addresses without ".domain".
|
||||
#
|
||||
# ADDRESS EXTENSION
|
||||
# When a mail address localpart contains the optional recip-
|
||||
# ient delimiter (e.g., user+foo@domain), the lookup order
|
||||
# becomes: user+foo@domain, user@domain, user+foo, user, and
|
||||
# @domain.
|
||||
#
|
||||
# The propagate_unmatched_extensions parameter controls
|
||||
# whether an unmatched address extension (+foo) is propa-
|
||||
# gated to the result of table lookup.
|
||||
#
|
||||
# VIRTUAL ALIAS DOMAINS
|
||||
# Besides virtual aliases, the virtual alias table can also
|
||||
# be used to implement virtual alias domains. With a virtual
|
||||
# alias domain, all recipient addresses are aliased to
|
||||
# addresses in other domains.
|
||||
#
|
||||
# Virtual alias domains are not to be confused with the vir-
|
||||
# tual mailbox domains that are implemented with the Postfix
|
||||
# virtual(8) mail delivery agent. With virtual mailbox
|
||||
# domains, each recipient address can have its own mailbox.
|
||||
#
|
||||
# With a virtual alias domain, the virtual domain has its
|
||||
# own user name space. Local (i.e. non-virtual) usernames
|
||||
# are not visible in a virtual alias domain. In particular,
|
||||
# local aliases(5) and local mailing lists are not visible
|
||||
# as localname@virtual-alias.domain.
|
||||
#
|
||||
# Support for a virtual alias domain looks like:
|
||||
#
|
||||
# /etc/postfix/main.cf:
|
||||
# virtual_alias_maps = hash:/etc/postfix/virtual
|
||||
#
|
||||
# Note: some systems use dbm databases instead of hash. See
|
||||
# the output from "postconf -m" for available database
|
||||
# types.
|
||||
#
|
||||
# /etc/postfix/virtual:
|
||||
# virtual-alias.domain anything (right-hand content does not matter)
|
||||
# postmaster@virtual-alias.domain postmaster
|
||||
# user1@virtual-alias.domain address1
|
||||
# user2@virtual-alias.domain address2, address3
|
||||
#
|
||||
# The virtual-alias.domain anything entry is required for a
|
||||
# virtual alias domain. Without this entry, mail is rejected
|
||||
# with "relay access denied", or bounces with "mail loops
|
||||
# back to myself".
|
||||
#
|
||||
# Do not specify virtual alias domain names in the main.cf
|
||||
# mydestination or relay_domains configuration parameters.
|
||||
#
|
||||
# With a virtual alias domain, the Postfix SMTP server
|
||||
# accepts mail for known-user@virtual-alias.domain, and
|
||||
# rejects mail for unknown-user@virtual-alias.domain as
|
||||
# undeliverable.
|
||||
#
|
||||
# Instead of specifying the virtual alias domain name via
|
||||
# the virtual_alias_maps table, you may also specify it via
|
||||
# the main.cf virtual_alias_domains configuration parameter.
|
||||
# This latter parameter uses the same syntax as the main.cf
|
||||
# mydestination configuration parameter.
|
||||
#
|
||||
# REGULAR EXPRESSION TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# the table is given in the form of regular expressions. For
|
||||
# a description of regular expression lookup table syntax,
|
||||
# see regexp_table(5) or pcre_table(5).
|
||||
#
|
||||
# Each pattern is a regular expression that is applied to
|
||||
# the entire address being looked up. Thus, user@domain mail
|
||||
# addresses are not broken up into their user and @domain
|
||||
# constituent parts, nor is user+foo broken up into user and
|
||||
# foo.
|
||||
#
|
||||
# Patterns are applied in the order as specified in the ta-
|
||||
# ble, until a pattern is found that matches the search
|
||||
# string.
|
||||
#
|
||||
# Results are the same as with indexed file lookups, with
|
||||
# the additional feature that parenthesized substrings from
|
||||
# the pattern can be interpolated as $1, $2 and so on.
|
||||
#
|
||||
# TCP-BASED TABLES
|
||||
# This section describes how the table lookups change when
|
||||
# lookups are directed to a TCP-based server. For a descrip-
|
||||
# tion of the TCP client/server lookup protocol, see tcp_ta-
|
||||
# ble(5). This feature is not available up to and including
|
||||
# Postfix version 2.4.
|
||||
#
|
||||
# Each lookup operation uses the entire address once. Thus,
|
||||
# user@domain mail addresses are not broken up into their
|
||||
# user and @domain constituent parts, nor is user+foo broken
|
||||
# up into user and foo.
|
||||
#
|
||||
# Results are the same as with indexed file lookups.
|
||||
#
|
||||
# BUGS
|
||||
# The table format does not understand quoting conventions.
|
||||
#
|
||||
# CONFIGURATION PARAMETERS
|
||||
# The following main.cf parameters are especially relevant
|
||||
# to this topic. See the Postfix main.cf file for syntax
|
||||
# details and for default values. Use the "postfix reload"
|
||||
# command after a configuration change.
|
||||
#
|
||||
# virtual_alias_maps
|
||||
# List of virtual aliasing tables.
|
||||
#
|
||||
# virtual_alias_domains
|
||||
# List of virtual alias domains. This uses the same
|
||||
# syntax as the mydestination parameter.
|
||||
#
|
||||
# propagate_unmatched_extensions
|
||||
# A list of address rewriting or forwarding mecha-
|
||||
# nisms that propagate an address extension from the
|
||||
# original address to the result. Specify zero or
|
||||
# more of canonical, virtual, alias, forward,
|
||||
# include, or generic.
|
||||
#
|
||||
# Other parameters of interest:
|
||||
#
|
||||
# inet_interfaces
|
||||
# The network interface addresses that this system
|
||||
# receives mail on. You need to stop and start Post-
|
||||
# fix when this parameter changes.
|
||||
#
|
||||
# mydestination
|
||||
# List of domains that this mail system considers
|
||||
# local.
|
||||
#
|
||||
# myorigin
|
||||
# The domain that is appended to any address that
|
||||
# does not have a domain.
|
||||
#
|
||||
# owner_request_special
|
||||
# Give special treatment to owner-xxx and xxx-request
|
||||
# addresses.
|
||||
#
|
||||
# proxy_interfaces
|
||||
# Other interfaces that this machine receives mail on
|
||||
# by way of a proxy agent or network address transla-
|
||||
# tor.
|
||||
#
|
||||
# SEE ALSO
|
||||
# cleanup(8), canonicalize and enqueue mail
|
||||
# postmap(1), Postfix lookup table manager
|
||||
# postconf(5), configuration parameters
|
||||
# canonical(5), canonical address mapping
|
||||
#
|
||||
# README FILES
|
||||
# Use "postconf readme_directory" or "postconf html_direc-
|
||||
# tory" to locate this information.
|
||||
# ADDRESS_REWRITING_README, address rewriting guide
|
||||
# DATABASE_README, Postfix lookup table overview
|
||||
# VIRTUAL_README, domain hosting guide
|
||||
#
|
||||
# LICENSE
|
||||
# The Secure Mailer license must be distributed with this
|
||||
# software.
|
||||
#
|
||||
# AUTHOR(S)
|
||||
# Wietse Venema
|
||||
# IBM T.J. Watson Research
|
||||
# P.O. Box 704
|
||||
# Yorktown Heights, NY 10598, USA
|
||||
#
|
||||
# VIRTUAL(5)
|
||||
@@ -1,84 +0,0 @@
|
||||
import sys
|
||||
import subprocess
|
||||
import shutil
|
||||
import installLog as logging
|
||||
import argparse
|
||||
import os
|
||||
import shlex
|
||||
import socket
|
||||
|
||||
|
||||
|
||||
class FirewallUtilities:
|
||||
|
||||
@staticmethod
|
||||
def addRule(proto,port):
|
||||
try:
|
||||
if port == "21":
|
||||
command = "sudo firewall-cmd --add-service=ftp --permanent"
|
||||
cmd = shlex.split(command)
|
||||
res = subprocess.call(cmd)
|
||||
|
||||
ipAddress = "0.0.0.0/0"
|
||||
|
||||
ruleFamily = 'rule family="ipv4"'
|
||||
sourceAddress = 'source address="' + ipAddress + '"'
|
||||
ruleProtocol = 'port protocol="' + proto + '"'
|
||||
rulePort = 'port="' + port + '"'
|
||||
|
||||
command = "sudo firewall-cmd --permanent --zone=public --add-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
|
||||
|
||||
cmd = shlex.split(command)
|
||||
|
||||
res = subprocess.call(cmd)
|
||||
|
||||
command = 'sudo firewall-cmd --reload'
|
||||
|
||||
cmd = shlex.split(command)
|
||||
|
||||
res = subprocess.call(cmd)
|
||||
|
||||
except OSError, msg:
|
||||
logging.InstallLog.writeToFile(str(msg) + " [addRule]")
|
||||
return 0
|
||||
except ValueError, msg:
|
||||
logging.InstallLog.writeToFile(str(msg) + " [addRule]")
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
@staticmethod
|
||||
def deleteRule(proto, port):
|
||||
try:
|
||||
if port=="21":
|
||||
command = "sudo firewall-cmd --remove-service=ftp --permanent"
|
||||
cmd = shlex.split(command)
|
||||
res = subprocess.call(cmd)
|
||||
|
||||
ipAddress = "0.0.0.0/0"
|
||||
|
||||
ruleFamily = 'rule family="ipv4"'
|
||||
sourceAddress = 'source address="' + ipAddress + '"'
|
||||
ruleProtocol = 'port protocol="' + proto + '"'
|
||||
rulePort = 'port="' + port + '"'
|
||||
|
||||
command = "sudo firewall-cmd --permanent --zone=public --remove-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
|
||||
|
||||
cmd = shlex.split(command)
|
||||
|
||||
res = subprocess.call(cmd)
|
||||
|
||||
command = 'sudo firewall-cmd --reload'
|
||||
|
||||
cmd = shlex.split(command)
|
||||
|
||||
res = subprocess.call(cmd)
|
||||
|
||||
except OSError, msg:
|
||||
logging.InstallLog.writeToFile(str(msg) + " [deleteRule]")
|
||||
return 0
|
||||
except ValueError, msg:
|
||||
logging.InstallLog.writeToFile(str(msg) + " [deleteRule]")
|
||||
return 0
|
||||
|
||||
return 1
|
||||
@@ -1 +0,0 @@
|
||||
d /run/gunicorn 0755 root root -
|
||||
@@ -1,19 +0,0 @@
|
||||
[Unit]
|
||||
Description=gunicorn daemon
|
||||
Requires=gunicorn.socket
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
PIDFile=/run/gunicorn/pid
|
||||
User=cyberpanel
|
||||
Group=cyberpanel
|
||||
RuntimeDirectory=gunicorn
|
||||
WorkingDirectory=/usr/local/CyberCP
|
||||
ExecStart=/usr/bin/gunicorn --pid /run/gunicorn/gucpid \
|
||||
--bind 127.0.0.1:5003 CyberCP.wsgi
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
ExecStop=/bin/kill -s TERM $MAINPID
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,8 +0,0 @@
|
||||
[Unit]
|
||||
Description=gunicorn socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=127.0.0.1:5003
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
import time
|
||||
|
||||
class InstallLog:
|
||||
fileName = "/var/log/installLogs.txt"
|
||||
|
||||
@staticmethod
|
||||
def writeToFile(message):
|
||||
file = open(InstallLog.fileName,'a')
|
||||
file.writelines("[" + time.strftime(
|
||||
"%I-%M-%S-%a-%b-%Y") + "] "+message + "\n")
|
||||
file.close()
|
||||
Binary file not shown.
@@ -1,202 +0,0 @@
|
||||
#
|
||||
# PLAIN TEXT CONFIGURATION FILE
|
||||
#
|
||||
serverName lscp
|
||||
user nobody
|
||||
group nobody
|
||||
priority 0
|
||||
inMemBufSize 60M
|
||||
swappingDir /tmp/lshttpd/swap
|
||||
autoFix503 1
|
||||
gracefulRestartTimeout 300
|
||||
mime $SERVER_ROOT/conf/mime.properties
|
||||
showVersionNumber 0
|
||||
adminEmails root@localhost
|
||||
adminRoot $SERVER_ROOT/admin/
|
||||
|
||||
errorlog $SERVER_ROOT/logs/error.log {
|
||||
logLevel DEBUG
|
||||
debugLevel 0
|
||||
rollingSize 10M
|
||||
enableStderrLog 1
|
||||
}
|
||||
|
||||
accesslog $SERVER_ROOT/logs/access.log {
|
||||
rollingSize 10M
|
||||
keepDays 30
|
||||
compressArchive 0
|
||||
}
|
||||
indexFiles index.html, index.php
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
expiresByType image/*=A604800, text/css=A604800, application/x-javascript=A604800
|
||||
}
|
||||
|
||||
tuning {
|
||||
eventDispatcher best
|
||||
maxConnections 2000
|
||||
maxSSLConnections 1000
|
||||
connTimeout 300
|
||||
maxKeepAliveReq 1000
|
||||
smartKeepAlive 0
|
||||
keepAliveTimeout 5
|
||||
sndBufSize 0
|
||||
rcvBufSize 0
|
||||
maxReqURLLen 8192
|
||||
maxReqHeaderSize 16380
|
||||
maxReqBodySize 2047M
|
||||
maxDynRespHeaderSize 8192
|
||||
maxDynRespSize 2047M
|
||||
maxCachedFileSize 4096
|
||||
totalInMemCacheSize 20M
|
||||
maxMMapFileSize 256K
|
||||
totalMMapCacheSize 40M
|
||||
useSendfile 1
|
||||
fileETag 28
|
||||
enableGzipCompress 1
|
||||
enableDynGzipCompress 1
|
||||
gzipCompressLevel 6
|
||||
compressibleTypes text/*,application/x-javascript,application/javascript,application/xml, image/svg+xml
|
||||
gzipAutoUpdateStatic 1
|
||||
gzipStaticCompressLevel 6
|
||||
gzipMaxFileSize 1M
|
||||
gzipMinFileSize 300
|
||||
SSLCryptoDevice null
|
||||
}
|
||||
|
||||
fileAccessControl {
|
||||
followSymbolLink 1
|
||||
checkSymbolLink 0
|
||||
requiredPermissionMask 000
|
||||
restrictedPermissionMask 000
|
||||
}
|
||||
|
||||
perClientConnLimit {
|
||||
staticReqPerSec 0
|
||||
dynReqPerSec 0
|
||||
outBandwidth 0
|
||||
inBandwidth 0
|
||||
softLimit 10000
|
||||
hardLimit 10000
|
||||
gracePeriod 15
|
||||
banPeriod 300
|
||||
}
|
||||
|
||||
CGIRLimit {
|
||||
maxCGIInstances 20
|
||||
minUID 11
|
||||
minGID 10
|
||||
priority 0
|
||||
CPUSoftLimit 10
|
||||
CPUHardLimit 50
|
||||
memSoftLimit 460M
|
||||
memHardLimit 470M
|
||||
procSoftLimit 400
|
||||
procHardLimit 450
|
||||
}
|
||||
|
||||
accessDenyDir {
|
||||
dir /
|
||||
dir /etc/*
|
||||
dir /dev/*
|
||||
dir $SERVER_ROOT/conf/*
|
||||
dir $SERVER_ROOT/admin/conf/*
|
||||
}
|
||||
|
||||
accessControl {
|
||||
allow ALL
|
||||
}
|
||||
|
||||
scripthandler {
|
||||
add lsapi:php70 php
|
||||
}
|
||||
|
||||
railsDefaults {
|
||||
maxConns 5
|
||||
env LSAPI_MAX_REQS=1000
|
||||
env LSAPI_MAX_IDLE=60
|
||||
initTimeout 60
|
||||
retryTimeout 0
|
||||
pcKeepAliveTimeout 60
|
||||
respBuffer 0
|
||||
backlog 50
|
||||
runOnStartUp 1
|
||||
extMaxIdleTime 300
|
||||
priority 3
|
||||
memSoftLimit 2047M
|
||||
memHardLimit 2047M
|
||||
procSoftLimit 500
|
||||
procHardLimit 600
|
||||
}
|
||||
|
||||
|
||||
module cache {
|
||||
param <<<END_param
|
||||
enableCache 0
|
||||
enablePrivateCache 0
|
||||
checkPublicCache 1
|
||||
checkPrivateCache 1
|
||||
qsCache 1
|
||||
reqCookieCache 1
|
||||
ignoreReqCacheCtrl 1
|
||||
ignoreRespCacheCtrl 0
|
||||
respCookieCache 1
|
||||
expireInSeconds 3600
|
||||
privateExpireInSeconds 3600
|
||||
maxStaleAge 200
|
||||
maxCacheObjSize 10000000
|
||||
storagepath cachedata
|
||||
noCacheDomain
|
||||
noCacheUrl
|
||||
no-vary 0
|
||||
addEtag 0
|
||||
END_param
|
||||
|
||||
}
|
||||
|
||||
|
||||
listener Default{
|
||||
address *:80
|
||||
secure 0
|
||||
map Example *
|
||||
}
|
||||
|
||||
|
||||
|
||||
vhTemplate centralConfigLog {
|
||||
templateFile $SERVER_ROOT/conf/templates/ccl.conf
|
||||
listeners Default
|
||||
}
|
||||
|
||||
vhTemplate PHP_SuEXEC {
|
||||
templateFile $SERVER_ROOT/conf/templates/phpsuexec.conf
|
||||
listeners Default
|
||||
}
|
||||
|
||||
vhTemplate EasyRailsWithSuEXEC {
|
||||
templateFile $SERVER_ROOT/conf/templates/rails.conf
|
||||
listeners Default
|
||||
}
|
||||
|
||||
virtualHost Example{
|
||||
vhRoot $SERVER_ROOT/Example/
|
||||
allowSymbolLink 1
|
||||
enableScript 1
|
||||
restrained 1
|
||||
maxKeepAliveReq
|
||||
smartKeepAlive
|
||||
setUIDMode 0
|
||||
chrootMode 0
|
||||
configFile $SERVER_ROOT/conf/vhosts/Example/vhconf.conf
|
||||
}
|
||||
|
||||
|
||||
|
||||
include phpconfigs/php53.conf
|
||||
include phpconfigs/php54.conf
|
||||
include phpconfigs/php55.conf
|
||||
include phpconfigs/php56.conf
|
||||
include phpconfigs/php70.conf
|
||||
include phpconfigs/php71.conf
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
default = application/octet-stream
|
||||
3gp = video/3gpp
|
||||
3g2 = video/3gpp2
|
||||
ai, eps = application/postscript
|
||||
aif, aifc, aiff = audio/x-aiff
|
||||
asc = text/plain
|
||||
asf = video/asf
|
||||
asx = video/x-ms-asf
|
||||
au = audio/basic
|
||||
avi = video/x-msvideo
|
||||
bcpio = application/x-bcpio
|
||||
bmp = image/bmp
|
||||
bin = application/octet-stream
|
||||
bz, bz2 = application/x-bzip
|
||||
cdf = application/x-netcdf
|
||||
class = application/java-vm
|
||||
cpio = application/x-cpio
|
||||
cpt = application/mac-compactpro
|
||||
crt = application/x-x509-ca-cert
|
||||
csh = application/x-csh
|
||||
css = text/css
|
||||
dcr,dir, dxr = application/x-director
|
||||
dms = application/octet-stream
|
||||
doc = application/msword
|
||||
dtd = application/xml-dtd
|
||||
dvi = application/x-dvi
|
||||
eot = application/vnd.ms-fontobject
|
||||
etx = text/x-setext
|
||||
exe = application/x-executable
|
||||
ez = application/andrew-inset
|
||||
flv = video/x-flv
|
||||
gif = image/gif
|
||||
gtar = application/x-gtar
|
||||
gz, gzip = application/gzip
|
||||
hdf = application/x-hdf
|
||||
hqx = application/mac-binhex40
|
||||
htc = text/x-component
|
||||
html, htm = text/html
|
||||
ice = x-conference/x-cooltalk
|
||||
ico = image/x-icon
|
||||
ief = image/ief
|
||||
iges, igs = model/iges
|
||||
iso = application/x-cd-image
|
||||
java = text/plain
|
||||
jar = application/java-archive
|
||||
jnlp = application/x-java-jnlp-file
|
||||
jpeg, jpe, jpg = image/jpeg
|
||||
js = application/x-javascript
|
||||
js2 = application/javascript
|
||||
js3 = text/javascript
|
||||
json = application/json
|
||||
jsp = text/plain
|
||||
kar = audio/midi
|
||||
latex = application/x-latex
|
||||
lha, lzh = application/octet-stream
|
||||
man = application/x-troff-man
|
||||
mdb = application/vnd.ms-access
|
||||
me = application/x-troff-me
|
||||
mesh = model/mesh
|
||||
mid, midi = audio/midi
|
||||
mif = application/vnd.mif
|
||||
movie = video/x-sgi-movie
|
||||
mov = video/quicktime
|
||||
mp2, mp3, mpga = audio/mpeg
|
||||
mpeg, mpe, mpg = video/mpeg
|
||||
mp4 = video/mp4
|
||||
mpp = application/vnd.ms-project
|
||||
ms = application/x-troff-ms
|
||||
msh = model/mesh
|
||||
nc = application/x-netcdf
|
||||
oda = application/oda
|
||||
odb = application/vnd.oasis.opendocument.database
|
||||
odc = application/vnd.oasis.opendocument.chart
|
||||
odf = application/vnd.oasis.opendocument.formula
|
||||
odg = application/vnd.oasis.opendocument.graphics
|
||||
odi = application/vnd.oasis.opendocument.image
|
||||
odp = application/vnd.oasis.opendocument.presentation
|
||||
ods = application/vnd.oasis.opendocument.spreadsheet
|
||||
odt = application/vnd.oasis.opendocument.text
|
||||
ogg = audio/ogg
|
||||
otf = application/x-font-woff
|
||||
pbm = image/x-portable-bitmap
|
||||
pdb = chemical/x-pdb
|
||||
pdf = application/pdf
|
||||
pgm = image/x-portable-graymap
|
||||
pgn = application/x-chess-pgn
|
||||
pls = audio/x-scpls
|
||||
png = image/png
|
||||
pnm = image/x-portable-anymap
|
||||
ppm = image/x-portable-pixmap
|
||||
ppt = application/vnd.ms-powerpoint
|
||||
ps = application/postscript
|
||||
qt,qtvr = video/quicktime
|
||||
ra = audio/x-realaudio
|
||||
ram, rm = audio/x-pn-realaudio
|
||||
rar = application/x-rar-compressed
|
||||
ras = image/x-cmu-raster
|
||||
rgb = image/x-rgb
|
||||
roff, t, tr = application/x-troff
|
||||
rss = application/rss+xml
|
||||
rsd = application/rsd+xml
|
||||
rtf = application/rtf
|
||||
rtx = text/richtext
|
||||
ser = application/java-serialized-object
|
||||
sgml, sgm = text/sgml
|
||||
sh = application/x-sh
|
||||
shar = application/x-shar
|
||||
shtml = application/x-httpd-shtml
|
||||
silo = model/mesh
|
||||
sit = application/x-stuffit
|
||||
skd, skm, skp, skt = application/x-koan
|
||||
smi,smil = application/smil
|
||||
snd = audio/basic
|
||||
spl = application/x-futuresplash
|
||||
sql = text/x-sql
|
||||
src = application/x-wais-source
|
||||
sv4cpio = application/x-sv4cpio
|
||||
sv4crc = application/x-sv4crc
|
||||
svg, svgz = image/svg+xml
|
||||
swf = application/x-shockwave-flash
|
||||
tar = application/x-tar
|
||||
tcl = application/x-tcl
|
||||
tex = application/x-tex
|
||||
texi, texinfo = application/x-texinfo
|
||||
tgz = application/x-gtar
|
||||
tiff, tif = image/tiff
|
||||
tsv = text/tab-separated-values
|
||||
ttf, ttc = application/x-font-ttf
|
||||
txt = text/plain
|
||||
ustar = application/x-ustar
|
||||
vcd = application/x-cdlink
|
||||
vrml = model/vrml
|
||||
vxml = application/voicexml+xml
|
||||
wav = audio/vnd.wave
|
||||
wax = audio/x-ms-wax
|
||||
wbmp = image/vnd.wap.wbmp
|
||||
wma = audio/x-ms-wma
|
||||
wml = text/vnd.wap.wml
|
||||
wmlc = application/vnd.wap.wmlc
|
||||
wmls = text/vnd.wap.wmlscript
|
||||
wmlsc = application/vnd.wap.wmlscriptc
|
||||
woff = application/font-woff
|
||||
woff2 = font/woff2
|
||||
woff_o1 = application/x-font-woff
|
||||
wtls-ca-certificate = application/vnd.wap.wtls-ca-certificate
|
||||
wri = application/vnd.ms-write
|
||||
wrl = model/vrml
|
||||
xbm = image/x-xbitmap
|
||||
xhtml, xht = application/xhtml+xml
|
||||
xls = application/vnd.ms-excel
|
||||
xml, xsd, xsl = application/xml
|
||||
xslt = application/xslt+xml
|
||||
xpm = image/x-xpixmap
|
||||
xwd = image/x-xwindowdump
|
||||
xyz = chemical/x-pdb
|
||||
zip = application/zip
|
||||
z = application/compress
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 0
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/html/
|
||||
|
||||
hotlinkCtrl {
|
||||
allowedHosts
|
||||
enableHotlinkCtrl 0
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
redirectUri
|
||||
onlySelf 1
|
||||
}
|
||||
|
||||
general {
|
||||
enableContextAC 0
|
||||
}
|
||||
|
||||
expires {
|
||||
expiresDefault
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
|
||||
rules <<<MY_END
|
||||
RewriteCond %{HTTP_USER_AGENT} ^NameOfBadRobot
|
||||
RewriteRule ^/nospider/ - [F]
|
||||
MY_END
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
indexFiles index.html
|
||||
autoIndexURI /_autoindex/default.php
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
useServer 0
|
||||
keepDays 30
|
||||
rollingSize 100M
|
||||
compressArchive 1
|
||||
logUserAgent 1
|
||||
logReferer 1
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
htAccess {
|
||||
allowOverride 0
|
||||
accessFileName .htaccess
|
||||
}
|
||||
|
||||
context /cgi-bin/{
|
||||
type cgi
|
||||
location $VH_ROOT/cgi-bin/
|
||||
allowBrowse 1
|
||||
}
|
||||
|
||||
awstats {
|
||||
updateMode 0
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
siteDomain localhost
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
}
|
||||
|
||||
accessControl {
|
||||
deny
|
||||
allow *
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
head 1.1;
|
||||
access;
|
||||
symbols;
|
||||
locks
|
||||
root:1.1; strict;
|
||||
comment @# @;
|
||||
|
||||
|
||||
1.1
|
||||
date 2017.08.17.05.47.23; author root; state Exp;
|
||||
branches;
|
||||
next ;
|
||||
|
||||
|
||||
desc
|
||||
@/usr/local/CyberCP/conf/templates/ccl.conf0
|
||||
@
|
||||
|
||||
|
||||
1.1
|
||||
log
|
||||
@Update
|
||||
@
|
||||
text
|
||||
@allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 0
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/html/
|
||||
|
||||
hotlinkCtrl {
|
||||
allowedHosts
|
||||
enableHotlinkCtrl 0
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
redirectUri
|
||||
onlySelf 1
|
||||
}
|
||||
|
||||
general {
|
||||
enableContextAC 0
|
||||
}
|
||||
|
||||
expires {
|
||||
expiresDefault
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
|
||||
rules <<<MY_END
|
||||
RewriteCond %{HTTP_USER_AGENT} ^NameOfBadRobot
|
||||
RewriteRule ^/nospider/ - [F]
|
||||
MY_END
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
indexFiles index.html
|
||||
autoIndexURI /_autoindex/default.php
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
useServer 0
|
||||
keepDays 30
|
||||
rollingSize 100M
|
||||
compressArchive 1
|
||||
logUserAgent 1
|
||||
logReferer 1
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
htAccess {
|
||||
allowOverride 0
|
||||
accessFileName .htaccess
|
||||
}
|
||||
|
||||
context /cgi-bin/{
|
||||
type cgi
|
||||
location $VH_ROOT/cgi-bin/
|
||||
allowBrowse 1
|
||||
}
|
||||
|
||||
awstats {
|
||||
updateMode 0
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
siteDomain localhost
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
}
|
||||
|
||||
accessControl {
|
||||
deny
|
||||
allow *
|
||||
}
|
||||
}
|
||||
@
|
||||
@@ -1,100 +0,0 @@
|
||||
allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 2
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/public_html/
|
||||
|
||||
htAccess {
|
||||
accessFileName .htaccess
|
||||
allowOverride 31
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
}
|
||||
|
||||
awstats {
|
||||
updateMode 0
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
siteDomain localhost
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
securedConn 0
|
||||
}
|
||||
|
||||
extProcessor $VH_NAME_lsphp{
|
||||
path $SERVER_ROOT/fcgi-bin/lsphp
|
||||
backlog 10
|
||||
instances 5
|
||||
runOnStartUp 0
|
||||
respBuffer 0
|
||||
autoStart 1
|
||||
extMaxIdleTime 60
|
||||
priority 0
|
||||
memSoftLimit 100M
|
||||
memHardLimit 150M
|
||||
procSoftLimit 100
|
||||
procHardLimit 200
|
||||
type lsapi
|
||||
address uds://tmp/lshttpd/$VH_NAME_lsphp.sock
|
||||
maxConns 5
|
||||
initTimeout 60
|
||||
retryTimeout 0
|
||||
persistConn 1
|
||||
pcKeepAliveTimeout 30
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
autoIndexURI /_autoindex/default.php
|
||||
indexFiles index.html
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
keepDays 30
|
||||
rollingSize 100M
|
||||
compressArchive 1
|
||||
useServer 0
|
||||
logHeaders 3
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
hotlinkCtrl {
|
||||
enableHotlinkCtrl 0
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
onlySelf 1
|
||||
}
|
||||
|
||||
accessControl {
|
||||
allow *
|
||||
}
|
||||
|
||||
scriptHandler {
|
||||
add lsapi:$VH_NAME_lsphp php
|
||||
}
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
context /cgi-bin/{
|
||||
type cgi
|
||||
location $VH_ROOT/cgi-bin/
|
||||
accessControl
|
||||
rewrite
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
head 1.1;
|
||||
access;
|
||||
symbols;
|
||||
locks
|
||||
root:1.1; strict;
|
||||
comment @# @;
|
||||
|
||||
|
||||
1.1
|
||||
date 2017.08.17.05.47.23; author root; state Exp;
|
||||
branches;
|
||||
next ;
|
||||
|
||||
|
||||
desc
|
||||
@/usr/local/CyberCP/conf/templates/phpsuexec.conf0
|
||||
@
|
||||
|
||||
|
||||
1.1
|
||||
log
|
||||
@Update
|
||||
@
|
||||
text
|
||||
@allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 2
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/public_html/
|
||||
|
||||
htAccess {
|
||||
accessFileName .htaccess
|
||||
allowOverride 31
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
}
|
||||
|
||||
awstats {
|
||||
updateMode 0
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
siteDomain localhost
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
securedConn 0
|
||||
}
|
||||
|
||||
extProcessor $VH_NAME_lsphp{
|
||||
path $SERVER_ROOT/fcgi-bin/lsphp
|
||||
backlog 10
|
||||
instances 5
|
||||
runOnStartUp 0
|
||||
respBuffer 0
|
||||
autoStart 1
|
||||
extMaxIdleTime 60
|
||||
priority 0
|
||||
memSoftLimit 100M
|
||||
memHardLimit 150M
|
||||
procSoftLimit 100
|
||||
procHardLimit 200
|
||||
type lsapi
|
||||
address uds://tmp/lshttpd/$VH_NAME_lsphp.sock
|
||||
maxConns 5
|
||||
initTimeout 60
|
||||
retryTimeout 0
|
||||
persistConn 1
|
||||
pcKeepAliveTimeout 30
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
autoIndexURI /_autoindex/default.php
|
||||
indexFiles index.html
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
keepDays 30
|
||||
rollingSize 100M
|
||||
compressArchive 1
|
||||
useServer 0
|
||||
logHeaders 3
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
hotlinkCtrl {
|
||||
enableHotlinkCtrl 0
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
onlySelf 1
|
||||
}
|
||||
|
||||
accessControl {
|
||||
allow *
|
||||
}
|
||||
|
||||
scriptHandler {
|
||||
add lsapi:$VH_NAME_lsphp php
|
||||
}
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
context /cgi-bin/{
|
||||
type cgi
|
||||
location $VH_ROOT/cgi-bin/
|
||||
accessControl
|
||||
rewrite
|
||||
}
|
||||
}
|
||||
@
|
||||
@@ -1,76 +0,0 @@
|
||||
allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 2
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/public/
|
||||
|
||||
accessControl {
|
||||
allow *
|
||||
}
|
||||
|
||||
hotlinkCtrl {
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
onlySelf 1
|
||||
enableHotlinkCtrl 0
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
indexFiles index.html
|
||||
autoIndexURI /_autoindex/default.php
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
logHeaders 3
|
||||
compressArchive 0
|
||||
useServer 0
|
||||
keepDays 30
|
||||
rollingSize 500M
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
context /{
|
||||
railsEnv 1
|
||||
maxConns 5
|
||||
location $VH_ROOT/
|
||||
type rails
|
||||
accessControl
|
||||
addDefaultCharset off
|
||||
}
|
||||
|
||||
htAccess {
|
||||
allowOverride 0
|
||||
accessFileName .htaccess
|
||||
}
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
awstats {
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
siteDomain localhost
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateMode 0
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
securedConn 0
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
head 1.1;
|
||||
access;
|
||||
symbols;
|
||||
locks
|
||||
root:1.1; strict;
|
||||
comment @# @;
|
||||
|
||||
|
||||
1.1
|
||||
date 2017.08.17.05.47.23; author root; state Exp;
|
||||
branches;
|
||||
next ;
|
||||
|
||||
|
||||
desc
|
||||
@/usr/local/CyberCP/conf/templates/rails.conf0
|
||||
@
|
||||
|
||||
|
||||
1.1
|
||||
log
|
||||
@Update
|
||||
@
|
||||
text
|
||||
@allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 2
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/public/
|
||||
|
||||
accessControl {
|
||||
allow *
|
||||
}
|
||||
|
||||
hotlinkCtrl {
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
onlySelf 1
|
||||
enableHotlinkCtrl 0
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
indexFiles index.html
|
||||
autoIndexURI /_autoindex/default.php
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
logHeaders 3
|
||||
compressArchive 0
|
||||
useServer 0
|
||||
keepDays 30
|
||||
rollingSize 500M
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
context /{
|
||||
railsEnv 1
|
||||
maxConns 5
|
||||
location $VH_ROOT/
|
||||
type rails
|
||||
accessControl
|
||||
addDefaultCharset off
|
||||
}
|
||||
|
||||
htAccess {
|
||||
allowOverride 0
|
||||
accessFileName .htaccess
|
||||
}
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
awstats {
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
siteDomain localhost
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateMode 0
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
securedConn 0
|
||||
}
|
||||
}
|
||||
@
|
||||
@@ -1,4 +0,0 @@
|
||||
group1: user1,user2, user3
|
||||
group2:
|
||||
user: user8, test
|
||||
group3:
|
||||
@@ -1,2 +0,0 @@
|
||||
test:kF2EDBE2Ux8sQ
|
||||
user1:SQtevcsBBnBPY
|
||||
@@ -1,119 +0,0 @@
|
||||
docRoot $VH_ROOT/html/
|
||||
enableGzip 1
|
||||
|
||||
context /docs/{
|
||||
allowBrowse 1
|
||||
location $SERVER_ROOT/docs/
|
||||
type NULL
|
||||
}
|
||||
|
||||
context /protected/{
|
||||
required user test
|
||||
authName Protected
|
||||
type NULL
|
||||
allowBrowse 1
|
||||
location protected/
|
||||
realm SampleProtectedArea
|
||||
|
||||
accessControl {
|
||||
deny
|
||||
allow *
|
||||
}
|
||||
}
|
||||
|
||||
context /blocked/{
|
||||
allowBrowse 0
|
||||
type NULL
|
||||
}
|
||||
|
||||
context /cgi-bin/{
|
||||
allowBrowse 1
|
||||
location $VH_ROOT/cgi-bin/
|
||||
type cgi
|
||||
}
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
index {
|
||||
autoIndexURI /_autoindex/default.php
|
||||
indexFiles index.html
|
||||
autoIndex 0
|
||||
useServer 0
|
||||
}
|
||||
|
||||
errorPage 404{
|
||||
url /error404.html
|
||||
}
|
||||
|
||||
errorlog $VH_ROOT/logs/error.log{
|
||||
logLevel DEBUG
|
||||
rollingSize 10M
|
||||
useServer 1
|
||||
}
|
||||
|
||||
accessLog $VH_ROOT/logs/access.log{
|
||||
compressArchive 0
|
||||
logReferer 1
|
||||
keepDays 30
|
||||
rollingSize 10M
|
||||
logUserAgent 1
|
||||
useServer 0
|
||||
}
|
||||
|
||||
htAccess {
|
||||
accessFileName .htaccess
|
||||
allowOverride 0
|
||||
}
|
||||
|
||||
awstats {
|
||||
updateInterval 86400
|
||||
workingDir $VH_ROOT/awstats
|
||||
updateOffset 0
|
||||
siteDomain localhost
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateMode 0
|
||||
awstatsURI /awstats/
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
|
||||
rules <<<END_rules
|
||||
RewriteCond %{HTTP_USER_AGENT} ^NameOfBadRobot
|
||||
RewriteRule ^/nospider/ - [F]
|
||||
END_rules
|
||||
}
|
||||
|
||||
hotlinkCtrl {
|
||||
suffixes gif, jpeg, jpg
|
||||
allowedHosts
|
||||
allowDirectAccess 1
|
||||
enableHotlinkCtrl 0
|
||||
onlySelf 1
|
||||
}
|
||||
|
||||
accessControl {
|
||||
deny
|
||||
allow *
|
||||
}
|
||||
|
||||
realm SampleProtectedArea {
|
||||
userDB {
|
||||
cacheTimeout 60
|
||||
maxCacheSize 200
|
||||
location $SERVER_ROOT/conf/vhosts/Example/htpasswd
|
||||
}
|
||||
|
||||
groupDB {
|
||||
cacheTimeout 60
|
||||
maxCacheSize 200
|
||||
location $SERVER_ROOT/conf/vhosts/Example/htgroup
|
||||
}
|
||||
}
|
||||
|
||||
general {
|
||||
enableContextAC 0
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
[Unit]
|
||||
Description = LSCPD Daemon
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart = /usr/local/lscp/bin/lscpdctrl start
|
||||
ExecStop = /usr/local/lscp/bin/lscpdctrl stop
|
||||
Restart= /usr/local/lscp/bin/lscpdctrl restart
|
||||
Restart=on-abnormal
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -1,259 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# resolve links - $0 may be a softlink
|
||||
PROG="$0"
|
||||
PIDFILE=/tmp/lscpd/lscpd.pid
|
||||
GRACEFUL_PIDFILE=/tmp/lscpd/lscpd.pid
|
||||
|
||||
#if [ -d "/usr/local/cpanel" ]; then
|
||||
# WSWATCH=1
|
||||
#fi
|
||||
|
||||
EXECUTABLE=lscpd
|
||||
DESC="lscpd"
|
||||
BASE_DIR=`dirname "$PROG"`
|
||||
cd "$BASE_DIR"
|
||||
BASE_DIR=`pwd`
|
||||
RESTART_LOG="$BASE_DIR/../logs/lsrestart.log"
|
||||
if [ ! -x "$BASE_DIR"/"$EXECUTABLE" ]; then
|
||||
echo "[ERROR] Cannot find $BASE_DIR/$EXECUTABLE"
|
||||
exit 1
|
||||
fi
|
||||
SYS_NAME=`uname -s`
|
||||
if [ "x$SYS_NAME" = "xFreeBSD" ] || [ "x$SYS_NAME" = "xDarwin" ] ; then
|
||||
PS_CMD="ps -ax"
|
||||
else
|
||||
PS_CMD="ps -ef"
|
||||
fi
|
||||
|
||||
test_running()
|
||||
{
|
||||
RUNNING=0
|
||||
if [ -f $PIDFILE ] ; then
|
||||
FPID=`cat $PIDFILE`
|
||||
if [ "x$FPID" != "x" ]; then
|
||||
kill -0 $FPID 2>/dev/null
|
||||
if [ $? -eq 0 ] ; then
|
||||
RUNNING=1
|
||||
PID=$FPID
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
RESTARTING=0
|
||||
if [ -f "$BASE_DIR"/"../admin/tmp/.restart" ]; then
|
||||
RESTARTING=1
|
||||
fi
|
||||
}
|
||||
|
||||
ret=0
|
||||
|
||||
killwatch()
|
||||
{
|
||||
WATCH_PROCS=`$PS_CMD | grep wswatch.sh | grep -v grep | wc -l`
|
||||
if [ $WATCH_PROCS -gt 0 ]; then
|
||||
killall wswatch.sh
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
start()
|
||||
{
|
||||
if [ -f "get_trial_key.sh" ]; then
|
||||
./get_trial_key.sh
|
||||
fi
|
||||
killwatch
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
PID=`cat $PIDFILE`
|
||||
else
|
||||
PID=""
|
||||
fi
|
||||
|
||||
./$EXECUTABLE
|
||||
ret=$?
|
||||
|
||||
|
||||
if [ $ret -eq 0 ]; then
|
||||
NEW_PID=`cat $PIDFILE`
|
||||
if [ "x$NEW_PID" = "x$PID" ] || [ "x$NEW_PID" = "x" ]; then
|
||||
sleep 1
|
||||
NEW_PID=`cat $PIDFILE`
|
||||
fi
|
||||
echo "[OK] $DESC: pid=$NEW_PID."
|
||||
test_running
|
||||
if [ "x$WSWATCH" = "x1" ]; then
|
||||
./wswatch.sh &
|
||||
fi
|
||||
else
|
||||
echo "[ERROR] Failed to start $DESC!"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
stop()
|
||||
{
|
||||
killwatch
|
||||
kill -USR2 $PID
|
||||
kill $PID
|
||||
ret=$?
|
||||
if [ $ret -eq 0 ]; then
|
||||
# if [ -f $PIDFILE ]; then
|
||||
# sleep 1
|
||||
# fi
|
||||
echo "[OK] $DESC: stopped."
|
||||
else
|
||||
echo "[ERROR] can not kill $DESC"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
do_restart()
|
||||
{
|
||||
if [ $RUNNING -eq 1 ]; then
|
||||
kill -USR1 $PID
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
echo "[ERROR] cannot gracefully restart $DESC"
|
||||
else
|
||||
echo "[OK] Send SIGUSR1 to $PID"
|
||||
fi
|
||||
else
|
||||
start
|
||||
fi
|
||||
}
|
||||
|
||||
log7080()
|
||||
{
|
||||
if [ "x$SYS_NAME" = "xLinux" ]; then
|
||||
echo "checking port 7080 usage with netstat" >> $RESTART_LOG
|
||||
netstat -anp | grep 7080 >> $RESTART_LOG
|
||||
echo "checking port 7080 usage with lsof" >> $RESTART_LOG
|
||||
lsof -i TCP:7080 >> $RESTART_LOG
|
||||
fi
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
SPID=$PID
|
||||
TRY=1
|
||||
if [ $RUNNING -eq 1 ]; then
|
||||
do_restart
|
||||
if [ $RESTARTING -eq 1 ]; then
|
||||
exit 0
|
||||
fi
|
||||
sleep 2
|
||||
test_running
|
||||
else
|
||||
if [ $RESTARTING -eq 1 ]; then
|
||||
if [ -f $GRACEFUL_PIDFILE ]; then
|
||||
GPID=`cat $GRACEFUL_PIDFILE`
|
||||
if [ "x$GPID" != 'x' ]; then
|
||||
if [ $GPID -ne 0 ] && [ $GPID -ne 1 ]; then
|
||||
killall -9 $EXECUTABLE
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
start
|
||||
sleep 2
|
||||
test_running
|
||||
fi
|
||||
while [ $TRY -lt 15 ] && [ "x$PID" = "x$SPID" ]; do
|
||||
TRY=`expr $TRY + 1`
|
||||
sleep 1
|
||||
test_running
|
||||
done
|
||||
|
||||
if [ $RUNNING -eq 0 ]; then
|
||||
|
||||
echo "LSWS does not restart properly, check port 7080" >> $RESTART_LOG
|
||||
#log7080
|
||||
killall -9 $EXECUTABLE
|
||||
sleep 1
|
||||
echo "check port 7080 after kill all $EXECUTABLE processes " >> $RESTART_LOG
|
||||
#log7080
|
||||
start
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
reload()
|
||||
{
|
||||
restart
|
||||
|
||||
# kill -HUP $PID
|
||||
# ret=$?
|
||||
# if [ $ret -eq 0 ]; then
|
||||
# echo "[OK] $DESC: configuration reloaded"
|
||||
# else
|
||||
# echo "[ERROR] Can't send SIGHUP to $DESC"
|
||||
# fi
|
||||
}
|
||||
|
||||
help() {
|
||||
echo $"Usage: $PROG {start|stop|restart|reload|condrestrt|try-restart|status|help}"
|
||||
cat <<EOF
|
||||
|
||||
start - start web server
|
||||
stop - stop web server
|
||||
restart - gracefully restart web server with zero down time
|
||||
reload - same as restart
|
||||
condrestart - gracefully restart web server if server is running
|
||||
try-restart - same as condrestart
|
||||
status - show service status
|
||||
help - this screen
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
test_running
|
||||
|
||||
date >> $RESTART_LOG
|
||||
echo "$1, LSWS running: $RUNNING" >> $RESTART_LOG
|
||||
|
||||
case "$1" in
|
||||
start|restart)
|
||||
restart
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
if [ $RUNNING -eq 1 ]; then
|
||||
restart
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
if [ $RUNNING -eq 1 ]; then
|
||||
echo "$DESC is running with PID $PID."
|
||||
else
|
||||
echo "[ERROR] $DESC is not running."
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
if [ $RUNNING -eq 0 ]; then
|
||||
sleep 1
|
||||
test_running
|
||||
fi
|
||||
if [ $RUNNING -eq 1 ]; then
|
||||
stop
|
||||
else
|
||||
echo "[ERROR] $DESC is not running."
|
||||
ret=1
|
||||
fi
|
||||
;;
|
||||
stophttpd)
|
||||
if [ $RUNNING -eq 1 ]; then
|
||||
kill $PID
|
||||
fi
|
||||
;;
|
||||
reload)
|
||||
if [ $RUNNING -eq 1 ]; then
|
||||
reload
|
||||
else
|
||||
echo "[ERROR] $DESC is not running."
|
||||
ret=2
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
help
|
||||
ret=3
|
||||
;;
|
||||
esac
|
||||
exit $ret
|
||||
@@ -1,7 +0,0 @@
|
||||
# MariaDB 10.0 CentOS repository list - created 2018-02-02 12:38 UTC
|
||||
# http://downloads.mariadb.org/mariadb/repositories/
|
||||
[mariadb-mirror]
|
||||
name = MariaDB
|
||||
baseurl = https://mirror.cyberpanel.net/mariadb/10.0
|
||||
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
|
||||
gpgcheck=0
|
||||
@@ -1,17 +0,0 @@
|
||||
[mysqld_multi]
|
||||
mysqld = /usr/bin/mysqld_safe
|
||||
|
||||
[mysqld]
|
||||
user= mysql
|
||||
pid-file= /var/lib/mysql/mysql.pid
|
||||
socket= /var/lib/mysql/mysql.sock
|
||||
port= 3306
|
||||
datadir= /var/lib/mysql
|
||||
|
||||
|
||||
[mysqld1]
|
||||
user= mysql
|
||||
pid-file= /var/lib/mysql1/mysql.pid
|
||||
socket= /var/lib/mysql1/mysql.sock
|
||||
port= 3307
|
||||
datadir= /var/lib/mysql1
|
||||
@@ -1,16 +0,0 @@
|
||||
[Unit]
|
||||
Description=MySQL Multi Server for instance %i
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=mysql
|
||||
Group=mysql
|
||||
Type=forking
|
||||
ExecStart=/usr/bin/mysqld_multi start %i
|
||||
ExecStop=/usr/bin/mysqld_multi stop %i
|
||||
Restart=always
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,141 +0,0 @@
|
||||
|
||||
import pexpect
|
||||
import installLog as logging
|
||||
|
||||
class mysqlUtilities:
|
||||
|
||||
@staticmethod
|
||||
def SendQuery(user, password, dbname, query):
|
||||
try:
|
||||
expectation = "Enter password:"
|
||||
securemysql = pexpect.spawn("mysql -u "+user+" -p")
|
||||
securemysql.expect(expectation)
|
||||
securemysql.sendline(password)
|
||||
|
||||
expectation = ["Access denied for user", "Welcome to the MariaDB monitor"]
|
||||
index = securemysql.expect(expectation)
|
||||
if index == 0:
|
||||
return "Wrong Password"
|
||||
else:
|
||||
|
||||
securemysql.sendline("USE "+dbname+";")
|
||||
expectation = "Database changed"
|
||||
securemysql.expect(expectation)
|
||||
|
||||
expectation = "Query OK"
|
||||
securemysql.sendline(query);
|
||||
securemysql.expect(expectation)
|
||||
|
||||
securemysql.sendline("exit");
|
||||
|
||||
securemysql.wait()
|
||||
return 1
|
||||
except pexpect.EOF, msg:
|
||||
logging.InstallLog.writeToFile(str(msg) + " Exception EOF [SendQuery]")
|
||||
except BaseException, msg:
|
||||
logging.InstallLog.writeToFile(str(msg) + "[SendQuery]")
|
||||
|
||||
|
||||
@staticmethod
|
||||
def createDatabase(dbname,dbuser,dbpassword):
|
||||
|
||||
try:
|
||||
|
||||
passFile = "/etc/cyberpanel/mysqlPassword"
|
||||
|
||||
f = open(passFile)
|
||||
data = f.read()
|
||||
password = data.split('\n', 1)[0]
|
||||
|
||||
expectation = "Enter password:"
|
||||
securemysql = pexpect.spawn("mysql -u root -p")
|
||||
securemysql.expect(expectation)
|
||||
securemysql.sendline(password)
|
||||
|
||||
expectation = ["Access denied for user", "Welcome to the MariaDB monitor"]
|
||||
|
||||
index = securemysql.expect(expectation)
|
||||
|
||||
if index == 0:
|
||||
return "Wrong root Password"
|
||||
else:
|
||||
securemysql.sendline("CREATE DATABASE "+dbname+";")
|
||||
|
||||
expectation = ["database exists","Query OK"]
|
||||
index = securemysql.expect(expectation)
|
||||
|
||||
|
||||
if index == 0:
|
||||
return "This database already exists, please choose another name."
|
||||
elif index == 1:
|
||||
securemysql.sendline("CREATE USER '" +dbuser+ "'@'localhost' IDENTIFIED BY '"+dbpassword+"';")
|
||||
expectation = ["CREATE USER failed","Query OK"]
|
||||
|
||||
index = securemysql.expect(expectation)
|
||||
|
||||
if index == 0:
|
||||
securemysql.sendline("DROP DATABASE IF EXISTS "+dbname+";")
|
||||
return "This user already exists, please choose another user."
|
||||
else:
|
||||
securemysql.sendline("GRANT ALL PRIVILEGES ON " +dbname+ ".* TO '" +dbuser+ "'@'localhost';")
|
||||
expectation = "Query OK"
|
||||
securemysql.expect(expectation)
|
||||
securemysql.sendline("exit")
|
||||
securemysql.wait()
|
||||
return 1
|
||||
except pexpect.EOF, msg:
|
||||
logging.InstallLog.writeToFile(str(msg) + " Exception EOF [createDatabase]")
|
||||
except BaseException, msg:
|
||||
logging.InstallLog.writeToFile(str(msg) + "[createDatabase]")
|
||||
|
||||
@staticmethod
|
||||
def createDatabaseCyberPanel(dbname,dbuser,dbpassword):
|
||||
|
||||
try:
|
||||
|
||||
passFile = "/etc/cyberpanel/mysqlPassword"
|
||||
|
||||
f = open(passFile)
|
||||
data = f.read()
|
||||
password = data.split('\n', 1)[0]
|
||||
|
||||
expectation = "Enter password:"
|
||||
securemysql = pexpect.spawn("mysql --host=127.0.0.1 --port=3307 -u root -p")
|
||||
securemysql.expect(expectation)
|
||||
securemysql.sendline(password)
|
||||
|
||||
expectation = ["Access denied for user", "Welcome to the MariaDB monitor"]
|
||||
|
||||
index = securemysql.expect(expectation)
|
||||
|
||||
if index == 0:
|
||||
return "Wrong root Password"
|
||||
else:
|
||||
securemysql.sendline("CREATE DATABASE "+dbname+";")
|
||||
|
||||
expectation = ["database exists","Query OK"]
|
||||
index = securemysql.expect(expectation)
|
||||
|
||||
|
||||
if index == 0:
|
||||
return "This database already exists, please choose another name."
|
||||
elif index == 1:
|
||||
securemysql.sendline("CREATE USER '" +dbuser+ "'@'localhost' IDENTIFIED BY '"+dbpassword+"';")
|
||||
expectation = ["CREATE USER failed","Query OK"]
|
||||
|
||||
index = securemysql.expect(expectation)
|
||||
|
||||
if index == 0:
|
||||
securemysql.sendline("DROP DATABASE IF EXISTS "+dbname+";")
|
||||
return "This user already exists, please choose another user."
|
||||
else:
|
||||
securemysql.sendline("GRANT ALL PRIVILEGES ON " +dbname+ ".* TO '" +dbuser+ "'@'localhost';")
|
||||
expectation = "Query OK"
|
||||
securemysql.expect(expectation)
|
||||
securemysql.sendline("exit")
|
||||
securemysql.wait()
|
||||
return 1
|
||||
except pexpect.EOF, msg:
|
||||
logging.InstallLog.writeToFile(str(msg) + " Exception EOF [createDatabase]")
|
||||
except BaseException, msg:
|
||||
logging.InstallLog.writeToFile(str(msg) + "[createDatabase]")
|
||||
Binary file not shown.
@@ -1,24 +0,0 @@
|
||||
# http://editorconfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{cpp,h}]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.sh]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.php]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
@@ -1,80 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
Project(openlitespeed)
|
||||
INCLUDE( ${PROJECT_SOURCE_DIR}/CMakeModules/common.cmake)
|
||||
|
||||
set(openlitespeed_MAJOR_VERSION 1)
|
||||
set(openlitespeed_MINOR_VERSION 4)
|
||||
set(openlitespeed_PATCH_VERSION 0)
|
||||
set(openlitespeed_VERSION
|
||||
${FOOBAR_MAJOR_VERSION}.${FOOBAR_MINOR_VERSION}.${FOOBAR_PATCH_VERSION})
|
||||
|
||||
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
include_directories( include ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/include/)
|
||||
link_directories( ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/lib/)
|
||||
|
||||
SET (CMAKE_C_COMPILER "/usr/bin/clang")
|
||||
SET (CMAKE_CXX_COMPILER "/usr/bin/clang++")
|
||||
|
||||
#set(MY_CMAKE_WARNING_FLAG " -Wall -Wextra -Wno-unused-parameter")
|
||||
#set(MY_CMAKE_WARNING_FLAG " -Wall -Wextra -Wno-unused-parameter -fsanitize=address -fno-omit-frame-pointer")
|
||||
#set(MY_CMAKE_WARNING_FLAG " -Wall -Wextra -Wno-unused-parameter -fno-omit-frame-pointer")
|
||||
set(MY_CMAKE_WARNING_FLAG " -Wall -Wextra -Wno-unused-parameter -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer")
|
||||
#set(MY_CMAKE_WARNING_FLAG " -Wall -Wextra -Wno-unused-parameter")
|
||||
set(MY_CMAKE_POOL_FLAG " -DPOOL_TESTING -DUSE_VALGRIND")
|
||||
#set(MY_CMAKE_POOL_FLAG " -DPOOL_TESTING")
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_CMAKE_WARNING_FLAG} ${MY_CMAKE_POOL_FLAG}")
|
||||
#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${MY_CMAKE_WARNING_FLAG}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CMAKE_WARNING_FLAG} ${MY_CMAKE_POOL_FLAG}")
|
||||
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${MY_CMAKE_WARNING_FLAG}")
|
||||
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
|
||||
find_package(ZLIB REQUIRED)
|
||||
##find_package(LibLdap REQUIRED)
|
||||
find_package(PCRE REQUIRED)
|
||||
find_package(EXPAT REQUIRED)
|
||||
#find_package(OpenSSL REQUIRED)
|
||||
|
||||
|
||||
execute_process( COMMAND ${PROJECT_SOURCE_DIR}/dlossl.sh )
|
||||
execute_process( COMMAND ${PROJECT_SOURCE_DIR}/src/modules/pagespeed/dlpsol.sh )
|
||||
|
||||
##########################################################################################
|
||||
#If you want to link libUnitTest++, just un-comment out the following commands
|
||||
#AND YOU NEED TO INSTALL it to the directory /src/test/unittest-cpp/UnitTest++/
|
||||
add_definitions(-DRUN_TEST)
|
||||
set(libUnitTest libUnitTest++.a)
|
||||
##########################################################################################
|
||||
#If you want to use BoringSSL, just un-comment out the following commands
|
||||
#AND YOU NEED TO HAVE THE files ready in openlitespeed/ssl
|
||||
#You can run the dlbssl.sh to make them ready
|
||||
set(BSSL_ADD_LIB libdecrepit.a)
|
||||
##########################################################################################
|
||||
#If you want to use Brotli Compression, just un-comment out the following commands
|
||||
#set(BROTLI_ADD_LIB libbrotlidec.a libbrotlienc.a libbrotlicommon.a)
|
||||
#add_definitions(-DUSE_BROTLI)
|
||||
##########################################################################################
|
||||
#If you want to use IP2Location, just un-comment out the following commands
|
||||
set(IP2LOC_ADD_LIB libIP2Location.a)
|
||||
add_definitions(-DUSE_IP2LOCATION)
|
||||
##########################################################################################
|
||||
|
||||
|
||||
add_definitions(-DTEST_OUTPUT_PLAIN_CONF)
|
||||
#add_definitions(-DLS_VG_DEBUG)
|
||||
#add_definitions(-DDEBUG_POOL)
|
||||
add_definitions(-DOPENSSL_NO_CXX)
|
||||
|
||||
execute_process( COMMAND getconf LFS_CFLAGS
|
||||
OUTPUT_VARIABLE LFS_CFLAGS )
|
||||
|
||||
add_definitions( ${LFS_CFLAGS} )
|
||||
add_definitions(-DUSE_UDNS)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(test)
|
||||
@@ -1,69 +0,0 @@
|
||||
# Try and find libldap.
|
||||
# As soon as libldap has been found, the following variables will be defined:
|
||||
#
|
||||
# LIBLDAP_FOUND
|
||||
# LDAP_INCLUDE_DIR
|
||||
# LDAP_LIBRARY:FILEPATH
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2009 Juergen Leising <jleising@users.sourceforge.net>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
|
||||
|
||||
MESSAGE(STATUS "checking for libldap and liblber...")
|
||||
|
||||
FIND_PATH(LDAP_INCLUDE_DIR NAMES ldap.h
|
||||
PATHS /include /usr/include /usr/local/include /usr/share/include /opt/include
|
||||
DOC "Try and find the header file ldap.h")
|
||||
|
||||
FIND_PATH(LBER_INCLUDE_DIR NAMES lber.h
|
||||
PATHS /include /usr/include /usr/local/include /usr/share/include /opt/include ${LDAP_INCLUDE_DIR}
|
||||
DOC "Try and find the header file lber.h")
|
||||
|
||||
|
||||
|
||||
FIND_LIBRARY(LDAP_LIBRARY NAMES ldap
|
||||
PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib /usr/lib64 /lib64 /usr/local/lib64 /usr/share/lib64 /opt/lib64 /opt/share/lib64 /var/lib64
|
||||
DOC "Try and find libldap")
|
||||
|
||||
|
||||
IF (LDAP_LIBRARY)
|
||||
get_filename_component(LDAP_LIBRARY_DIRS ${LDAP_LIBRARY} PATH)
|
||||
FIND_LIBRARY(LBER_LIBRARY NAMES lber
|
||||
PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib /usr/lib64 /lib64 /usr/local/lib64 /usr/share/lib64 /opt/lib64 /opt/share/lib64 /var/lib64 ${LDAP_LIBRARY_DIRS}
|
||||
DOC "Try and find liblber")
|
||||
ELSE (LDAP_LIBRARY)
|
||||
FIND_LIBRARY(LBER_LIBRARY NAMES lber
|
||||
PATHS /usr/lib /lib /usr/local/lib /usr/share/lib /opt/lib /opt/share/lib /var/lib /usr/lib64 /lib64 /usr/local/lib64 /usr/share/lib64 /opt/lib64 /opt/share/lib64 /var/lib64
|
||||
DOC "Try and find liblber")
|
||||
ENDIF (LDAP_LIBRARY)
|
||||
|
||||
|
||||
|
||||
|
||||
IF (LBER_LIBRARY)
|
||||
SET( LIBLBER_FOUND 1 )
|
||||
get_filename_component(LBER_LIBRARY_DIRS ${LBER_LIBRARY} PATH)
|
||||
MESSAGE(STATUS " Found ${LBER_LIBRARY}")
|
||||
ELSE(LBER_LIBRARY)
|
||||
MESSAGE( STATUS " Could NOT find liblber.")
|
||||
ENDIF (LBER_LIBRARY)
|
||||
|
||||
|
||||
|
||||
|
||||
IF (LDAP_INCLUDE_DIR AND LDAP_LIBRARY)
|
||||
SET( LIBLDAP_FOUND 1 )
|
||||
MESSAGE(STATUS " Found ${LDAP_LIBRARY}")
|
||||
ELSE (LDAP_INCLUDE_DIR AND LDAP_LIBRARY)
|
||||
IF ( LibLdap_FIND_REQUIRED )
|
||||
MESSAGE( FATAL_ERROR " Could NOT find libldap. The ldap plugin needs this library.")
|
||||
ELSE ( LibLdap_FIND_REQUIRED )
|
||||
MESSAGE( STATUS " Could NOT find libldap.")
|
||||
ENDIF ( LibLdap_FIND_REQUIRED )
|
||||
ENDIF (LDAP_INCLUDE_DIR AND LDAP_LIBRARY)
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
# - Try to find the PCRE regular expression library
|
||||
# Once done this will define
|
||||
#
|
||||
# PCRE_FOUND - system has the PCRE library
|
||||
# PCRE_INCLUDE_DIR - the PCRE include directory
|
||||
# PCRE_LIBRARIES - The libraries needed to use PCRE
|
||||
|
||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
if (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY)
|
||||
# Already in cache, be silent
|
||||
set(PCRE_FIND_QUIETLY TRUE)
|
||||
endif (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY)
|
||||
|
||||
if (NOT WIN32)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_PCRE QUIET libpcre)
|
||||
set(PCRE_DEFINITIONS ${PC_PCRE_CFLAGS_OTHER})
|
||||
endif (NOT WIN32)
|
||||
|
||||
find_path(PCRE_INCLUDE_DIR pcre.h
|
||||
HINTS ${PC_PCRE_INCLUDEDIR} ${PC_PCRE_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES pcre)
|
||||
|
||||
find_library(PCRE_PCRE_LIBRARY NAMES pcre HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS})
|
||||
|
||||
find_library(PCRE_PCREPOSIX_LIBRARY NAMES pcreposix HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
IF(NOT WIN32)
|
||||
find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY PCRE_PCREPOSIX_LIBRARY )
|
||||
mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCREPOSIX_LIBRARY PCRE_PCRE_LIBRARY)
|
||||
set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} ${PCRE_PCREPOSIX_LIBRARY})
|
||||
ELSE()
|
||||
find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY )
|
||||
set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} )
|
||||
mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCRE_LIBRARY)
|
||||
ENDIF()
|
||||
@@ -1,3 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/openssl/include" "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/src")
|
||||
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -1,3 +0,0 @@
|
||||
About installation, please read below article
|
||||
http://open.litespeedtech.com/quick_install_guide.html
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
SUBDIRS = src
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
install-data-hook:
|
||||
( cd dist; ./install.sh "$(DESTDIR)$(prefix)" "$(OPENLSWS_USER)" "$(OPENLSWS_GROUP)" "$(OPENLSWS_ADMIN)" "$(OPENLSWS_PASSWORD)" "$(OPENLSWS_EMAIL)" "$(OPENLSWS_ADMINSSL)" "$(OPENLSWS_ADMINPORT)" "$(USE_LSPHP7)" "$(DEFAULT_TMP_DIR)" "$(PID_FILE)" "$(OPENLSWS_EXAMPLEPORT)" "$(IS_LSCPD)" ;)
|
||||
( rm -f $(DESTDIR)$(prefix)/modules/cache.la $(DESTDIR)$(prefix)/modules/modinspector.la $(DESTDIR)$(prefix)/modules/modreqparser.la $(DESTDIR)$(prefix)/modules/uploadprogress.la $(DESTDIR)$(prefix)/modules/mod_lua.la )
|
||||
|
||||
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
|
||||
@@ -1,825 +0,0 @@
|
||||
# Makefile.in generated by automake 1.13.4 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/configure $(am__configure_deps) INSTALL \
|
||||
config.guess config.sub depcomp install-sh missing ltmain.sh
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/ax_check_zlib.m4 \
|
||||
$(top_srcdir)/ax_check_openssl.m4 \
|
||||
$(top_srcdir)/ax_path_lib_pcre.m4 \
|
||||
$(top_srcdir)/ax_lib_expat.m4 $(top_srcdir)/ax_check_liblua.m4 \
|
||||
$(top_srcdir)/ax_check_libudns.m4 \
|
||||
$(top_srcdir)/ax_check_brotli.m4 \
|
||||
$(top_srcdir)/ax_check_ip2location.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||
ctags-recursive dvi-recursive html-recursive info-recursive \
|
||||
install-data-recursive install-dvi-recursive \
|
||||
install-exec-recursive install-html-recursive \
|
||||
install-info-recursive install-pdf-recursive \
|
||||
install-ps-recursive install-recursive installcheck-recursive \
|
||||
installdirs-recursive pdf-recursive ps-recursive \
|
||||
tags-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
am__recursive_targets = \
|
||||
$(RECURSIVE_TARGETS) \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
cscope distdir dist dist-all distcheck
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
if test -d "$(distdir)"; then \
|
||||
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -rf "$(distdir)" \
|
||||
|| { sleep 5 && rm -rf "$(distdir)"; }; \
|
||||
else :; fi
|
||||
am__post_remove_distdir = $(am__remove_distdir)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
DIST_TARGETS = dist-gzip
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BROTLI_INCLUDES = @BROTLI_INCLUDES@
|
||||
BROTLI_LIBS = @BROTLI_LIBS@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFAULT_TMP_DIR = @DEFAULT_TMP_DIR@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DL_LIB_OPTION = @DL_LIB_OPTION@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXPAT_CFLAGS = @EXPAT_CFLAGS@
|
||||
EXPAT_LIBS = @EXPAT_LIBS@
|
||||
EXPAT_VERSION = @EXPAT_VERSION@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
IP2LOCATION_INCLUDES = @IP2LOCATION_INCLUDES@
|
||||
IP2LOCATION_LIBS = @IP2LOCATION_LIBS@
|
||||
IS_LSCPD = @IS_LSCPD@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LUA_INCLUDES = @LUA_INCLUDES@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OPENLSWS_ADMIN = @OPENLSWS_ADMIN@
|
||||
OPENLSWS_ADMINPORT = @OPENLSWS_ADMINPORT@
|
||||
OPENLSWS_ADMINSSL = @OPENLSWS_ADMINSSL@
|
||||
OPENLSWS_BSSL = @OPENLSWS_BSSL@
|
||||
OPENLSWS_DISABLE_RPATH = @OPENLSWS_DISABLE_RPATH@
|
||||
OPENLSWS_EMAIL = @OPENLSWS_EMAIL@
|
||||
OPENLSWS_EXAMPLEPORT = @OPENLSWS_EXAMPLEPORT@
|
||||
OPENLSWS_GROUP = @OPENLSWS_GROUP@
|
||||
OPENLSWS_LIBDIR = @OPENLSWS_LIBDIR@
|
||||
OPENLSWS_PASSWORD = @OPENLSWS_PASSWORD@
|
||||
OPENLSWS_USER = @OPENLSWS_USER@
|
||||
OPENSSL_INCLUDES = @OPENSSL_INCLUDES@
|
||||
OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@
|
||||
OPENSSL_LIBS = @OPENSSL_LIBS@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PCRE_CFLAGS = @PCRE_CFLAGS@
|
||||
PCRE_LDFLAGS = @PCRE_LDFLAGS@
|
||||
PCRE_LIBS = @PCRE_LIBS@
|
||||
PID_FILE = @PID_FILE@
|
||||
RANLIB = @RANLIB@
|
||||
RT_LIB_OPTION = @RT_LIB_OPTION@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
UDNS_CFLAGS = @UDNS_CFLAGS@
|
||||
UDNS_LIBS = @UDNS_LIBS@
|
||||
USE_LSPHP7 = @USE_LSPHP7@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
brotli_dir = @brotli_dir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
ip2location_dir = @ip2location_dir@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
need_brotli = @need_brotli@
|
||||
need_ip2location = @need_ip2location@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = src
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool config.lt
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run 'make' without going through this Makefile.
|
||||
# To change the values of 'make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in 'config.status', edit 'config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run 'make');
|
||||
# (2) otherwise, pass the desired values on the 'make' command line.
|
||||
$(am__recursive_targets):
|
||||
@fail=; \
|
||||
if $(am__make_keepgoing); then \
|
||||
failcom='fail=yes'; \
|
||||
else \
|
||||
failcom='exit 1'; \
|
||||
fi; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-recursive
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-recursive
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscope: cscope.files
|
||||
test ! -s cscope.files \
|
||||
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
|
||||
clean-cscope:
|
||||
-rm -f cscope.files
|
||||
cscope.files: clean-cscope cscopelist
|
||||
cscopelist: cscopelist-recursive
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-lzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist dist-all:
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lz*) \
|
||||
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
mkdir $(distdir)/_build $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__post_remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@test -n '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: trying to run $@ with an empty' \
|
||||
'$$(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
$(am__cd) '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-libtool \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(am__recursive_targets) install-am install-data-am \
|
||||
install-strip
|
||||
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
||||
am--refresh check check-am clean clean-cscope clean-generic \
|
||||
clean-libtool cscope cscopelist-am ctags ctags-am dist \
|
||||
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
|
||||
dist-xz dist-zip distcheck distclean distclean-generic \
|
||||
distclean-libtool distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am \
|
||||
install-data-hook install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am
|
||||
|
||||
|
||||
install-data-hook:
|
||||
( cd dist; ./install.sh "$(DESTDIR)$(prefix)" "$(OPENLSWS_USER)" "$(OPENLSWS_GROUP)" "$(OPENLSWS_ADMIN)" "$(OPENLSWS_PASSWORD)" "$(OPENLSWS_EMAIL)" "$(OPENLSWS_ADMINSSL)" "$(OPENLSWS_ADMINPORT)" "$(USE_LSPHP7)" "$(DEFAULT_TMP_DIR)" "$(PID_FILE)" "$(OPENLSWS_EXAMPLEPORT)" "$(IS_LSCPD)" ;)
|
||||
( rm -f $(DESTDIR)$(prefix)/modules/cache.la $(DESTDIR)$(prefix)/modules/modinspector.la $(DESTDIR)$(prefix)/modules/modreqparser.la $(DESTDIR)$(prefix)/modules/uploadprogress.la $(DESTDIR)$(prefix)/modules/mod_lua.la )
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,33 +0,0 @@
|
||||
OpenLiteSpeed Web Server
|
||||
========
|
||||
|
||||
Description
|
||||
--------
|
||||
|
||||
OpenLiteSpeed is a high-performance, lightweight, open source HTTP server developed and copyrighted by
|
||||
LiteSpeed Technologies. Users are free to download, use, distribute, and modify OpenLiteSpeed and its
|
||||
source code in accordance with the precepts of the GPLv3 license.
|
||||
|
||||
This is the official repository for OpenLiteSpeed's source code. It is maintained byLiteSpeed
|
||||
Technologies.
|
||||
|
||||
Documentation
|
||||
--------
|
||||
|
||||
Users can find all OpenLiteSpeed documentation on the [OpenLiteSpeed site](http://open.litespeedtech.com),
|
||||
but here are some quick links to important parts of the site:
|
||||
|
||||
[Installation](http://open.litespeedtech.com/mediawiki/index.php/Help:Installation)
|
||||
|
||||
[Configuration](http://open.litespeedtech.com/mediawiki/index.php/Help:Configuration)
|
||||
|
||||
[Road map](http://open.litespeedtech.com/mediawiki/index.php/Road_Map)
|
||||
|
||||
[Release log](http://open.litespeedtech.com/mediawiki/index.php/Release_Log/1.x)
|
||||
|
||||
Get in Touch
|
||||
--------
|
||||
|
||||
OpenLiteSpeed has a [Google Group](https://groups.google.com/forum/#!forum/openlitespeed-development). If
|
||||
you find a bug, want to request new features, or just want to talk about OpenLiteSpeed, this is the place
|
||||
to do it.
|
||||
9660
install-cn/openlitespeed-1.4.28/aclocal.m4
vendored
9660
install-cn/openlitespeed-1.4.28/aclocal.m4
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,14 +0,0 @@
|
||||
How to build the example module and use it.
|
||||
|
||||
There are four steps:
|
||||
|
||||
1, You need to compile and build it. You can simply use the ccc.sh script to compile and build the module.
|
||||
For example:
|
||||
./ccc.sh hellohandler.c
|
||||
Then you will get the module file hellohandler.so
|
||||
|
||||
2, Copy the module file to $LSWS-HOME/modules/
|
||||
|
||||
3, In the admin console, Configuration/Server/Modules/, add the newly created module and enable it; in the above example, the name is hellohandler.
|
||||
|
||||
4, Restart openlitespeed and it should be added.
|
||||
@@ -1,76 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo =====================================================================================
|
||||
|
||||
cd `dirname "$0"`
|
||||
|
||||
if [ $# -eq 0 ] ; then
|
||||
echo Need a c file name, such as $0 mymodule.c
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Your command is $0 $1"
|
||||
echo
|
||||
|
||||
if [ ! -f $1 ] ; then
|
||||
echo File $1 does not exist
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ "x$LSIAPIDIR" = "x" ]; then
|
||||
#if not set the LSIAPIDIR, use the default location
|
||||
LSIAPIDIR=../../
|
||||
fi
|
||||
|
||||
if [ ! -d "$LSIAPIDIR/include" ]; then
|
||||
echo "Directory $LSIAPIDIR/include missing"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGET=`basename $1 .c`
|
||||
echo Target=$TARGET
|
||||
echo
|
||||
|
||||
|
||||
|
||||
|
||||
SYS_NAME=`uname -s`
|
||||
if [ "x$SYS_NAME" = "xDarwin" ] ; then
|
||||
UNDEFINED_FLAG="-undefined dynamic_lookup"
|
||||
else
|
||||
UNDEFINED_FLAG=""
|
||||
fi
|
||||
|
||||
if [ "$TARGET" = "imgresize" ] ; then
|
||||
if [ -e "/usr/local/lib/libgd.a" ] ; then
|
||||
GDLIB="-lgd"
|
||||
else
|
||||
echo "Lib gd is not installed. Cannot use $TARGET without it."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
GDLIB=""
|
||||
fi
|
||||
|
||||
|
||||
gcc -g -Wall -fPIC -c -D_REENTRANT $(getconf LFS_CFLAGS) $TARGET.c -I "$LSIAPIDIR/src" -I "$LSIAPIDIR/include"
|
||||
gcc -g -Wall -fPIC $UNDEFINED_FLAG $(getconf LFS_CFLAGS) -o $TARGET.so $TARGET.o -shared $GDLIB
|
||||
|
||||
if [ -f $(pwd)/$TARGET.so ] ; then
|
||||
echo -e "\033[38;5;71m$TARGET.so created.\033[39m"
|
||||
else
|
||||
echo -e "\033[38;5;203mError, $TARGET.so does not exist, failed.\033[39m"
|
||||
fi
|
||||
|
||||
if [ -f $TARGET.o ] ; then
|
||||
rm $TARGET.o
|
||||
fi
|
||||
|
||||
|
||||
echo Done!
|
||||
echo
|
||||
@@ -1,44 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
|
||||
#define MNAME hellohandler
|
||||
lsi_module_t MNAME;
|
||||
|
||||
|
||||
static char resp_buf[] = "Hello module handler.\r\n";
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
g_api->set_status_code(session, 200);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", 9, LSI_HEADEROP_SET);
|
||||
g_api->append_resp_body(session, resp_buf, sizeof(resp_buf) - 1);
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define a handler, need to provide a struct _handler_st object, in which
|
||||
* the first function pointer should not be NULL
|
||||
*/
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, NULL, &myhandler, NULL };
|
||||
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#define _GNU_SOURCE
|
||||
#include "../include/ls.h"
|
||||
#include <string.h>
|
||||
|
||||
#define MNAME hellohandler2
|
||||
lsi_module_t MNAME;
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if (memmem((const void *)uri, len, (const void *)".345", 4) != NULL)
|
||||
{
|
||||
g_api->register_req_handler(param->session, &MNAME, 0);
|
||||
g_api->log(param->session, LSI_LOG_DEBUG,
|
||||
"[hellohandler2:%s] register_req_handler for URI: %s\n",
|
||||
MNAME.about, uri);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"[hellohandler2:%s] init_module [log in module code]\n",
|
||||
MNAME.about);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static char resp_buf[] = "Hello module handler2.\r\n";
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
g_api->append_resp_body(session, resp_buf, sizeof(resp_buf) - 1);
|
||||
g_api->end_resp(session);
|
||||
g_api->log(session, LSI_LOG_DEBUG,
|
||||
"[hellohandler2:%s] begin_process for URI: %s\n",
|
||||
MNAME.about, g_api->get_req_uri(session, NULL));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
/**
|
||||
* Define a handler, need to provide a struct lsi_reqhdlr_t object, in which
|
||||
* the first function pointer should not be NULL
|
||||
*/
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "v1.0", server_hooks
|
||||
};
|
||||
@@ -1,278 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include "gd.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <lsdef.h>
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* How to test: Access an image dynamically (i.e. with a proxy),
|
||||
* ensuring that the resize dimensions are in the query string.
|
||||
* For example: http://localhost:8088/apple.jpeg?w=400&h=500
|
||||
*
|
||||
***************************************************************/
|
||||
|
||||
enum httpimg
|
||||
{
|
||||
HTTP_IMG_GIF,
|
||||
HTTP_IMG_PNG,
|
||||
HTTP_IMG_JPEG
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME imgresize
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData
|
||||
{
|
||||
ls_loopbuf_t inWBuf;
|
||||
ls_loopbuf_t outWBuf;
|
||||
enum httpimg IMAGE_TYPE;
|
||||
} MyData;
|
||||
|
||||
/*Function Declarations*/
|
||||
static int setWaitFull(lsi_param_t *rec);
|
||||
static int scanForImage(lsi_param_t *rec);
|
||||
static int parseParameters(lsi_param_t *rec, MyData *myData);
|
||||
static int getReqDimensions(const char *buf, int iLen, int *width,
|
||||
int *height);
|
||||
static void *resizeImage(const char *buf, int bufLen, int width,
|
||||
int height, MyData *myData, int *size);
|
||||
static int init_module();
|
||||
|
||||
int httpRelease(void *data)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### mymoduleresize %s\n", "httpRelease");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int httpinit(lsi_param_t *rec)
|
||||
{
|
||||
MyData *myData;
|
||||
ls_xpool_t *pool = g_api->get_session_pool(rec->session);
|
||||
myData = ls_xpool_alloc(pool, sizeof(MyData));
|
||||
ls_loopbuf_x(&myData->inWBuf, MAX_BLOCK_BUFSIZE, pool);
|
||||
ls_loopbuf_x(&myData->outWBuf, MAX_BLOCK_BUFSIZE, pool);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### mymoduleresize init\n");
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)myData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setWaitFull(lsi_param_t *rec)
|
||||
{
|
||||
g_api->set_resp_wait_full_body(rec->session);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
/* Returns 0 for image, 1 for wrong input */
|
||||
static int parseParameters(lsi_param_t *rec, MyData *myData)
|
||||
{
|
||||
int iLen;
|
||||
const char *ptr;
|
||||
struct iovec iov;
|
||||
|
||||
if ((iLen = g_api->get_resp_header(rec->session,
|
||||
LSI_RSPHDR_CONTENT_TYPE, NULL, 0, &iov, 1)) < 1
|
||||
|| iov.iov_len < 9
|
||||
)
|
||||
return 1;
|
||||
|
||||
ptr = (const char *)iov.iov_base;
|
||||
if (memcmp(ptr, "image/", 6) != 0)
|
||||
return 1;
|
||||
|
||||
if (memcmp(ptr + 6, "png", 3) == 0)
|
||||
myData->IMAGE_TYPE = HTTP_IMG_PNG;
|
||||
else if (memcmp(ptr + 6, "gif", 3) == 0)
|
||||
myData->IMAGE_TYPE = HTTP_IMG_GIF;
|
||||
else if (memcmp(ptr + 6, "jpeg", 4) == 0)
|
||||
myData->IMAGE_TYPE = HTTP_IMG_JPEG;
|
||||
else
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*return 0 on success, -1 for garbage queries*/
|
||||
static int getReqDimensions(const char *buf, int iLen, int *width,
|
||||
int *height)
|
||||
{
|
||||
const char *parse, *ptr2, *ptr = buf, *pEnd = buf + iLen;
|
||||
int val = 0;
|
||||
while (ptr < pEnd - 1)
|
||||
{
|
||||
if (*ptr != 'w' && *ptr != 'h')
|
||||
return LS_FAIL;
|
||||
if (*(ptr + 1) != '=')
|
||||
return LS_FAIL;
|
||||
ptr2 = memchr(ptr + 2, '&', (pEnd - ptr) - 2);
|
||||
if (!ptr2)
|
||||
ptr2 = pEnd;
|
||||
for (parse = ptr + 2; parse < ptr2; ++parse)
|
||||
{
|
||||
if (*parse < '0' || *parse > '9')
|
||||
return LS_FAIL;
|
||||
val = val * 10 + (*parse - '0');
|
||||
}
|
||||
if (*ptr == 'w' && *width == 0)
|
||||
*width = val;
|
||||
else if (*ptr == 'h' && *height == 0)
|
||||
*height = val;
|
||||
if (*ptr2 != '&')
|
||||
return 0;
|
||||
val = 0;
|
||||
ptr = ptr2 + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *resizeImage(const char *buf, int bufLen, int width,
|
||||
int height, MyData *myData, int *size)
|
||||
{
|
||||
|
||||
char *ptr = NULL;
|
||||
gdImagePtr dest, src;
|
||||
if (myData->IMAGE_TYPE == HTTP_IMG_JPEG)
|
||||
src = gdImageCreateFromJpegPtr(bufLen, (void *)buf);
|
||||
else if (myData->IMAGE_TYPE == HTTP_IMG_GIF)
|
||||
src = gdImageCreateFromGifPtr(bufLen, (void *)buf);
|
||||
else if (myData->IMAGE_TYPE == HTTP_IMG_PNG)
|
||||
src = gdImageCreateFromPngPtr(bufLen, (void *)buf);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
if (!width && !height)
|
||||
return NULL;
|
||||
else if (!width)
|
||||
width = height * src->sx / src->sy;
|
||||
else if (!height)
|
||||
height = width * src->sy / src->sx;
|
||||
dest = gdImageCreateTrueColor(width, height);
|
||||
|
||||
gdImageCopyResampled(dest, src, 0, 0, 0, 0,
|
||||
width, height,
|
||||
src->sx, src->sy);
|
||||
|
||||
if (myData->IMAGE_TYPE == HTTP_IMG_JPEG)
|
||||
ptr = gdImageJpegPtr(dest, size, 50);
|
||||
else if (myData->IMAGE_TYPE == HTTP_IMG_GIF)
|
||||
ptr = gdImageGifPtr(dest, size);
|
||||
else if (myData->IMAGE_TYPE == HTTP_IMG_PNG)
|
||||
ptr = gdImagePngPtr(dest, size);
|
||||
|
||||
// Ron: and if NONE of the above are true?? returned
|
||||
// uninitialized ptr
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static int scanForImage(lsi_param_t *rec)
|
||||
{
|
||||
off_t offset = 0;
|
||||
int iSrcSize, iDestSize, iWidth = 0, iHeight = 0, iLen = 0;
|
||||
void *pRespBodyBuf, *pSrcBuf, *pDestBuf;
|
||||
const char *ptr, *pDimensions;
|
||||
MyData *myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
ls_xpool_t *pPool = g_api->get_session_pool(rec->session);
|
||||
|
||||
if (parseParameters(rec, myData) == 0)
|
||||
{
|
||||
|
||||
pDimensions = g_api->get_req_query_string(rec->session, &iLen);
|
||||
if ((iLen == 0)
|
||||
|| (getReqDimensions(pDimensions, iLen, &iWidth, &iHeight) != 0)
|
||||
)
|
||||
return LSI_OK;
|
||||
pRespBodyBuf = g_api->get_resp_body_buf(rec->session);
|
||||
if (!pRespBodyBuf)
|
||||
return LSI_OK;
|
||||
iSrcSize = g_api->get_body_buf_size(pRespBodyBuf);
|
||||
pSrcBuf = ls_xpool_alloc(pPool, iSrcSize);
|
||||
while (!g_api->is_body_buf_eof(pRespBodyBuf, offset))
|
||||
{
|
||||
ptr = g_api->acquire_body_buf_block(pRespBodyBuf, offset, &iLen);
|
||||
if (!ptr)
|
||||
break;
|
||||
memcpy(pSrcBuf + offset, ptr, iLen);
|
||||
g_api->release_body_buf_block(pRespBodyBuf, offset);
|
||||
offset += iLen;
|
||||
}
|
||||
}
|
||||
else
|
||||
return LSI_OK;
|
||||
g_api->reset_body_buf(pRespBodyBuf, 1);
|
||||
if (g_api->append_body_buf(pRespBodyBuf, pSrcBuf, iSrcSize) != iSrcSize)
|
||||
return LSI_ERROR;
|
||||
iSrcSize = g_api->get_body_buf_size(pRespBodyBuf);
|
||||
|
||||
pDestBuf = resizeImage(pSrcBuf, iSrcSize, iWidth, iHeight, myData,
|
||||
&iDestSize);
|
||||
if (!pDestBuf)
|
||||
return LSI_ERROR;
|
||||
|
||||
while (g_api->is_resp_buffer_available(rec->session) <= 0);
|
||||
|
||||
|
||||
g_api->reset_body_buf(pRespBodyBuf, 1);
|
||||
if (g_api->append_body_buf(pRespBodyBuf, pDestBuf, iDestSize) != iDestSize)
|
||||
return LSI_ERROR;
|
||||
g_api->set_resp_content_length(rec->session, iDestSize);
|
||||
|
||||
gdFree(pDestBuf);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, httpinit, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, setWaitFull, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_SEND_RESP_HEADER, scanForImage, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, httpRelease, LSI_DATA_HTTP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "imgresize", serverHooks};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <string.h>
|
||||
|
||||
#define MNAME mytest
|
||||
lsi_module_t MNAME;
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if ((len >= 7) && (strncasecmp(uri, "/mytest", 7) == 0))
|
||||
g_api->register_req_handler(param->session, &MNAME, 7);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
g_api->append_resp_body(session, "MyTest!\n", 8);
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_FIRST, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
*
|
||||
* This example is for testing reply a big buffer (20MB)
|
||||
* Since the buffer is so big, we can not append all the reply data
|
||||
* to the response cache.
|
||||
* So on_write event needs to be used to write the remaining data
|
||||
*/
|
||||
|
||||
#define MNAME replybigbufhandler
|
||||
lsi_module_t MNAME;
|
||||
|
||||
static char testuri[] = "/replybigbuf";
|
||||
|
||||
#define REPLY_BUFFER_LENGTH (1*1024*1024)
|
||||
|
||||
|
||||
static int free_mydata(void *data)
|
||||
{
|
||||
// The data is only the size, did not malloc memory, so no free needed
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int disable_compress(lsi_param_t *param)
|
||||
{
|
||||
// To disable compress, set the LSI_FLAG_DECOMPRESS_REQUIRED flag
|
||||
// in the hook.
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if ((len >= sizeof(testuri) - 1)
|
||||
&& (strncasecmp(uri, testuri, sizeof(testuri) - 1) == 0))
|
||||
{
|
||||
g_api->register_req_handler(param->session, &MNAME, sizeof(testuri) - 1);
|
||||
g_api->set_module_data(param->session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)REPLY_BUFFER_LENGTH);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
g_api->init_module_data(module, free_mydata, LSI_DATA_HTTP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// begin_process will be called the first time,
|
||||
// then on_write will be called next and next.
|
||||
static char txt1[] = "replybigbufhandler module reply the first line\r\n";
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", 9, LSI_HEADEROP_SET);
|
||||
int size = sizeof(txt1) - 1;
|
||||
long left = (long)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
g_api->append_resp_body(session, txt1, size);
|
||||
left -= size;
|
||||
g_api->set_module_data(session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)left);
|
||||
g_api->flush(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// return 0: error, 1: done, 2: not finished, definitions are in ls.h
|
||||
static int on_write(const lsi_session_t *session)
|
||||
{
|
||||
#define _BLOCK_SIZE (1024)
|
||||
int i;
|
||||
char buf[_BLOCK_SIZE] = {0};
|
||||
int size = 0;
|
||||
long left = (long)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
|
||||
while (left > 0 && g_api->is_resp_buffer_available(session))
|
||||
{
|
||||
for (i = 0; i < _BLOCK_SIZE; ++i)
|
||||
buf[i] = 'A' + rand() % 52;
|
||||
size = ((left > _BLOCK_SIZE) ? _BLOCK_SIZE : left);
|
||||
g_api->append_resp_body(session, buf, size);
|
||||
left -= size;
|
||||
}
|
||||
g_api->set_module_data(session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)left);
|
||||
if (left == 0)
|
||||
g_api->append_resp_body(session, "\r\nEnd\r\n", 7);
|
||||
|
||||
return (left > 0) ? LSI_RSP_MORE : LSI_RSP_DONE;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_RCVD_RESP_BODY, disable_compress, LSI_HOOK_NORMAL, LSI_FLAG_DECOMPRESS_REQUIRED | LSI_FLAG_ENABLED },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
lsi_reqhdlr_t myhandler = { begin_process, NULL, on_write, NULL };
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<p> <p>Test Get method:
|
||||
<form action="/reqinfo/testget" method="get">
|
||||
First value: <input type="text" name="fvalue"><br>
|
||||
Last value: <input type="text" name="lvalue"><br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
<p><p>Test post method echo
|
||||
<form action="/reqinfo/echo" method="post">
|
||||
First value: <input type="text" name="fvalue"><br>
|
||||
Last value: <input type="text" name="lvalue"><br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
<p><p>Test post method md5
|
||||
<form action="/reqinfo/md5" method="post">
|
||||
First value: <input type="text" name="fvalue"><br>
|
||||
Last value: <input type="text" name="lvalue"><br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
<p><p>Test post method upload
|
||||
<form action="/reqinfo/upload" method="post">
|
||||
First value: <input type="text" name="fvalue"><br>
|
||||
Last value: <input type="text" name="lvalue"><br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p><p>Test post a file and echo the whole request body
|
||||
<form method="post" action="/reqinfo/echo" name="submit" enctype="multipart/form-data">
|
||||
<input type="file" name="fileField"><br /><br />
|
||||
<input type="submit" name="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<p><p>Test post a file and calculate the request body's md5
|
||||
<form method="post" action="/reqinfo/md5" name="submit" enctype="multipart/form-data">
|
||||
<input type="file" name="fileField"><br /><br />
|
||||
<input type="submit" name="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
<p><p>Test post a file and save file to /tmp/uploadfile
|
||||
<form method="post" action="/reqinfo/upload" name="submit" enctype="multipart/form-data">
|
||||
<input type="file" name="fileField"><br /><br />
|
||||
<input type="submit" name="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,513 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <openssl/md5.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
*
|
||||
* How to test this sample
|
||||
* 1, build it, put the file reqinfhandler.so in $LSWS_HOME/modules
|
||||
* 2, in web admin console configuration, enable this module
|
||||
* 3, visit http(s)://.../reqinfo(/echo|/md5|/upload) with/without request body
|
||||
*/
|
||||
|
||||
#define MNAME reqinfhandler
|
||||
lsi_module_t MNAME;
|
||||
|
||||
static char testuri[] = "/reqinfo";
|
||||
|
||||
#define CONTENT_HEAD "<html><head><title>Server request varibles</title></head><body>\r\n"
|
||||
#define CONTENT_FORMAT "<tr><td>%s</td><td>%s</td></tr>\r\n"
|
||||
#define CONTENT_TAIL "</body></html>\r\n"
|
||||
|
||||
typedef struct mydata_s
|
||||
{
|
||||
int type;
|
||||
FILE *fp;
|
||||
MD5_CTX ctx;
|
||||
int req_body_len; // length in "Content-Length"
|
||||
int rcvd_req_body_len; // recved
|
||||
int rcvd_done; // finished or due to connection error
|
||||
int resp_done;
|
||||
} mydata_t;
|
||||
|
||||
// The following matches the index, DO NOT change the order
|
||||
const char *req_array[] =
|
||||
{
|
||||
"REMOTE_ADDR",
|
||||
"REMOTE_PORT",
|
||||
"REMOTE_HOST",
|
||||
"REMOTE_USER",
|
||||
"REMOTE_IDENT",
|
||||
"REQUEST_METHOD",
|
||||
"QUERY_STRING",
|
||||
"AUTH_TYPE",
|
||||
"PATH_INFO",
|
||||
"SCRIPT_FILENAME",
|
||||
"REQUEST_FILENAME",
|
||||
"REQUEST_URI",
|
||||
"DOCUMENT_ROOT",
|
||||
"SERVER_ADMIN",
|
||||
"SERVER_NAME",
|
||||
"SERVER_ADDR",
|
||||
"SERVER_PORT",
|
||||
"SERVER_PROTOCOL",
|
||||
"SERVER_SOFTWARE",
|
||||
"API_VERSION",
|
||||
"THE_REQUEST",
|
||||
"IS_SUBREQ",
|
||||
"TIME",
|
||||
"TIME_YEAR",
|
||||
"TIME_MON",
|
||||
"TIME_DAY",
|
||||
"TIME_HOUR",
|
||||
"TIME_MIN",
|
||||
"TIME_SEC",
|
||||
"TIME_WDAY",
|
||||
"SCRIPT_NAME",
|
||||
"CURRENT_URI",
|
||||
"REQUEST_BASENAME",
|
||||
"SCRIPT_UID",
|
||||
"SCRIPT_GID",
|
||||
"SCRIPT_USERNAME",
|
||||
"SCRIPT_GROUPNAME",
|
||||
"SCRIPT_MODE",
|
||||
"SCRIPT_BASENAME",
|
||||
"SCRIPT_URI",
|
||||
"ORG_REQ_URI",
|
||||
"HTTPS",
|
||||
"SSL_VERSION",
|
||||
"SSL_SESSION_ID",
|
||||
"SSL_CIPHER",
|
||||
"SSL_CIPHER_USEKEYSIZE",
|
||||
"SSL_CIPHER_ALGKEYSIZE",
|
||||
"SSL_CLIENT_CERT",
|
||||
"GEOIP_ADDR",
|
||||
"PATH_TRANSLATED",
|
||||
};
|
||||
|
||||
// The following is used by name value, you can change the order
|
||||
const char *env_array[] =
|
||||
{
|
||||
"PATH",
|
||||
|
||||
"REMOTE_ADDR",
|
||||
"REMOTE_PORT",
|
||||
"REMOTE_HOST",
|
||||
"REMOTE_USER",
|
||||
"REMOTE_IDENT",
|
||||
"REQUEST_METHOD",
|
||||
"QUERY_STRING",
|
||||
"AUTH_TYPE",
|
||||
"PATH_INFO",
|
||||
"SCRIPT_FILENAME",
|
||||
"REQUEST_FILENAME",
|
||||
"REQUEST_URI",
|
||||
"DOCUMENT_ROOT",
|
||||
"SERVER_ADMIN",
|
||||
"SERVER_NAME",
|
||||
"SERVER_ADDR",
|
||||
"SERVER_PORT",
|
||||
"SERVER_PROTOCOL",
|
||||
"SERVER_SOFTWARE",
|
||||
"API_VERSION",
|
||||
"THE_REQUEST",
|
||||
"IS_SUBREQ",
|
||||
"TIME",
|
||||
"TIME_YEAR",
|
||||
"TIME_MON",
|
||||
"TIME_DAY",
|
||||
"TIME_HOUR",
|
||||
"TIME_MIN",
|
||||
"TIME_SEC",
|
||||
"TIME_WDAY",
|
||||
"SCRIPT_NAME",
|
||||
"CURRENT_URI",
|
||||
"REQUEST_BASENAME",
|
||||
"SCRIPT_UID",
|
||||
"SCRIPT_GID",
|
||||
"SCRIPT_USERNAME",
|
||||
"SCRIPT_GROUPNAME",
|
||||
"SCRIPT_MODE",
|
||||
"SCRIPT_BASENAME",
|
||||
"SCRIPT_URI",
|
||||
"ORG_REQ_URI",
|
||||
"HTTPS",
|
||||
"SSL_VERSION",
|
||||
"SSL_SESSION_ID",
|
||||
"SSL_CIPHER",
|
||||
"SSL_CIPHER_USEKEYSIZE",
|
||||
"SSL_CIPHER_ALGKEYSIZE",
|
||||
"SSL_CLIENT_CERT",
|
||||
"GEOIP_ADDR",
|
||||
"PATH_TRANSLATED",
|
||||
};
|
||||
|
||||
const char *reqhdr_array[] =
|
||||
{
|
||||
"Accept",
|
||||
"Accept-Charset",
|
||||
"Accept-Encoding",
|
||||
"Accept-Language",
|
||||
"Accept-Datetime",
|
||||
"Authorization",
|
||||
"Cache-Control",
|
||||
"Connection",
|
||||
"Content-Type",
|
||||
"Content-Length",
|
||||
"Content-MD5",
|
||||
"Cookie",
|
||||
"Date",
|
||||
"Expect",
|
||||
"From",
|
||||
"Host",
|
||||
"Pragma",
|
||||
"Proxy-Authorization"
|
||||
"If-Match",
|
||||
"If-Modified-Since",
|
||||
"If-None-Match",
|
||||
"If-Range",
|
||||
"If-Unmodified-Since",
|
||||
"Max-Forwards",
|
||||
"Origin",
|
||||
"Referer",
|
||||
"User-Agent",
|
||||
"Range",
|
||||
"Upgrade",
|
||||
"Via",
|
||||
"X-Forwarded-For",
|
||||
};
|
||||
|
||||
|
||||
static int free_mydata(void *data)
|
||||
{
|
||||
mydata_t *mydata = (mydata_t *)data;
|
||||
if (mydata != NULL)
|
||||
{
|
||||
// free (mydata); Do not need to free with session pool,
|
||||
// will be freed at the end of the session.
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### reqinfomodule free_mydata\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int initdata(lsi_param_t *param)
|
||||
{
|
||||
mydata_t *mydata = (mydata_t *)g_api->get_module_data(param->session,
|
||||
&MNAME, LSI_DATA_HTTP);
|
||||
ls_xpool_t *pPool = g_api->get_session_pool(param->session);
|
||||
mydata = (mydata_t *)ls_xpool_alloc(pPool, sizeof(mydata_t));
|
||||
memset(mydata, 0, sizeof(mydata_t));
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### reqinfomodule initdata\n");
|
||||
g_api->set_module_data(param->session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)mydata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// 0:no body or no deal, 1,echo, 2: md5, 3, save to file
|
||||
static int get_reqbody_dealertype(const lsi_session_t *session)
|
||||
{
|
||||
char path[512];
|
||||
int n;
|
||||
if (g_api->get_req_content_length(session) > 0)
|
||||
{
|
||||
n = g_api->get_req_var_by_id(session, LSI_VAR_PATH_INFO, path, 512);
|
||||
if (n >= 5 && strncasecmp(path, "/echo", 5) == 0)
|
||||
return 1;
|
||||
else if (n >= 4 && strncasecmp(path, "/md5", 4) == 0)
|
||||
return 2;
|
||||
else if (n >= 7 && strncasecmp(path, "/upload", 7) == 0)
|
||||
return 3;
|
||||
}
|
||||
|
||||
// All other cases, no deal
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void append(const lsi_session_t *session, const char *s, int n)
|
||||
{
|
||||
if (n == 0)
|
||||
n = strlen(s);
|
||||
g_api->append_resp_body(session, (char *)s, n);
|
||||
}
|
||||
|
||||
|
||||
static int on_read(const lsi_session_t *session)
|
||||
{
|
||||
unsigned char md5[16];
|
||||
char buf[8192];
|
||||
int ret, i;
|
||||
int readbytes = 0, written = 0;
|
||||
mydata_t *mydata = (mydata_t *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
if (mydata == NULL || mydata->type == 0)
|
||||
{
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((ret = g_api->read_req_body(session, buf, sizeof(buf))) > 0)
|
||||
{
|
||||
mydata->rcvd_req_body_len += ret;
|
||||
readbytes += ret;
|
||||
|
||||
if (mydata->type == 1)
|
||||
{
|
||||
append(session, buf, ret);
|
||||
written += ret;
|
||||
}
|
||||
else if (mydata->type == 2)
|
||||
MD5_Update(&mydata->ctx, buf, ret);
|
||||
else
|
||||
fwrite(buf, 1, ret, mydata->fp);
|
||||
|
||||
if (mydata->rcvd_req_body_len >= mydata->req_body_len)
|
||||
{
|
||||
mydata->rcvd_done = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ret == 0)
|
||||
mydata->rcvd_done = 1;
|
||||
|
||||
if (mydata->rcvd_done == 1)
|
||||
{
|
||||
if (mydata->type == 2)
|
||||
{
|
||||
MD5_Final(md5, &mydata->ctx);
|
||||
for (i = 0; i < 16; ++i)
|
||||
sprintf(buf + i * 2, "%02X", md5[i]);
|
||||
append(session, "MD5 is<br>", 10);
|
||||
append(session, buf, 32);
|
||||
written += 42;
|
||||
}
|
||||
else if (mydata->type == 3)
|
||||
{
|
||||
if (mydata->fp != NULL)
|
||||
{
|
||||
fclose(mydata->fp);
|
||||
mydata->fp = NULL;
|
||||
append(session, "File uploaded.<br>", 18);
|
||||
written += 18;
|
||||
}
|
||||
}
|
||||
mydata->resp_done = 1;
|
||||
}
|
||||
|
||||
if (written > 0)
|
||||
g_api->flush(session);
|
||||
g_api->set_handler_write_state(session, 1);
|
||||
//g_api->end_resp(session);
|
||||
return readbytes;
|
||||
}
|
||||
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
#define VALMAXSIZE 4096
|
||||
#define LINEMAXSIZE (VALMAXSIZE + 50)
|
||||
char val[VALMAXSIZE], line[LINEMAXSIZE] = {0};
|
||||
int n;
|
||||
int i;
|
||||
const char *p;
|
||||
char *buf;
|
||||
mydata_t *mydata = (mydata_t *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
ls_xpool_t *pPool = g_api->get_session_pool(session);
|
||||
|
||||
//Create response body
|
||||
append(session, CONTENT_HEAD, 0);
|
||||
|
||||
//Original request header
|
||||
n = g_api->get_req_raw_headers_length(session);
|
||||
buf = (char *)ls_xpool_alloc(pPool, n + 1);
|
||||
memset(buf, 0, n + 1);
|
||||
n = g_api->get_req_raw_headers(session, buf, n + 1);
|
||||
append(session, "Original request<table border=1><tr><td><pre>\r\n", 0);
|
||||
append(session, buf, n);
|
||||
append(session, "\r\n</pre></td></tr>\r\n", 0);
|
||||
ls_xpool_free(pPool, buf);
|
||||
|
||||
append(session, "\r\n</table><br>Request headers<br><table border=1>\r\n",
|
||||
0);
|
||||
for (i = 0; i < sizeof(reqhdr_array) / sizeof(char *); ++i)
|
||||
{
|
||||
p = g_api->get_req_header(session, reqhdr_array[i],
|
||||
strlen(reqhdr_array[i]), &n);
|
||||
if ((p != NULL) && p[0] != 0 && n > 0)
|
||||
{
|
||||
memcpy(val, p, n);
|
||||
val[n] = '\0';
|
||||
n = snprintf(line, LINEMAXSIZE - 1, CONTENT_FORMAT, reqhdr_array[i],
|
||||
val);
|
||||
append(session, line, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
append(session,
|
||||
"\r\n</table><br>Server req env<br><table border=1>\r\n", 0);
|
||||
//Server req env
|
||||
for (i = LSI_VAR_REMOTE_ADDR; i < LSI_VAR_COUNT; ++i)
|
||||
{
|
||||
n = g_api->get_req_var_by_id(session, i, val, VALMAXSIZE);
|
||||
if (n > 0)
|
||||
{
|
||||
val[n] = '\0';
|
||||
n = snprintf(line, LINEMAXSIZE - 1, CONTENT_FORMAT, req_array[i],
|
||||
val);
|
||||
append(session, line, n);
|
||||
}
|
||||
}
|
||||
|
||||
append(session, "\r\n</table><br>env varibles<br><table border=1>\r\n", 0);
|
||||
for (i = 0; i < sizeof(env_array) / sizeof(char *); ++i)
|
||||
{
|
||||
//env varibles
|
||||
n = g_api->get_req_env(session, env_array[i], strlen(env_array[i]), val,
|
||||
VALMAXSIZE);
|
||||
if (n > 0)
|
||||
{
|
||||
val[n] = '\0';
|
||||
n = snprintf(line, LINEMAXSIZE - 1, CONTENT_FORMAT, env_array[i],
|
||||
val);
|
||||
append(session, line, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p = g_api->get_req_cookies(session, &n);
|
||||
if ((p != NULL) && p[0] != 0 && n > 0)
|
||||
{
|
||||
append(session,
|
||||
"\r\n</table><br>Request cookies<br><table border=1>\r\n", 0);
|
||||
append(session, "<tr><td>Cookie</td><td>", 0);
|
||||
append(session, p, n);
|
||||
append(session, "</td></tr>", 0);
|
||||
}
|
||||
|
||||
n = g_api->get_req_cookie_count(session);
|
||||
if (n > 0)
|
||||
{
|
||||
//try get a certen cookie
|
||||
p = g_api->get_cookie_value(session, "LSWSWEBUI", 9, &n);
|
||||
if ((p != NULL) && n > 0)
|
||||
{
|
||||
append(session, "<tr><td>cookie_LSWSWEBUI</td><td>", 0);
|
||||
append(session, p, n);
|
||||
append(session, "</td></tr>", 0);
|
||||
}
|
||||
}
|
||||
append(session, "</table>", 0);
|
||||
|
||||
n = get_reqbody_dealertype(session);
|
||||
|
||||
mydata->req_body_len = g_api->get_req_content_length(session);
|
||||
mydata->rcvd_req_body_len = 0;
|
||||
mydata->type = n;
|
||||
sprintf(line,
|
||||
"Will deal with the req body.Type = %d, req body lenghth = %d<br>",
|
||||
n, mydata->req_body_len);
|
||||
|
||||
append(session, line, 0);
|
||||
if (mydata->type == 0)
|
||||
{
|
||||
append(session, CONTENT_TAIL, 0);
|
||||
mydata->rcvd_done = 1;
|
||||
mydata->resp_done = 1;
|
||||
}
|
||||
|
||||
g_api->set_status_code(session, 200);
|
||||
|
||||
if (mydata->type == 3) // Save to file
|
||||
mydata->fp = fopen("/tmp/uploadfile", "wb");
|
||||
else if (mydata->type == 2) // Md5
|
||||
MD5_Init(&mydata->ctx);
|
||||
|
||||
g_api->flush(session);
|
||||
|
||||
// if ( mydata->type != 0)
|
||||
on_read(session);
|
||||
|
||||
//g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int on_write(const lsi_session_t *session)
|
||||
{
|
||||
mydata_t *mydata = (mydata_t *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
return (mydata == NULL || mydata->type == 0 || mydata->resp_done == 1) ?
|
||||
LSI_RSP_DONE : LSI_RSP_MORE;
|
||||
}
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if ((uri != NULL) && (len >= sizeof(testuri) - 1)
|
||||
&& (strncasecmp(uri, testuri, sizeof(testuri) - 1) == 0))
|
||||
g_api->register_req_handler(param->session, &MNAME, sizeof(testuri) - 1);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
g_api->init_module_data(module, free_mydata, LSI_DATA_HTTP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int clean_up(const lsi_session_t *session)
|
||||
{
|
||||
g_api->free_module_data(session, &MNAME, LSI_DATA_HTTP,
|
||||
free_mydata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_HTTP_BEGIN, initdata, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
//{ LSI_HKPT_HTTP_END, resetdata, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, on_read, on_write, clean_up };
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#define _GNU_SOURCE
|
||||
#include "../include/ls.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
*
|
||||
* How to test this sample
|
||||
* 1, Build the module, put reqobservmodule.so in $LSWS_HOME/modules
|
||||
* 2, Create a file with the bad words.
|
||||
* 3, Run curl and upload the file and access a dynamically generated page,
|
||||
* curl -F "file=@/home/.../filewithbadwords" http://localhost:8088/phpinfo.php
|
||||
* 4, If filewithbadwords contain at least one word in blockWords,
|
||||
* will get 403, otherwise will get 200
|
||||
*/
|
||||
|
||||
#define MNAME reqobservmodule
|
||||
lsi_module_t MNAME;
|
||||
|
||||
// Test if the request body contains below words, if so 403
|
||||
const char *block_words[] =
|
||||
{
|
||||
"badword1",
|
||||
"badword2",
|
||||
"badword3",
|
||||
};
|
||||
|
||||
lsi_module_t MNAME;
|
||||
|
||||
|
||||
static int has_bad_word(const char *s, size_t len)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
for (i = 0; i < sizeof(block_words) / sizeof(char *); ++i)
|
||||
{
|
||||
if (memmem(s, len, block_words[i], strlen(block_words[i])) != NULL)
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int check_req_whole_body(lsi_param_t *param)
|
||||
{
|
||||
off_t offset = 0;
|
||||
const char *pbuf;
|
||||
int len = 0;
|
||||
int ret ;
|
||||
void *preqbodybuf = g_api->get_req_body_buf(param->session);
|
||||
while (!g_api->is_body_buf_eof(preqbodybuf, offset))
|
||||
{
|
||||
pbuf = g_api->acquire_body_buf_block(preqbodybuf, offset, &len);
|
||||
if (pbuf == NULL)
|
||||
break;
|
||||
// this is for demonstration purpose, if bad words is at
|
||||
// the block boundery, will not be detected.
|
||||
// you should do better in a real-world application.
|
||||
ret = has_bad_word(pbuf, len);
|
||||
g_api->release_body_buf_block(preqbodybuf, offset);
|
||||
if (ret != 0)
|
||||
return LSI_ERROR;
|
||||
offset += len;
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_BODY, check_req_whole_body, LSI_HOOK_EARLY, LSI_FLAG_ENABLED },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
*/
|
||||
|
||||
#define MNAME sendfilehandler
|
||||
lsi_module_t MNAME;
|
||||
|
||||
static char testuri[] = "/sendfile";
|
||||
|
||||
|
||||
static int dummycall(lsi_param_t *param)
|
||||
{
|
||||
const char *in = (const char *)param->ptr1;
|
||||
int len = param->len1;
|
||||
int sent = g_api->stream_write_next(param, in, len);
|
||||
return sent;
|
||||
}
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if ((len >= sizeof(testuri) - 1)
|
||||
&& (strncasecmp(uri, testuri, sizeof(testuri) - 1) == 0))
|
||||
g_api->register_req_handler(param->session, &MNAME, sizeof(testuri) - 1);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
struct stat sb;
|
||||
const char *file = "/home/user/ls0312/DEFAULT/html/test1";
|
||||
off_t off = 0;
|
||||
off_t sz = -1; //-1 set to send all data
|
||||
struct iovec vec[5] =
|
||||
{
|
||||
{"123\r\n", 5}, {"123 ", 4}, {"523", 3}, {"---", 3}, {"1235\r\n", 6}
|
||||
};
|
||||
static char txthello[] = "Hi, test send file\r\n";
|
||||
static char txterror[] = "Sorry, send file error\r\n";
|
||||
static char txtlast[] = "<p>The LAST<p>\r\n";
|
||||
|
||||
g_api->append_resp_body(session, txthello, sizeof(txthello) - 1);
|
||||
g_api->append_resp_bodyv(session, vec, 5);
|
||||
|
||||
if (stat(file, &sb) == 0)
|
||||
sz = sb.st_size - 5;
|
||||
|
||||
if (g_api->send_file(session, file, off, sz) < 0)
|
||||
g_api->append_resp_body(session, txterror, sizeof(txterror) - 1);
|
||||
|
||||
g_api->append_resp_body(session, txtlast, sizeof(txtlast) - 1);
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
//{ LSI_HKPT_SEND_RESP_BODY, dummycall, LSI_HOOK_NORMAL, 0 },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
*
|
||||
* HOW TO TEST:
|
||||
* Go to any url with the query string:
|
||||
* ?setrespheader[0123], then you will get different response headers
|
||||
*
|
||||
* Tests:
|
||||
* mycb - The 1 bit in the query string is set.
|
||||
* Is an example of setting a response header.
|
||||
* If 1 bit is not set, it is an example of removing a session hook.
|
||||
* mycb2 - The 2 bit in the query string is set.
|
||||
* Is an example of setting a response header.
|
||||
* mycb3 - The 4 bit is set. Is an example of removing response headers.
|
||||
* mycb4 - The 8 bit is set. Is an example of getting response headers.
|
||||
*/
|
||||
|
||||
#define MNAME setrespheader
|
||||
lsi_module_t MNAME;
|
||||
|
||||
static char testurl[] = "setrespheader";
|
||||
|
||||
const char *headers[2] =
|
||||
{
|
||||
"Set-Cookie",
|
||||
"Addheader"
|
||||
};
|
||||
|
||||
const int numheaders = sizeof(headers) / sizeof(headers[0]);
|
||||
|
||||
|
||||
//test changing resp header
|
||||
static int mycb(lsi_param_t *rec)
|
||||
{
|
||||
g_api->set_resp_header(rec->session, LSI_RSPHDR_SERVER, NULL, 0,
|
||||
"/testServer 1.0", sizeof("/testServer 1.0") - 1, LSI_HEADEROP_SET);
|
||||
g_api->set_resp_header(rec->session, LSI_RSPHDR_SET_COOKIE, NULL, 0,
|
||||
"An Example Cookie", sizeof("An Example Cookie") - 1, LSI_HEADEROP_ADD);
|
||||
g_api->set_resp_header(rec->session, LSI_RSPHDR_SET_COOKIE, NULL, 0,
|
||||
"1 bit set!", sizeof("1 bit set!") - 1, LSI_HEADEROP_ADD);
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### mymodule1 test %s\n", "myCb");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//test changing resp header
|
||||
static int mycb2(lsi_param_t *rec)
|
||||
{
|
||||
g_api->set_resp_header2(rec->session, "Addheader: 2 bit set!\r\n",
|
||||
sizeof("Addheader: 2 bit set!\r\n") - 1, LSI_HEADEROP_SET);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int mycb3(lsi_param_t *rec)
|
||||
{
|
||||
|
||||
g_api->set_resp_header2(rec->session,
|
||||
"Destructheader: 4 bit set! Removing other headers...\r\n",
|
||||
sizeof("Destructheader: 4 bit set! Removing other headers...\r\n") - 1,
|
||||
LSI_HEADEROP_ADD);
|
||||
g_api->remove_resp_header(rec->session, LSI_RSPHDR_SET_COOKIE, NULL,
|
||||
0);
|
||||
g_api->remove_resp_header(rec->session, -1, "Addheader",
|
||||
sizeof("Addheader") - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int mycb4(lsi_param_t *rec)
|
||||
{
|
||||
int i, j, iov_count = g_api->get_resp_headers_count(rec->session);
|
||||
struct iovec iov_key[iov_count], iov_val[iov_count];
|
||||
memset(iov_key, 0, sizeof(struct iovec) * iov_count);
|
||||
memset(iov_val, 0, sizeof(struct iovec) * iov_count);
|
||||
|
||||
g_api->set_resp_header2(rec->session,
|
||||
"ProtectorHeader: 8 bit set! Duplicating headers for potential removal!\r\n",
|
||||
sizeof("ProtectorHeader: 8 bit set! Duplicating headers for potential removal!\r\n")
|
||||
- 1, LSI_HEADEROP_ADD);
|
||||
iov_count = g_api->get_resp_headers(rec->session, iov_key, iov_val,
|
||||
iov_count);
|
||||
for (i = iov_count - 1; i >= 0; --i)
|
||||
{
|
||||
for (j = 0; j < numheaders; ++j)
|
||||
{
|
||||
if (strncmp(headers[j], (const char *)iov_key[i].iov_base,
|
||||
iov_key[i].iov_len) == 0)
|
||||
{
|
||||
char save[256];
|
||||
sprintf(save, "SavedHeader: %.*s\r\n",
|
||||
iov_val[i].iov_len, (char *)iov_val[i].iov_base
|
||||
);
|
||||
g_api->set_resp_header2(rec->session, save, strlen(save),
|
||||
LSI_HEADEROP_ADD);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int check_type(lsi_param_t *rec)
|
||||
{
|
||||
const char *qs;
|
||||
int sessionHookType = 0;
|
||||
qs = g_api->get_req_query_string(rec->session, NULL);
|
||||
sessionHookType = strtol(qs + sizeof(testurl) - 1, NULL, 10);
|
||||
if (sessionHookType & 0x01)
|
||||
mycb(rec);
|
||||
if (sessionHookType & 0x02)
|
||||
mycb2(rec);
|
||||
if (sessionHookType & 0x08)
|
||||
mycb4(rec);
|
||||
if (sessionHookType & 0x04)
|
||||
mycb3(rec);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
int check_if_remove_session_hook(lsi_param_t *rec)
|
||||
{
|
||||
const char *qs;
|
||||
int sessionHookType = 0;
|
||||
int iEnableHkpt = LSI_HKPT_SEND_RESP_HEADER;
|
||||
qs = g_api->get_req_query_string(rec->session, NULL);
|
||||
if (qs && strncasecmp(qs, testurl, sizeof(testurl) - 1) == 0)
|
||||
{
|
||||
sessionHookType = strtol(qs + sizeof(testurl) - 1, NULL, 10);
|
||||
if (sessionHookType & 0x0f)
|
||||
g_api->enable_hook(rec->session, &MNAME, 1,
|
||||
&iEnableHkpt, 1);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, check_if_remove_session_hook, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_SEND_RESP_HEADER, check_type, LSI_HOOK_NORMAL, 0 },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsdef.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define MNAME testcontext
|
||||
lsi_module_t MNAME;
|
||||
|
||||
/** This module demonstrates how to assign specific contexts to module handlers
|
||||
*
|
||||
* After compiling the module with the ccc.sh script, move this module into
|
||||
* the $SERVERROOT/modules directory.
|
||||
*
|
||||
* In the server configuration, enable the module "testcontext"
|
||||
*
|
||||
* In a virtual host, for example, the Example virtual host, change the vhost
|
||||
* configuration to include a context "/testcon*" handled by this module:
|
||||
context /testcon*{
|
||||
type module
|
||||
handler testcontext
|
||||
}
|
||||
* Start the server, and if everything was done correctly, access any page
|
||||
* matching that context, i.e.
|
||||
* http://localhost:8088/testconThisShouldBeTheOutput
|
||||
*
|
||||
* The response should say something like:
|
||||
* The wildcard matched: ThisShouldBeTheOutput
|
||||
*
|
||||
*/
|
||||
|
||||
static const char *pPrefix = "/testcon";
|
||||
|
||||
const int maxOutLen = 1024;
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
const char *uri;
|
||||
char out[maxOutLen];
|
||||
int iUriLen, iOutLen;
|
||||
g_api->set_status_code(session, 200);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", 9, LSI_HEADEROP_SET);
|
||||
uri = g_api->get_req_uri(session, &iUriLen);
|
||||
if (memcmp(uri, pPrefix, strlen(pPrefix)) != 0)
|
||||
return LS_FAIL;
|
||||
|
||||
iOutLen = snprintf(out, maxOutLen, "The wildcard matched: %s\n",
|
||||
uri + strlen(pPrefix));
|
||||
g_api->append_resp_body(session, out, iOutLen);
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, NULL, &myhandler, NULL };
|
||||
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <ls.h>
|
||||
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* This module tests setting the enable flag during the session.
|
||||
* It is recommended to use this along with testenableflag 2, 3, and 4.
|
||||
*
|
||||
* This one tests: Disabling statically enabled callback functions.
|
||||
*
|
||||
* To test: After compiling and installing this module, access a dynamically
|
||||
* processed page.
|
||||
*
|
||||
* i.e. curl -i http://localhost:8088/phpinfo.php
|
||||
*/
|
||||
|
||||
#define MNAME testenableflag1
|
||||
lsi_module_t MNAME;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#define VERSION "V1.0"
|
||||
|
||||
static int addoutput(lsi_param_t *rec, const char *level)
|
||||
{
|
||||
int len = 0, lenNew;
|
||||
char *pBuf;
|
||||
if (rec->len1 <= 0)
|
||||
return g_api->stream_write_next(rec, rec->ptr1, rec->len1);
|
||||
pBuf = ls_xpool_alloc(g_api->get_session_pool(rec->session),
|
||||
rec->len1 + strlen(level) + 1);
|
||||
snprintf(pBuf, rec->len1 + strlen(level) + 1, "%.*s%.*s",
|
||||
rec->len1, (const char *)rec->ptr1, strlen(level) + 1, level);
|
||||
lenNew = rec->len1 + strlen(level);
|
||||
len = g_api->stream_write_next(rec, pBuf, lenNew);
|
||||
if (len < lenNew)
|
||||
*rec->flag_out = LSI_CBFO_BUFFERED;
|
||||
if (len < rec->len1)
|
||||
return len;
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static int addrecvresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "RECV1: If this appears, something is wrong.\n"); }
|
||||
|
||||
|
||||
static int addsendresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "SEND1: If this appears, something is wrong.\n"); }
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int aEnableHkpts[] = {LSI_HKPT_RECV_RESP_BODY, LSI_HKPT_SEND_RESP_BODY};
|
||||
g_api->enable_hook(rec->session, &MNAME, 0,
|
||||
aEnableHkpts, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{
|
||||
LSI_HKPT_RECV_RESP_BODY, addrecvresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_ENABLED | LSI_FLAG_TRANSFORM
|
||||
},
|
||||
{
|
||||
LSI_HKPT_SEND_RESP_BODY, addsendresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_ENABLED | LSI_FLAG_TRANSFORM
|
||||
},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
MNAME.about = VERSION; //set version string
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,96 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <ls.h>
|
||||
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* This module tests setting the enable flag during the session.
|
||||
* It is recommended to use this along with testenableflag 1, 3, and 4.
|
||||
*
|
||||
* This one tests: Enabling statically disabled callback functions.
|
||||
*
|
||||
* To test: After compiling and installing this module, access a dynamically
|
||||
* processed page.
|
||||
*
|
||||
* i.e. curl -i http://localhost:8088/phpinfo.php
|
||||
*/
|
||||
|
||||
#define MNAME testenableflag2
|
||||
lsi_module_t MNAME;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#define VERSION "V1.0"
|
||||
|
||||
static int addoutput(lsi_param_t *rec, const char *level)
|
||||
{
|
||||
int len = 0, lenNew;
|
||||
char *pBuf;
|
||||
if (rec->len1 <= 0)
|
||||
return g_api->stream_write_next(rec, rec->ptr1, rec->len1);
|
||||
pBuf = ls_xpool_alloc(g_api->get_session_pool(rec->session),
|
||||
rec->len1 + strlen(level) + 1);
|
||||
snprintf(pBuf, rec->len1 + strlen(level) + 1, "%.*s%.*s",
|
||||
rec->len1, (const char *)rec->ptr1, strlen(level) + 1, level);
|
||||
lenNew = rec->len1 + strlen(level);
|
||||
len = g_api->stream_write_next(rec, pBuf, lenNew);
|
||||
if (len < lenNew)
|
||||
*rec->flag_out = LSI_CBFO_BUFFERED;
|
||||
if (len < rec->len1)
|
||||
return len;
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static int addrecvresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "RECV2: If this appears, good.\n"); }
|
||||
|
||||
|
||||
static int addsendresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "SEND2: If this appears, good.\n"); }
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int aEnableHkpts[] = {LSI_HKPT_RECV_RESP_BODY, LSI_HKPT_SEND_RESP_BODY};
|
||||
g_api->enable_hook(rec->session, &MNAME, 1,
|
||||
aEnableHkpts, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{
|
||||
LSI_HKPT_RECV_RESP_BODY, addrecvresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_TRANSFORM
|
||||
},
|
||||
{
|
||||
LSI_HKPT_SEND_RESP_BODY, addsendresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_TRANSFORM
|
||||
},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
MNAME.about = VERSION; //set version string
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,96 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <ls.h>
|
||||
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* This module tests setting the enable flag during the session.
|
||||
* It is recommended to use this along with testenableflag 1, 2, and 4.
|
||||
*
|
||||
* This one tests: Enabling statically enabled callback functions.
|
||||
*
|
||||
* To test: After compiling and installing this module, access a dynamically
|
||||
* processed page.
|
||||
*
|
||||
* i.e. curl -i http://localhost:8088/phpinfo.php
|
||||
*/
|
||||
|
||||
#define MNAME testenableflag3
|
||||
lsi_module_t MNAME;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#define VERSION "V1.0"
|
||||
|
||||
static int addoutput(lsi_param_t *rec, const char *level)
|
||||
{
|
||||
int len = 0, lenNew;
|
||||
char *pBuf;
|
||||
if (rec->len1 <= 0)
|
||||
return g_api->stream_write_next(rec, rec->ptr1, rec->len1);
|
||||
pBuf = ls_xpool_alloc(g_api->get_session_pool(rec->session),
|
||||
rec->len1 + strlen(level) + 1);
|
||||
snprintf(pBuf, rec->len1 + strlen(level) + 1, "%.*s%.*s",
|
||||
rec->len1, (const char *)rec->ptr1, strlen(level) + 1, level);
|
||||
lenNew = rec->len1 + strlen(level);
|
||||
len = g_api->stream_write_next(rec, pBuf, lenNew);
|
||||
if (len < lenNew)
|
||||
*rec->flag_out = LSI_CBFO_BUFFERED;
|
||||
if (len < rec->len1)
|
||||
return len;
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static int addrecvresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "RECV3: If this appears, good.\n"); }
|
||||
|
||||
|
||||
static int addsendresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "SEND3: If this appears, good.\n"); }
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int aEnableHkpts[] = {LSI_HKPT_RECV_RESP_BODY, LSI_HKPT_SEND_RESP_BODY};
|
||||
g_api->enable_hook(rec->session, &MNAME, 1,
|
||||
aEnableHkpts, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{
|
||||
LSI_HKPT_RECV_RESP_BODY, addrecvresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_ENABLED | LSI_FLAG_TRANSFORM
|
||||
},
|
||||
{
|
||||
LSI_HKPT_SEND_RESP_BODY, addsendresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_ENABLED | LSI_FLAG_TRANSFORM
|
||||
},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
MNAME.about = VERSION; //set version string
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,96 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <ls.h>
|
||||
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* This module tests setting the enable flag during the session.
|
||||
* It is recommended to use this along with testenableflag 1, 2, and 3.
|
||||
*
|
||||
* This one tests: Disabling statically disabled callback functions.
|
||||
*
|
||||
* To test: After compiling and installing this module, access a dynamically
|
||||
* processed page.
|
||||
*
|
||||
* i.e. curl -i http://localhost:8088/phpinfo.php
|
||||
*/
|
||||
|
||||
#define MNAME testenableflag4
|
||||
lsi_module_t MNAME;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#define VERSION "V1.0"
|
||||
|
||||
static int addoutput(lsi_param_t *rec, const char *level)
|
||||
{
|
||||
int len = 0, lenNew;
|
||||
char *pBuf;
|
||||
if (rec->len1 <= 0)
|
||||
return g_api->stream_write_next(rec, rec->ptr1, rec->len1);
|
||||
pBuf = ls_xpool_alloc(g_api->get_session_pool(rec->session),
|
||||
rec->len1 + strlen(level) + 1);
|
||||
snprintf(pBuf, rec->len1 + strlen(level) + 1, "%.*s%.*s",
|
||||
rec->len1, (const char *)rec->ptr1, strlen(level) + 1, level);
|
||||
lenNew = rec->len1 + strlen(level);
|
||||
len = g_api->stream_write_next(rec, pBuf, lenNew);
|
||||
if (len < lenNew)
|
||||
*rec->flag_out = LSI_CBFO_BUFFERED;
|
||||
if (len < rec->len1)
|
||||
return len;
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static int addrecvresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "RECV4: If this appears, something is wrong.\n"); }
|
||||
|
||||
|
||||
static int addsendresp(lsi_param_t *rec)
|
||||
{ return addoutput(rec, "SEND4: If this appears, something is wrong.\n"); }
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int aEnableHkpts[] = {LSI_HKPT_RECV_RESP_BODY, LSI_HKPT_SEND_RESP_BODY};
|
||||
g_api->enable_hook(rec->session, &MNAME, 0,
|
||||
aEnableHkpts, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{
|
||||
LSI_HKPT_RECV_RESP_BODY, addrecvresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_TRANSFORM
|
||||
},
|
||||
{
|
||||
LSI_HKPT_SEND_RESP_BODY, addsendresp, LSI_HOOK_NORMAL,
|
||||
LSI_FLAG_TRANSFORM
|
||||
},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
MNAME.about = VERSION; //set version string
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,122 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "stdlib.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#define MNAME testenv
|
||||
lsi_module_t MNAME;
|
||||
|
||||
#define URI_PREFIX "/testenv"
|
||||
#define max_file_len 1024
|
||||
|
||||
/**
|
||||
* HOW TO TEST
|
||||
* //testenv?modcompress:S1P-3000R1P-3000&moddecompress:S1P3000R1P3000
|
||||
*/
|
||||
|
||||
int assignHandler(lsi_param_t *rec)
|
||||
{
|
||||
int len;
|
||||
const char *p;
|
||||
const char *pEnd;
|
||||
const char *uri = g_api->get_req_uri(rec->session, &len);
|
||||
const char *nameStart;
|
||||
char name[128];
|
||||
int nameLen;
|
||||
const char *valStart;
|
||||
char val[128];
|
||||
int valLen;
|
||||
if (len < strlen(URI_PREFIX) ||
|
||||
strncasecmp(uri, URI_PREFIX, strlen(URI_PREFIX)) != 0)
|
||||
return 0;
|
||||
|
||||
g_api->register_req_handler(rec->session, &MNAME, 0);
|
||||
p = g_api->get_req_query_string(rec->session, &len);
|
||||
pEnd = p + len;
|
||||
while (p && p < pEnd)
|
||||
{
|
||||
nameStart = p;
|
||||
p = strchr(p, ':');
|
||||
if (p)
|
||||
{
|
||||
nameLen = p - nameStart;
|
||||
strncpy(name, nameStart, nameLen);
|
||||
name[nameLen] = 0x00;
|
||||
++p;
|
||||
|
||||
valStart = p;
|
||||
p = strchr(p, '&');
|
||||
if (p)
|
||||
{
|
||||
valLen = p - valStart;
|
||||
++p;
|
||||
}
|
||||
else
|
||||
{
|
||||
valLen = pEnd - valStart;
|
||||
p = pEnd;
|
||||
}
|
||||
|
||||
strncpy(val, valStart, valLen);
|
||||
val[valLen] = 0x00;
|
||||
|
||||
g_api->set_req_env(rec->session, name, nameLen, val, valLen);
|
||||
g_api->log(rec->session, LSI_LOG_INFO,
|
||||
"[Module:testEnv] setEnv name[%s] val[%s]\n", name, val);
|
||||
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int PsHandlerProcess(const lsi_session_t *session)
|
||||
{
|
||||
int i;
|
||||
//200KB
|
||||
char buf[51] = {0};
|
||||
int count = 0;
|
||||
for (i = 0; i < 2000; ++i)
|
||||
{
|
||||
snprintf(buf, 51, "%04d--0123456789012345678901234567890123456789**\r\n",
|
||||
++count);
|
||||
g_api->append_resp_body(session, buf, 50);
|
||||
}
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, assignHandler, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t myhandler = { PsHandlerProcess, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", serverHooks };
|
||||
@@ -1,55 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "stdlib.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#define MNAME testhttpauth
|
||||
lsi_module_t MNAME;
|
||||
|
||||
int httpAuth(lsi_param_t *rec)
|
||||
{
|
||||
//test if the IP is 127.0.0.1 pass through, otherwise, reply 403
|
||||
char ip[16] = {0};
|
||||
g_api->get_req_var_by_id(rec->session, LSI_VAR_GEOIP_ADDR, ip, 16);
|
||||
if (strcmp(ip, "127.0.0.1") == 0)
|
||||
return LSI_OK;
|
||||
else
|
||||
{
|
||||
g_api->set_status_code(rec->session, 403);
|
||||
g_api->log(rec->session, LSI_LOG_INFO, "Access denied since ip = %s.\n",
|
||||
ip);
|
||||
return LSI_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_AUTH, httpAuth, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,228 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* This test module will reply the counter of how many times of your IP accessing,
|
||||
* and of the page being accessed, and how many times of this file be accessed
|
||||
* If test uri is /testmoduledata/file1, and if /file1 exists in testing vhost directory
|
||||
* then the uri will be handled
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* HOW TO TEST
|
||||
* Create a file "aaa", "bbb" in the /Example/html,
|
||||
* then curl http://127.0.0.1:8088/testmoduledata/aaa and
|
||||
* curl http://127.0.0.1:8088/testmoduledata/bbb,
|
||||
* you will see the result
|
||||
*
|
||||
*/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_shm.h>
|
||||
#include <lsr/ls_confparser.h>
|
||||
#include <lsr/ls_pool.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <lsdef.h>
|
||||
|
||||
#define MNAME testmoduledata
|
||||
lsi_module_t MNAME;
|
||||
|
||||
#define URI_PREFIX "/testmoduledata"
|
||||
#define URI_PREFIX_LEN (sizeof(URI_PREFIX) - 1)
|
||||
|
||||
|
||||
#define max_file_len 1024
|
||||
ls_shmhash_t *pShmHash = NULL;
|
||||
|
||||
const char *sharedDataStr = "MySharedData";
|
||||
const int sharedDataLen = 12;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long count;
|
||||
} CounterData;
|
||||
|
||||
int releaseCounterDataCb(void *data)
|
||||
{
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
CounterData *pData = (CounterData *)data;
|
||||
pData->count = 0;
|
||||
ls_pfree(pData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CounterData *allocateMydata(const lsi_session_t *session,
|
||||
const lsi_module_t *module, int level)
|
||||
{
|
||||
CounterData *myData = (CounterData *)ls_palloc(sizeof(CounterData));
|
||||
if (myData == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(myData, 0, sizeof(CounterData));
|
||||
g_api->set_module_data(session, module, level, (void *)myData);
|
||||
return myData;
|
||||
}
|
||||
|
||||
int assignHandler(lsi_param_t *rec)
|
||||
{
|
||||
const char *p;
|
||||
char path[max_file_len] = {0};
|
||||
CounterData *file_data;
|
||||
int len;
|
||||
const char *uri = g_api->get_req_uri(rec->session, &len);
|
||||
if (len >= URI_PREFIX_LEN &&
|
||||
strncasecmp(uri, URI_PREFIX, URI_PREFIX_LEN) == 0)
|
||||
{
|
||||
if (len == URI_PREFIX_LEN)
|
||||
p = "/";
|
||||
else
|
||||
p = uri + URI_PREFIX_LEN;
|
||||
if (0 == g_api->get_uri_file_path(rec->session, p, strlen(p), path,
|
||||
max_file_len) &&
|
||||
access(path, 0) != -1)
|
||||
{
|
||||
g_api->set_req_env(rec->session, "cache-control", 13, "no-cache", 8);
|
||||
g_api->register_req_handler(rec->session, &MNAME, 0);
|
||||
//set the FILE data here, so that needn't to parse the file path again later
|
||||
g_api->init_file_type_mdata(rec->session, &MNAME, path, strlen(path));
|
||||
file_data = (CounterData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_FILE);
|
||||
if (file_data == NULL)
|
||||
file_data = allocateMydata(rec->session, &MNAME, LSI_DATA_FILE);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int PsHandlerProcess(const lsi_session_t *session)
|
||||
{
|
||||
CounterData *ip_data = NULL, *vhost_data = NULL, *file_data = NULL;
|
||||
char output[128];
|
||||
|
||||
ip_data = (CounterData *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_IP);
|
||||
if (ip_data == NULL)
|
||||
ip_data = allocateMydata(session, &MNAME, LSI_DATA_IP);
|
||||
if (ip_data == NULL)
|
||||
return 500;
|
||||
|
||||
vhost_data = (CounterData *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_VHOST);
|
||||
if (vhost_data == NULL)
|
||||
vhost_data = allocateMydata(session, &MNAME, LSI_DATA_VHOST);
|
||||
if (vhost_data == NULL)
|
||||
return 500;
|
||||
|
||||
file_data = (CounterData *)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_FILE);
|
||||
if (file_data == NULL)
|
||||
return 500;
|
||||
|
||||
++ip_data->count;
|
||||
++file_data->count;
|
||||
++vhost_data->count;
|
||||
|
||||
|
||||
int len = 1024, flag = 0;
|
||||
ls_shmoff_t offset = ls_shmhash_get(pShmHash,
|
||||
(const uint8_t *)URI_PREFIX, sizeof(URI_PREFIX) - 1, &len, &flag);
|
||||
if (offset == 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_ERROR,
|
||||
"ls_shmhash_get return 0, so quit.\n");
|
||||
return 500;
|
||||
}
|
||||
|
||||
char *pBuf = (char *)ls_shmhash_off2ptr(pShmHash, offset);
|
||||
int sharedCount = 0;
|
||||
if (strncmp(pBuf, sharedDataStr, sharedDataLen) != 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_ERROR,
|
||||
"[testmoduledata] Shm Htable returned incorrect"
|
||||
" number of arguments.\n");
|
||||
return 500;
|
||||
}
|
||||
sharedCount = strtol(pBuf + 13, NULL, 10);
|
||||
snprintf(pBuf, len, "%s %d\n", sharedDataStr, ++sharedCount);
|
||||
|
||||
sprintf(output,
|
||||
"IP counter = %ld\nVHost counter = %ld\nFile counter = %ld\n%s",
|
||||
ip_data->count, vhost_data->count, file_data->count, pBuf);
|
||||
g_api->append_resp_body(session, output, strlen(output));
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, assignHandler, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
ls_shmpool_t *pShmPool = ls_shm_opengpool("testSharedM", 0);
|
||||
if (pShmPool == NULL)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_ERROR,
|
||||
"ls_shm_opengpool return NULL, so quit.\n");
|
||||
return LS_FAIL;
|
||||
}
|
||||
pShmHash = ls_shmhash_open(pShmPool, NULL, 0, NULL, NULL);
|
||||
if (pShmHash == NULL)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_ERROR,
|
||||
"ls_shmhash_open return NULL, so quit.\n");
|
||||
return LS_FAIL;
|
||||
}
|
||||
|
||||
int len = 1024, flag = LSI_SHM_INIT;
|
||||
ls_shmoff_t offset = ls_shmhash_get(pShmHash,
|
||||
(const uint8_t *)URI_PREFIX, sizeof(URI_PREFIX) - 1, &len, &flag);
|
||||
if (offset == 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_ERROR,
|
||||
"ls_shmhash_get return 0, so quit.\n");
|
||||
return LS_FAIL;
|
||||
}
|
||||
|
||||
if (flag == LSI_SHM_CREATED)
|
||||
{
|
||||
//Set the init value to it
|
||||
uint8_t *pBuf = ls_shmhash_off2ptr(pShmHash, offset);
|
||||
snprintf((char *)pBuf, len, "MySharedData 0\r\n");
|
||||
}
|
||||
|
||||
g_api->init_module_data(pModule, releaseCounterDataCb,
|
||||
LSI_DATA_VHOST);
|
||||
g_api->init_module_data(pModule, releaseCounterDataCb, LSI_DATA_IP);
|
||||
g_api->init_module_data(pModule, releaseCounterDataCb,
|
||||
LSI_DATA_FILE);
|
||||
|
||||
return LS_OK;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t myhandler = { PsHandlerProcess, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", serverHooks};
|
||||
@@ -1,234 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#define _GNU_SOURCE
|
||||
#include <ls.h>
|
||||
#include <lsr/ls_strtool.h>
|
||||
#include <lsr/ls_confparser.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* This module is for testing params of different context levels.
|
||||
* You can set it with different params in server, VHost/module and context
|
||||
* under VHost/module, and VHost/context levels, use such as "param1 123\n
|
||||
* param2 10\n..."
|
||||
* The uri in each context level must have "/test/", such as /test/, /test/1/2/,
|
||||
* and so on.
|
||||
*
|
||||
* You can test "get /test/1/", "get /test/1/2/testfile"
|
||||
*
|
||||
* The handler can be registered under the VHost/context or by enable the filters
|
||||
* somewhere, and then when the context matched the url and then the filter will
|
||||
* be called so that the filter will register itself as a handler.
|
||||
*
|
||||
* The result should be
|
||||
* If the hook is enabled, the filer may run and set itself as
|
||||
* handler, the result is always the context which match the longest uri,
|
||||
* the result is different for different context level.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#define MNAME testparam
|
||||
lsi_module_t MNAME;
|
||||
|
||||
|
||||
typedef struct _param_st
|
||||
{
|
||||
int param1;
|
||||
int param21;
|
||||
int param22;
|
||||
int param31;
|
||||
int param32;
|
||||
int param33;
|
||||
int param41;
|
||||
int param42;
|
||||
int param43;
|
||||
int param44;
|
||||
int param51;
|
||||
int param52;
|
||||
int param53;
|
||||
int param54;
|
||||
int param55;
|
||||
} param_st;
|
||||
|
||||
//Setup the below array to let web server know these params
|
||||
lsi_config_key_t myParam[] =
|
||||
{
|
||||
{"param1", 0, 0},
|
||||
{"param2", 0, 0},
|
||||
{"param3", 0, 0},
|
||||
{"param4", 0, 0},
|
||||
{"param5", 0, 0},
|
||||
{NULL, 0, 0} //The last position must have a NULL to indicate end of the array
|
||||
};
|
||||
|
||||
//return 0 for correctly parsing
|
||||
static int testparam_parseList(module_param_info_t *param, param_st *pConfig)
|
||||
{
|
||||
int *pParam;
|
||||
ls_confparser_t confparser;
|
||||
ls_confparser(&confparser);
|
||||
ls_objarray_t *pList = ls_confparser_line(&confparser, param->val,
|
||||
param->val + param->val_len);
|
||||
|
||||
int count = ls_objarray_getsize(pList);
|
||||
assert(count > 0);
|
||||
|
||||
//Comment: case param2, maxParamNum is 2, the line should be param2 [21 [22]],
|
||||
unsigned long maxParamNum = param->key_index + 1;
|
||||
if (maxParamNum > 5)
|
||||
maxParamNum = 1;
|
||||
|
||||
ls_str_t *p;
|
||||
long val;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count && i < maxParamNum; ++i)
|
||||
{
|
||||
p = (ls_str_t *)ls_objarray_getobj(pList, i);
|
||||
val = strtol(ls_str_cstr(p), NULL, 10);
|
||||
|
||||
switch(param->key_index)
|
||||
{
|
||||
case 0:
|
||||
pParam = &pConfig->param1 + i;
|
||||
break;
|
||||
case 1:
|
||||
pParam = &pConfig->param21 + i;
|
||||
break;
|
||||
case 2:
|
||||
pParam = &pConfig->param31 + i;
|
||||
break;
|
||||
case 3:
|
||||
pParam = &pConfig->param41 + i;
|
||||
break;
|
||||
case 4:
|
||||
pParam = &pConfig->param51 + i;
|
||||
break;
|
||||
}
|
||||
*pParam = val;
|
||||
}
|
||||
|
||||
ls_confparser_d(&confparser);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void *testparam_parseConfig(module_param_info_t *param, int param_count,
|
||||
void *_initial_config, int level, const char *name)
|
||||
{
|
||||
int i;
|
||||
param_st *pInitConfig = (param_st *)_initial_config;
|
||||
param_st *pConfig = (param_st *) malloc(sizeof(struct _param_st));
|
||||
if (!pConfig)
|
||||
return NULL;
|
||||
|
||||
if (pInitConfig)
|
||||
memcpy(pConfig, pInitConfig, sizeof(struct _param_st));
|
||||
else
|
||||
memset(pConfig, 0, sizeof(struct _param_st));
|
||||
|
||||
if (!param)
|
||||
return (void *)pConfig;
|
||||
|
||||
for (i=0 ;i<param_count; ++i)
|
||||
{
|
||||
testparam_parseList(¶m[i], pConfig);
|
||||
}
|
||||
return (void *)pConfig;
|
||||
}
|
||||
|
||||
static void testparam_freeConfig(void *_config)
|
||||
{
|
||||
free(_config);
|
||||
}
|
||||
|
||||
static int testparam_handlerBeginProcess(const lsi_session_t *session)
|
||||
{
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/plain", sizeof("text/plain") - 1, LSI_HEADEROP_SET);
|
||||
|
||||
param_st *pparam_st = (param_st *) g_api->get_config(session,
|
||||
&MNAME);
|
||||
char buf[1024];
|
||||
int len;
|
||||
if (pparam_st)
|
||||
{
|
||||
sprintf(buf,
|
||||
"Current uri is %s.\nContext uri is %s.\nparam1 = %d\nparam2 = %d %d\nparam3 = %d %d %d\nparam4 = %d %d %d %d\nparam5 = %d %d %d %d %d\n",
|
||||
g_api->get_req_uri(session, NULL),
|
||||
g_api->get_mapped_context_uri(session, &len),
|
||||
pparam_st->param1, pparam_st->param21, pparam_st->param22,
|
||||
pparam_st->param31, pparam_st->param32, pparam_st->param33,
|
||||
pparam_st->param41, pparam_st->param42, pparam_st->param43,
|
||||
pparam_st->param44,
|
||||
pparam_st->param51, pparam_st->param52, pparam_st->param53,
|
||||
pparam_st->param54, pparam_st->param55);
|
||||
|
||||
}
|
||||
else
|
||||
strcpy(buf,
|
||||
"There is no parameters extracted from Module Parameters - check web admin\n");
|
||||
g_api->append_resp_body(session, buf, strlen(buf));
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int uri_map_cbf(lsi_param_t *rec)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(rec->session, &len);
|
||||
if (len >= 10 && strcasestr(uri, "/testparam"))
|
||||
g_api->register_req_handler(rec->session, &MNAME, 10);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_URI_MAP, uri_map_cbf, LSI_HOOK_EARLY, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int testparam_init(lsi_module_t *pModule)
|
||||
{
|
||||
param_st *pparam_st = (param_st *) g_api->get_config(NULL, pModule);
|
||||
if (pparam_st)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_INFO,
|
||||
"[testparam]Global level param: param1 = %d param2 = %d %d param3 = %d %d %d param4 = %d %d %d %d param5 = %d %d %d %d %d\n",
|
||||
pparam_st->param1, pparam_st->param21, pparam_st->param22,
|
||||
pparam_st->param31, pparam_st->param32, pparam_st->param33,
|
||||
pparam_st->param41, pparam_st->param42, pparam_st->param43,
|
||||
pparam_st->param44,
|
||||
pparam_st->param51, pparam_st->param52, pparam_st->param53,
|
||||
pparam_st->param54, pparam_st->param55);
|
||||
}
|
||||
else
|
||||
g_api->log(NULL, LSI_LOG_INFO,
|
||||
"[testparam]Global level NO params, ERROR.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t testparam_myhandler = { testparam_handlerBeginProcess, NULL, NULL, NULL };
|
||||
lsi_confparser_t testparam_dealConfig = { testparam_parseConfig, testparam_freeConfig, myParam };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, testparam_init, &testparam_myhandler, &testparam_dealConfig, "Version 1.1", serverHooks };
|
||||
@@ -1,143 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <lsdef.h>
|
||||
|
||||
#define MNAME testredirect
|
||||
#define TEST_URL "/testredirect"
|
||||
#define TEST_URL_LEN (sizeof(TEST_URL) -1)
|
||||
|
||||
#define DEST_URL "/index.html"
|
||||
|
||||
/* This module tests redirect operations.
|
||||
* Valid urls are /testredirect?x-y
|
||||
* x is a LSI URL Operation. Valid operations are outlined in the LSI_URL_OP enum in ls.h
|
||||
* y determines who handles the operation, 0 for the server, 1 for module.
|
||||
*
|
||||
* Note: If y = 1, only the redirect URL Ops are valid.
|
||||
*/
|
||||
|
||||
lsi_module_t MNAME;
|
||||
|
||||
int parse_qs(const char *qs, int *action, int *useHandler)
|
||||
{
|
||||
int len;
|
||||
const char *pBuf;
|
||||
if (!qs || (len = strlen(qs)) <= 0)
|
||||
return LS_FAIL;
|
||||
*action = strtol(qs, NULL, 10);
|
||||
pBuf = memchr(qs, '-', len);
|
||||
if (pBuf && useHandler)
|
||||
*useHandler = strtol(pBuf + 1, NULL, 10);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void report_error(const lsi_session_t *session, const char *qs)
|
||||
{
|
||||
char errBuf[512];
|
||||
sprintf(errBuf, "Error: Invalid argument.\n"
|
||||
"Query String was %s.\n"
|
||||
"Expected d-d, where d is an integer.\n"
|
||||
"Valid values for the first d are LSI URL Ops.\n"
|
||||
"Valid values for the second d are\n"
|
||||
"\t 0 for normal operations,\n"
|
||||
"\t 1 for module handled operations.\n"
|
||||
"If using module handled operations, can only use redirect URL Ops.\n",
|
||||
qs
|
||||
);
|
||||
g_api->append_resp_body(session, errBuf, strlen(errBuf));
|
||||
g_api->end_resp(session);
|
||||
}
|
||||
|
||||
//Checks to make sure URL Action is valid. 0 for valid, -1 for invalid.
|
||||
int test_range(int action)
|
||||
{
|
||||
action = action & 127;
|
||||
if (action == 0 || action == 1)
|
||||
return LS_OK;
|
||||
else if (action > 16 && action < 23)
|
||||
return LS_OK;
|
||||
else if (action > 32 && action < 39)
|
||||
return LS_OK;
|
||||
else if (action > 48 && action < 55)
|
||||
return 0;
|
||||
return LS_FAIL;
|
||||
}
|
||||
|
||||
int check_if_redirect(lsi_param_t *rec)
|
||||
{
|
||||
const char *uri;
|
||||
const char *qs;
|
||||
int action = LSI_URL_REWRITE;
|
||||
int useHandler = 0;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(rec->session, &len);
|
||||
if (len >= strlen(TEST_URL)
|
||||
&& strncasecmp(uri, TEST_URL, strlen(TEST_URL)) == 0)
|
||||
{
|
||||
qs = g_api->get_req_query_string(rec->session, NULL);
|
||||
if (parse_qs(qs, &action, &useHandler) < 0)
|
||||
{
|
||||
report_error(rec->session, qs);
|
||||
return LSI_OK;
|
||||
}
|
||||
if (test_range(action) < 0)
|
||||
report_error(rec->session, qs);
|
||||
else if (!useHandler)
|
||||
g_api->set_uri_qs(rec->session, action, DEST_URL, sizeof(DEST_URL) - 1,
|
||||
"", 0);
|
||||
else if (action > 1)
|
||||
g_api->register_req_handler(rec->session, &MNAME, TEST_URL_LEN);
|
||||
else
|
||||
report_error(rec->session, qs);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, check_if_redirect, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return LS_OK;
|
||||
}
|
||||
|
||||
static int handlerBeginProcess(const lsi_session_t *session)
|
||||
{
|
||||
const char *qs;
|
||||
int action = LSI_URL_REWRITE;
|
||||
qs = g_api->get_req_query_string(session, NULL);
|
||||
if (parse_qs(qs, &action, NULL) < 0)
|
||||
{
|
||||
report_error(session, qs);
|
||||
return LSI_OK;
|
||||
}
|
||||
if (action == 17 || action == 33 || action == 49)
|
||||
report_error(session, qs);
|
||||
else
|
||||
g_api->set_uri_qs(session, action, DEST_URL, sizeof(DEST_URL) - 1, "", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t myhandler = { handlerBeginProcess, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "test redirect v1.0", serverHooks };
|
||||
@@ -1,141 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MNAME testreqenv
|
||||
lsi_module_t MNAME;
|
||||
|
||||
/** This module will do a test of basic request env setting and getting.
|
||||
*
|
||||
* After compiling the module with the ccc.sh script, move this module into
|
||||
* the $SERVERROOT/modules directory.
|
||||
*
|
||||
* I tested this by setting a context from the Example virtual host (eg. /env/)
|
||||
* Such that it is handled by this module.
|
||||
*
|
||||
* To test, access that context, i.e. http://localhost:8088/env/
|
||||
* and check the log. There should be an INFO output that should say:
|
||||
* Not a match. Key: thisWillBeDeleted, Orig Val: ifStillHereSomethingWrong, Current Val:
|
||||
*
|
||||
* If there are any more or it is not there, then there is an error.
|
||||
*/
|
||||
|
||||
|
||||
static char resp_buf[] = "This part doesn't really matter much to me.\r\n";
|
||||
|
||||
static char *pKeys[] =
|
||||
{
|
||||
"myEnvName",
|
||||
"myEnvKey",
|
||||
"aNewBeginning",
|
||||
"keepThemComing",
|
||||
"thisWillBeDeleted",
|
||||
"fewMoreStarters",
|
||||
"wishIWasMoreCreative",
|
||||
"needToComeUpWithMore",
|
||||
"iThinkOneMoreShouldSuffice",
|
||||
"done",
|
||||
"justKiddingExactlyTen",
|
||||
"!thisWillBeDeleted"
|
||||
};
|
||||
|
||||
static char *pVals[] =
|
||||
{
|
||||
"myEnvTarget",
|
||||
"myEnvVal",
|
||||
"aNewEnding",
|
||||
"keepThemGoing",
|
||||
"ifStillHereSomethingWrong",
|
||||
"fewMoreFinishers",
|
||||
"wishIWasMoreUnimaginative",
|
||||
"needToComeUpWithLess",
|
||||
"oneMoreIsTooMuch",
|
||||
"unfinishedBusiness",
|
||||
"justKiddingExactlyEleven"
|
||||
};
|
||||
|
||||
const int iSize = 11;
|
||||
const int iMaxLen = 256;
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
char outBuf[iMaxLen];
|
||||
int i, iOut;
|
||||
|
||||
for (i = 0; i < iSize; ++i)
|
||||
{
|
||||
iOut = g_api->get_req_env(session, pKeys[i], strlen(pKeys[i]),
|
||||
outBuf, iMaxLen);
|
||||
if (strncmp(outBuf, pVals[i], strlen(pVals[i])) != 0)
|
||||
{
|
||||
g_api->log(session, LSI_LOG_INFO,
|
||||
"Not a match. Key: %.*s, Orig Val: %.*s, Current Val: %.*s\n",
|
||||
strlen(pKeys[i]), pKeys[i], strlen(pVals[i]), pVals[i],
|
||||
iOut, outBuf);
|
||||
}
|
||||
}
|
||||
|
||||
g_api->set_status_code(session, 200);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", 9, LSI_HEADEROP_SET);
|
||||
g_api->append_resp_body(session, resp_buf, sizeof(resp_buf) - 1);
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int i;
|
||||
const lsi_session_t *pSession = rec->session;
|
||||
|
||||
for (i = 0; i < iSize; ++i)
|
||||
{
|
||||
g_api->set_req_env(pSession, pKeys[i], strlen(pKeys[i]), pVals[i],
|
||||
strlen(pVals[i]));
|
||||
printf("After addEnv: %.*s\n", strlen(pKeys[i]), pKeys[i]);
|
||||
}
|
||||
//Delete the ToBeDeleted one
|
||||
g_api->set_req_env(pSession, pKeys[i], strlen(pKeys[i]), pVals[4],
|
||||
strlen(pVals[4]));
|
||||
printf("After addEnv: %.*s\n", strlen(pKeys[i]), pKeys[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "v1.0",
|
||||
serverHooks
|
||||
};
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "stdlib.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#define MNAME testserverhook
|
||||
lsi_module_t MNAME;
|
||||
|
||||
int write_log(const char *sHookName)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"[Module:testserverhook] launch point %s\n", sHookName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int writeALog1(lsi_param_t *rec) { return write_log("LSI_HKPT_MAIN_INITED"); }
|
||||
int writeALog2(lsi_param_t *rec) { return write_log("LSI_HKPT_MAIN_PREFORK"); }
|
||||
int writeALog3(lsi_param_t *rec) { return write_log("LSI_HKPT_MAIN_POSTFORK"); }
|
||||
int writeALog4(lsi_param_t *rec) { return write_log("LSI_HKPT_WORKER_INIT"); }
|
||||
int writeALog5(lsi_param_t *rec) { return write_log("LSI_HKPT_WORKER_ATEXIT"); }
|
||||
int writeALog6(lsi_param_t *rec) { return write_log("LSI_HKPT_MAIN_ATEXIT"); }
|
||||
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{ LSI_HKPT_MAIN_INITED, writeALog1, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{ LSI_HKPT_MAIN_PREFORK, writeALog2, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{ LSI_HKPT_MAIN_POSTFORK, writeALog3, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{ LSI_HKPT_WORKER_INIT, writeALog4, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{ LSI_HKPT_WORKER_ATEXIT, writeALog5, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{ LSI_HKPT_MAIN_ATEXIT, writeALog6, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "testserverhook v1.0", serverHooks};
|
||||
@@ -1,129 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
/**
|
||||
* HOW TO TEST
|
||||
* /testsuspend/..... to set to suspend, and ?11 to set to handle
|
||||
*
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include "../../include/ls.h"
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
#define MNAME testsuspend
|
||||
extern lsi_module_t MNAME;
|
||||
|
||||
|
||||
void timer_callback(const void *session)
|
||||
{
|
||||
|
||||
int len;
|
||||
const char *qs = g_api->get_req_query_string((const lsi_session_t *)session,
|
||||
&len);
|
||||
if (len > 1 && strstr(qs, "11"))
|
||||
g_api->register_req_handler((const lsi_session_t *)session, &MNAME, 12);
|
||||
|
||||
|
||||
g_api->create_session_resume_event((const lsi_session_t *)session, &MNAME);
|
||||
}
|
||||
|
||||
void *thread_callback(void *session)
|
||||
{
|
||||
sleep(5);
|
||||
timer_callback(session);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
int suspendFunc(lsi_param_t *rec)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(rec->session, &len);
|
||||
if (len >= 12 && strcasestr(uri, "/testsuspend"))
|
||||
{
|
||||
|
||||
// //#define USE_TIMER_HERE
|
||||
// #ifdef USE_TIMER_HERE
|
||||
// g_api->set_timer(5000, timer_callback, (void *)rec->_session);
|
||||
// return LSI_SUSPEND;
|
||||
// #else
|
||||
// pthread_t mythread;
|
||||
// int rc = pthread_create(&mythread, NULL, thread_callback, (void *)rec->_session);
|
||||
// if (rc == 0)
|
||||
// {
|
||||
// return LSI_SUSPEND; //If ret LSI_SUSPEND, should set a timer or a thread to call hookResumeCallback()
|
||||
// }
|
||||
// #endif
|
||||
|
||||
pthread_t mythread;
|
||||
int rc = pthread_create(&mythread, NULL, thread_callback,
|
||||
(void *)rec->session);
|
||||
if (rc == 0)
|
||||
{
|
||||
return LSI_SUSPEND; //If ret LSI_SUSPEND, should set a timer or a thread to call hookResumeCallback()
|
||||
}
|
||||
}
|
||||
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, suspendFunc, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//The first time the below function will be called, then onWriteEvent will be called next and next
|
||||
static int PsHandlerProcess(const lsi_session_t *session)
|
||||
{
|
||||
char tmBuf[30];
|
||||
time_t t;
|
||||
struct tm *tmp;
|
||||
t = time(NULL);
|
||||
tmp = gmtime(&t);
|
||||
strftime(tmBuf, 30, "%a, %d %b %Y %H:%M:%S GMT", tmp);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", sizeof("text/html") - 1, LSI_HEADEROP_SET);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_LAST_MODIFIED, NULL, 0,
|
||||
tmBuf, 29, LSI_HEADEROP_SET);
|
||||
|
||||
char buf[1024];
|
||||
sprintf(buf,
|
||||
"This test suspend for 5 seconds and resume, now time is %ld<p>",
|
||||
(long)(time(NULL)));
|
||||
g_api->append_resp_body(session, buf, strlen(buf));
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t myhandler = { PsHandlerProcess, NULL, NULL, NULL };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", serverHooks};
|
||||
@@ -1,162 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* HOW TO TEST
|
||||
* test url ....../testtimer wit Get or post, request also can have a request body.
|
||||
* One line response will be displayed in browser and suspend,
|
||||
* and after 5 seconds, it will continue to display the left. *
|
||||
* If with a req body, it will be displayed in the browser
|
||||
*
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME testtimer
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
static int onReadEvent(const lsi_session_t *session);
|
||||
|
||||
int uri_map_cbf(lsi_param_t *rec)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(rec->session, &len);
|
||||
if (len >= 11 && strncasecmp(uri, "/testtimer/", 11) == 0)
|
||||
{
|
||||
g_api->register_req_handler(rec->session, &MNAME, 10);
|
||||
g_api->set_req_env(rec->session, "cache-control", 13, "max-age 20", 10);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_URI_MAP, uri_map_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
int nullRelease(void *p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, nullRelease, LSI_DATA_HTTP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void timer_cb(const void *session)
|
||||
{
|
||||
char buf[1024];
|
||||
sprintf(buf, "Timer Triggered(1 second), time: %ld<br>\n",
|
||||
(long)(time(NULL)));
|
||||
g_api->append_resp_body((const lsi_session_t *)session, buf, strlen(buf));
|
||||
}
|
||||
|
||||
void repeat_cb(const void *session)
|
||||
{
|
||||
char buf[1024];
|
||||
sprintf(buf, "Repeating timer(200ms)!, time: %ld<br>\n",
|
||||
(long)(time(NULL)));
|
||||
g_api->append_resp_body((const lsi_session_t *)session, buf, strlen(buf));
|
||||
}
|
||||
|
||||
void finish_cb(const void *session)
|
||||
{
|
||||
int id;
|
||||
char buf[1024];
|
||||
const lsi_session_t *pSession = (const lsi_session_t *)session;
|
||||
id = (int)(long)g_api->get_module_data(session, &MNAME, LSI_DATA_HTTP);
|
||||
g_api->remove_timer(id);
|
||||
sprintf(buf, "Finishing timer(5 seconds)!, time: %ld<br>\n",
|
||||
(long)(time(NULL)));
|
||||
g_api->append_resp_body(pSession, buf, strlen(buf));
|
||||
g_api->set_handler_write_state(pSession, 1);
|
||||
|
||||
}
|
||||
|
||||
//The first time the below function will be called, then onWriteEvent will be called next and next
|
||||
static int PsHandlerProcess(const lsi_session_t *session)
|
||||
{
|
||||
char tmBuf[30];
|
||||
time_t t;
|
||||
struct tm *tmp;
|
||||
t = time(NULL);
|
||||
tmp = gmtime(&t);
|
||||
strftime(tmBuf, 30, "%a, %d %b %Y %H:%M:%S GMT", tmp);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_CONTENT_TYPE, NULL, 0,
|
||||
"text/html", sizeof("text/html") - 1, LSI_HEADEROP_SET);
|
||||
g_api->set_resp_header(session, LSI_RSPHDR_LAST_MODIFIED, NULL, 0,
|
||||
tmBuf, 29, LSI_HEADEROP_SET);
|
||||
|
||||
char buf[1024];
|
||||
sprintf(buf, "This test will take 5 seconds, now time is %ld\n<p>",
|
||||
(long)(time(NULL)));
|
||||
g_api->append_resp_body(session, buf, strlen(buf));
|
||||
g_api->flush(session);
|
||||
g_api->set_handler_write_state(session, 0);
|
||||
int id = g_api->set_timer(200, 1, repeat_cb, session);
|
||||
g_api->set_timer(1000, 0, timer_cb, session);
|
||||
g_api->set_timer(2000, 0, timer_cb, session);
|
||||
g_api->set_timer(3000, 0, timer_cb, session);
|
||||
g_api->set_timer(4000, 0, timer_cb, session);
|
||||
g_api->set_timer(5000, 0, finish_cb, session);
|
||||
g_api->set_module_data(session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)(long)id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int onReadEvent(const lsi_session_t *session)
|
||||
{
|
||||
char buf[8192];
|
||||
g_api->append_resp_body(session, "I got req body:<br>\n",
|
||||
sizeof("I got req body:<br>\n") - 1);
|
||||
int ret;
|
||||
while ((ret = g_api->read_req_body(session, buf, 8192)) > 0)
|
||||
g_api->append_resp_body(session, buf, ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int onWriteEvent(const lsi_session_t *session)
|
||||
{
|
||||
g_api->append_resp_body(session, "<br>Writing finished, bye.\n<p>",
|
||||
sizeof("<br>Writing finished, bye.\n<p>") - 1);
|
||||
return LSI_RSP_DONE;
|
||||
}
|
||||
|
||||
static int onCleanUp(const lsi_session_t *session)
|
||||
{
|
||||
int id = (int)(long)g_api->get_module_data(session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
g_api->remove_timer(id);
|
||||
g_api->set_module_data(session, &MNAME, LSI_DATA_HTTP, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_reqhdlr_t myhandler = { PsHandlerProcess, onReadEvent, onWriteEvent, onCleanUp };
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init, &myhandler, NULL, "", serverHooks};
|
||||
@@ -1,71 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../include/ls.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MNAME testviewdata
|
||||
lsi_module_t MNAME;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#define VERSION "V1.0"
|
||||
|
||||
static int viewData0(lsi_param_t *rec, const char *level)
|
||||
{
|
||||
if (rec->len1 < 100)
|
||||
g_api->log(rec->session, LSI_LOG_INFO,
|
||||
"[testautocompress] viewData [%s] %s\n",
|
||||
level, (const char *)rec->ptr1);
|
||||
else
|
||||
{
|
||||
g_api->log(rec->session, LSI_LOG_INFO,
|
||||
"[testautocompress] viewData [%s] ", level);
|
||||
g_api->lograw(rec->session, rec->ptr1, 40);
|
||||
g_api->lograw(rec->session, "(...)", 5);
|
||||
g_api->lograw(rec->session, rec->ptr1 + rec->len1 - 40, 40);
|
||||
g_api->lograw(rec->session, "\n", 1);
|
||||
}
|
||||
return g_api->stream_write_next(rec, rec->ptr1, rec->len1);
|
||||
}
|
||||
|
||||
static int viewData1(lsi_param_t *rec) { return viewData0(rec, "RECV"); }
|
||||
static int viewData2(lsi_param_t *rec) { return viewData0(rec, "SEND"); }
|
||||
|
||||
static int beginSession(lsi_param_t *rec)
|
||||
{
|
||||
int aEnableHkpts[] = {LSI_HKPT_RECV_RESP_BODY, LSI_HKPT_SEND_RESP_BODY};
|
||||
g_api->enable_hook(rec->session, &MNAME, 1,
|
||||
aEnableHkpts, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, beginSession, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_RECV_RESP_BODY, viewData1, LSI_HOOK_NORMAL, LSI_FLAG_DECOMPRESS_REQUIRED },
|
||||
{LSI_HKPT_SEND_RESP_BODY, viewData2, LSI_HOOK_NORMAL, LSI_FLAG_DECOMPRESS_REQUIRED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module()
|
||||
{
|
||||
MNAME.about = VERSION; //set version string
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,169 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
//#include <zlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME updatehttpout
|
||||
#define TEST_STRING "_TEST_testmodule_ADD_A_STRING_HERE_<!--->"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData
|
||||
{
|
||||
ls_loopbuf_t inWBuf;
|
||||
ls_loopbuf_t outWBuf;
|
||||
} MyData;
|
||||
|
||||
|
||||
|
||||
int httpRelease(void *data)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### mymodulehttp %s\n", "httpRelease");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int httpinit(lsi_param_t *rec)
|
||||
{
|
||||
MyData *myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
ls_xpool_t *pool = g_api->get_session_pool(rec->session);
|
||||
myData = (MyData *)ls_xpool_alloc(pool, sizeof(MyData));
|
||||
ls_loopbuf_x(&myData->inWBuf, MAX_BLOCK_BUFSIZE, pool);
|
||||
ls_loopbuf_x(&myData->outWBuf, MAX_BLOCK_BUFSIZE, pool);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### mymodulehttp init\n");
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)myData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int httprespwrite(lsi_param_t *rec)
|
||||
{
|
||||
MyData *myData = NULL;
|
||||
ls_xpool_t *pool = g_api->get_session_pool(rec->session);
|
||||
const char *in = rec->ptr1;
|
||||
int inLen = rec->len1;
|
||||
int written, total = 0;
|
||||
// int j;
|
||||
// char s[4] = {0};
|
||||
myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
|
||||
// for ( j=0; j<inLen; ++j )
|
||||
// {
|
||||
// sprintf(s, "%c ", (unsigned char)in[j]);
|
||||
// ls_loopbuf_xappend( &myData->m_outWBuf, s, 2, pool );
|
||||
// total += 2;
|
||||
// }
|
||||
|
||||
//If have content, append a string for testing
|
||||
if (inLen > 0)
|
||||
{
|
||||
ls_loopbuf_xappend(&myData->outWBuf, TEST_STRING, sizeof(TEST_STRING) - 1,
|
||||
pool);
|
||||
ls_loopbuf_xappend(&myData->outWBuf, in, inLen, pool);
|
||||
total = inLen + sizeof(TEST_STRING) - 1;
|
||||
}
|
||||
|
||||
ls_loopbuf_xstraight(&myData->outWBuf, pool);
|
||||
|
||||
written = g_api->stream_write_next(rec, ls_loopbuf_begin(&myData->outWBuf),
|
||||
ls_loopbuf_size(&myData->outWBuf));
|
||||
ls_loopbuf_popfront(&myData->outWBuf, written);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### mymodulehttp test, next caller written %d, return %d, left %d\n",
|
||||
written, total, ls_loopbuf_size(&myData->outWBuf));
|
||||
|
||||
|
||||
if (!ls_loopbuf_empty(&myData->outWBuf))
|
||||
{
|
||||
int hasData = 1;
|
||||
rec->flag_out = &hasData;
|
||||
}
|
||||
return inLen; //Because all data used, ruturn thr orignal length
|
||||
}
|
||||
|
||||
static char *getNullEndString(const char *s, int len, char *str,
|
||||
int maxLength)
|
||||
{
|
||||
if (len >= maxLength)
|
||||
len = maxLength - 1;
|
||||
memcpy(str, s, len);
|
||||
str[len] = 0x00;
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
int httpreqHeaderRecved(lsi_param_t *rec)
|
||||
{
|
||||
const char *host, *ua, *uri, *accept;
|
||||
char *headerBuf;
|
||||
int hostLen, uaLen, acceptLen, headerLen;
|
||||
char uaBuf[1024], hostBuf[128], acceptBuf[512];
|
||||
ls_xpool_t *pPool = g_api->get_session_pool(rec->session);
|
||||
|
||||
uri = g_api->get_req_uri(rec->session, NULL);
|
||||
host = g_api->get_req_header(rec->session, "Host", 4, &hostLen);
|
||||
ua = g_api->get_req_header(rec->session, "User-Agent", 10, &uaLen);
|
||||
accept = g_api->get_req_header(rec->session, "Accept", 6, &acceptLen);
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### mymodulehttp test, httpreqHeaderRecved URI:%s host:%s, ua:%s accept:%s\n",
|
||||
uri, getNullEndString(host, hostLen, hostBuf, 128), getNullEndString(ua,
|
||||
uaLen, uaBuf, 1024), getNullEndString(accept, acceptLen, acceptBuf, 512));
|
||||
|
||||
headerLen = g_api->get_req_raw_headers_length(rec->session);
|
||||
headerBuf = (char *)ls_xpool_alloc(pPool, headerLen + 1);
|
||||
memset(headerBuf, 0, headerLen + 1);
|
||||
g_api->get_req_raw_headers(rec->session, headerBuf, headerLen);
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### mymodulehttp test, httpreqHeaderRecved whole header: %s, length: %d\n",
|
||||
headerBuf, headerLen);
|
||||
|
||||
ls_xpool_free(pPool, headerBuf);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_HTTP_BEGIN, httpinit, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_RECV_RESP_BODY, httprespwrite, LSI_HOOK_NORMAL, LSI_FLAG_TRANSFORM | LSI_FLAG_DECOMPRESS_REQUIRED | LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_RCVD_REQ_HEADER, httpreqHeaderRecved, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, httpRelease, LSI_DATA_HTTP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", serverHooks};
|
||||
@@ -1,145 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_base64.h>
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include <lsdef.h>
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME updatetcpin1
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData
|
||||
{
|
||||
ls_loopbuf_t inBuf;
|
||||
ls_loopbuf_t outBuf;
|
||||
} MyData;
|
||||
|
||||
int l4release(void *data)
|
||||
{
|
||||
MyData *myData = (MyData *)data;
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpin1 test %s\n",
|
||||
"l4release");
|
||||
|
||||
if (myData)
|
||||
{
|
||||
ls_loopbuf_d(&myData->inBuf);
|
||||
ls_loopbuf_d(&myData->outBuf);
|
||||
free(myData);
|
||||
}
|
||||
|
||||
return LS_OK;
|
||||
}
|
||||
|
||||
|
||||
int l4init1(lsi_param_t *rec)
|
||||
{
|
||||
MyData *myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
{
|
||||
myData = (MyData *) malloc(sizeof(MyData));
|
||||
ls_loopbuf(&myData->inBuf, MAX_BLOCK_BUFSIZE);
|
||||
ls_loopbuf(&myData->outBuf, MAX_BLOCK_BUFSIZE);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpin1 test %s\n", "l4init");
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_L4,
|
||||
(void *)myData);
|
||||
}
|
||||
else
|
||||
{
|
||||
ls_loopbuf_clear(&myData->inBuf);
|
||||
ls_loopbuf_clear(&myData->outBuf);
|
||||
}
|
||||
|
||||
return LS_OK;
|
||||
}
|
||||
|
||||
//expand the recieved data to base64 encode
|
||||
int l4recv1(lsi_param_t *rec)
|
||||
{
|
||||
#define PLAIN_BLOCK_SIZE 600
|
||||
#define ENCODE_BLOCK_SIZE (PLAIN_BLOCK_SIZE * 4 / 3 + 1)
|
||||
|
||||
MyData *myData = NULL;
|
||||
char *pBegin;
|
||||
char tmpBuf[ENCODE_BLOCK_SIZE];
|
||||
int len, sz;
|
||||
|
||||
myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
return LS_FAIL;
|
||||
|
||||
while ((len = g_api->stream_read_next(rec, tmpBuf, ENCODE_BLOCK_SIZE)) > 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### updatetcpin1 test l4recv, inLn = %d\n", len);
|
||||
ls_loopbuf_append(&myData->inBuf, tmpBuf, len);
|
||||
}
|
||||
|
||||
while (!ls_loopbuf_empty(&myData->inBuf))
|
||||
{
|
||||
ls_loopbuf_straight(&myData->inBuf);
|
||||
pBegin = ls_loopbuf_begin(&myData->inBuf);
|
||||
sz = ls_loopbuf_size(&myData->inBuf);
|
||||
if (sz > PLAIN_BLOCK_SIZE)
|
||||
sz = PLAIN_BLOCK_SIZE;
|
||||
len = ls_base64_encode((const char *)pBegin, sz, tmpBuf);
|
||||
if (len > 0)
|
||||
{
|
||||
ls_loopbuf_append(&myData->outBuf, tmpBuf, len);
|
||||
ls_loopbuf_popfront(&myData->inBuf, sz);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if (ls_loopbuf_size(&myData->outBuf) < rec->len1)
|
||||
rec->len1 = ls_loopbuf_size(&myData->outBuf);
|
||||
|
||||
if (rec->len1 > 0)
|
||||
ls_loopbuf_moveto(&myData->outBuf, (char *)rec->ptr1, rec->len1);
|
||||
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_L4_BEGINSESSION, l4init1, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_L4_RECVING, l4recv1, LSI_HOOK_EARLY, LSI_FLAG_TRANSFORM | LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, l4release, LSI_DATA_L4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init, NULL, NULL, "", serverHooks};
|
||||
@@ -1,145 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_base64.h>
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include <lsdef.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME updatetcpin2
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData2
|
||||
{
|
||||
ls_loopbuf_t inBuf;
|
||||
ls_loopbuf_t outBuf;
|
||||
} MyData2;
|
||||
|
||||
static int l4release2(void *data)
|
||||
{
|
||||
MyData2 *myData = (MyData2 *)data;
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpin1 test %s\n",
|
||||
"l4release");
|
||||
|
||||
if (myData)
|
||||
{
|
||||
ls_loopbuf_d(&myData->inBuf);
|
||||
ls_loopbuf_d(&myData->outBuf);
|
||||
free(myData);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int l4init2(lsi_param_t *rec)
|
||||
{
|
||||
MyData2 *myData = (MyData2 *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
{
|
||||
myData = (MyData2 *) malloc(sizeof(MyData2));
|
||||
ls_loopbuf(&myData->inBuf, MAX_BLOCK_BUFSIZE);
|
||||
ls_loopbuf(&myData->outBuf, MAX_BLOCK_BUFSIZE);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpin2 test %s\n", "l4init");
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_L4,
|
||||
(void *)myData);
|
||||
}
|
||||
else
|
||||
{
|
||||
ls_loopbuf_clear(&myData->inBuf);
|
||||
ls_loopbuf_clear(&myData->outBuf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//expand the recieved data to base64 encode
|
||||
static int l4recv2(lsi_param_t *rec)
|
||||
{
|
||||
#define ENCODE_BLOCK_SIZE 800
|
||||
#define DECODE_BLOCK_SIZE (ENCODE_BLOCK_SIZE * 3 / 4 + 4)
|
||||
|
||||
MyData2 *myData = NULL;
|
||||
char *pBegin;
|
||||
char tmpBuf[ENCODE_BLOCK_SIZE];
|
||||
int len, sz;
|
||||
|
||||
myData = (MyData2 *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
return LS_FAIL;
|
||||
|
||||
while ((len = g_api->stream_read_next(rec, tmpBuf, ENCODE_BLOCK_SIZE)) > 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### updatetcpin2 test l4recv, inLn = %d\n", len);
|
||||
ls_loopbuf_append(&myData->inBuf, tmpBuf, len);
|
||||
}
|
||||
|
||||
while (!ls_loopbuf_empty(&myData->inBuf))
|
||||
{
|
||||
ls_loopbuf_straight(&myData->inBuf);
|
||||
pBegin = ls_loopbuf_begin(&myData->inBuf);
|
||||
sz = ls_loopbuf_size(&myData->inBuf);
|
||||
if (sz > ENCODE_BLOCK_SIZE)
|
||||
sz = ENCODE_BLOCK_SIZE;
|
||||
|
||||
len = ls_base64_decode((const char *)pBegin, sz, tmpBuf);
|
||||
if (len > 0)
|
||||
{
|
||||
ls_loopbuf_append(&myData->outBuf, tmpBuf, len);
|
||||
ls_loopbuf_popfront(&myData->inBuf, sz);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if (ls_loopbuf_size(&myData->outBuf) < rec->len1)
|
||||
rec->len1 = ls_loopbuf_size(&myData->outBuf);
|
||||
|
||||
if (rec->len1 > 0)
|
||||
ls_loopbuf_moveto(&myData->outBuf, (char *)rec->ptr1, rec->len1);
|
||||
|
||||
return rec->len1;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_L4_BEGINSESSION, l4init2, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_L4_RECVING, l4recv2, LSI_HOOK_EARLY + 1, LSI_FLAG_TRANSFORM | LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, l4release2, LSI_DATA_L4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init, NULL, NULL, "", serverHooks };
|
||||
@@ -1,139 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
//#include <zlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME updatetcpout1
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData
|
||||
{
|
||||
ls_loopbuf_t writeBuf;
|
||||
} MyData;
|
||||
|
||||
int l4release(void *data)
|
||||
{
|
||||
MyData *myData = (MyData *)data;
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpout1 test %s\n",
|
||||
"l4release");
|
||||
|
||||
if (myData)
|
||||
{
|
||||
ls_loopbuf_d(&myData->writeBuf);
|
||||
free(myData);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4init(lsi_param_t *rec)
|
||||
{
|
||||
|
||||
MyData *myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
{
|
||||
myData = (MyData *) malloc(sizeof(MyData));
|
||||
ls_loopbuf(&myData->writeBuf, MAX_BLOCK_BUFSIZE);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpout1 test %s\n", "l4init");
|
||||
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_L4,
|
||||
(void *)myData);
|
||||
}
|
||||
else
|
||||
ls_loopbuf_clear(&myData->writeBuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l4send(lsi_param_t *rec)
|
||||
{
|
||||
MyData *myData = NULL;
|
||||
char *pBegin;
|
||||
struct iovec *iov = (struct iovec *)rec->ptr1;
|
||||
int count = rec->len1;
|
||||
int total = 0;
|
||||
char s[4] = {0};
|
||||
int written = 0;
|
||||
int i, j;
|
||||
struct iovec iovOut;
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpoutdata test %s\n",
|
||||
"tcpsend");
|
||||
myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (MAX_BLOCK_BUFSIZE > ls_loopbuf_size(&myData->writeBuf))
|
||||
{
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
pBegin = (char *)iov[i].iov_base;
|
||||
|
||||
for (j = 0; j < iov[i].iov_len; ++j)
|
||||
{
|
||||
sprintf(s, "=%02X", (unsigned char)pBegin[j]);
|
||||
ls_loopbuf_append(&myData->writeBuf, s, 3);
|
||||
++ total;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ls_loopbuf_straight(&myData->writeBuf);
|
||||
iovOut.iov_base = ls_loopbuf_begin(&myData->writeBuf);
|
||||
iovOut.iov_len = ls_loopbuf_size(&myData->writeBuf);
|
||||
written = g_api->stream_writev_next(rec, &iovOut, 1);
|
||||
ls_loopbuf_popfront(&myData->writeBuf, written);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### updatetcpoutdata test, next caller written %d, return %d, left %d\n",
|
||||
written, total, ls_loopbuf_size(&myData->writeBuf));
|
||||
|
||||
int hasData = 1;
|
||||
if (ls_loopbuf_size(&myData->writeBuf))
|
||||
rec->flag_out = (void *)&hasData;
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_L4_BEGINSESSION, l4init, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_L4_SENDING, l4send, LSI_HOOK_EARLY, LSI_FLAG_TRANSFORM | LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, l4release, LSI_DATA_L4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init, NULL, NULL, "", serverHooks};
|
||||
@@ -1,147 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#include "../include/ls.h"
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
//#include <zlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//DEFINE the module name, MUST BE the same as .so file name
|
||||
//ie. if MNAME is testmodule, then the .so must be testmodule.so
|
||||
#define MNAME updatetcpout2
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lsi_module_t MNAME;
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct _MyData
|
||||
{
|
||||
ls_loopbuf_t writeBuf;
|
||||
} MyData;
|
||||
|
||||
int l4release(void *data)
|
||||
{
|
||||
MyData *myData = (MyData *)data;
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpout2 test %s\n",
|
||||
"l4release");
|
||||
|
||||
if (myData)
|
||||
{
|
||||
ls_loopbuf_d(&myData->writeBuf);
|
||||
free(myData);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l4init(lsi_param_t *rec)
|
||||
{
|
||||
|
||||
MyData *myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
if (!myData)
|
||||
{
|
||||
myData = (MyData *) malloc(sizeof(MyData));
|
||||
ls_loopbuf(&myData->writeBuf, MAX_BLOCK_BUFSIZE);
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpout2 test %s\n", "l4init");
|
||||
g_api->set_module_data(rec->session, &MNAME, LSI_DATA_L4,
|
||||
(void *)myData);
|
||||
}
|
||||
else
|
||||
ls_loopbuf_clear(&myData->writeBuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int l4send(lsi_param_t *rec)
|
||||
{
|
||||
int total = 0;
|
||||
|
||||
MyData *myData = NULL;
|
||||
char *pBegin;
|
||||
struct iovec *iov = (struct iovec *)rec->ptr1;
|
||||
int count = rec->len1;
|
||||
char s[4] = {0};
|
||||
int written = 0;
|
||||
int i, j;
|
||||
int c;
|
||||
struct iovec iovOut;
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### updatetcpout2 test %s\n", "l4send");
|
||||
myData = (MyData *)g_api->get_module_data(rec->session, &MNAME,
|
||||
LSI_DATA_L4);
|
||||
|
||||
if (MAX_BLOCK_BUFSIZE > ls_loopbuf_size(&myData->writeBuf))
|
||||
{
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
total += iov[i].iov_len;
|
||||
pBegin = (char *)iov[i].iov_base;
|
||||
|
||||
for (j = 0; j < iov[i].iov_len; j += 3)
|
||||
{
|
||||
memcpy(s, pBegin + j, 3);
|
||||
if (*s == '=')
|
||||
c = strtol(s + 1, NULL, 16);
|
||||
else
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_INFO,
|
||||
"[Module: updatetcpout2] Error: Invalid entry in l4send.\n");
|
||||
return total;
|
||||
}
|
||||
s[0] = c;
|
||||
ls_loopbuf_append(&myData->writeBuf, s, 1);
|
||||
total += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ls_loopbuf_straight(&myData->writeBuf);
|
||||
iovOut.iov_base = ls_loopbuf_begin(&myData->writeBuf);
|
||||
iovOut.iov_len = ls_loopbuf_size(&myData->writeBuf);
|
||||
written = g_api->stream_writev_next(rec, &iovOut, 1);
|
||||
ls_loopbuf_popfront(&myData->writeBuf, written);
|
||||
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### updatetcpout2 test, next caller written %d, return %d, left %d\n",
|
||||
written, total, ls_loopbuf_size(&myData->writeBuf));
|
||||
|
||||
int hasData = 1;
|
||||
if (ls_loopbuf_size(&myData->writeBuf))
|
||||
rec->flag_out = (void *)&hasData;
|
||||
return total;
|
||||
}
|
||||
|
||||
static lsi_serverhook_t serverHooks[] =
|
||||
{
|
||||
{LSI_HKPT_L4_BEGINSESSION, l4init, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED},
|
||||
{LSI_HKPT_L4_SENDING, l4send, LSI_HOOK_EARLY + 1, LSI_FLAG_TRANSFORM | LSI_FLAG_ENABLED},
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static int init(lsi_module_t *pModule)
|
||||
{
|
||||
g_api->init_module_data(pModule, l4release, LSI_DATA_L4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsi_module_t MNAME = { LSI_MODULE_SIGNATURE, init, NULL, NULL, "", serverHooks };
|
||||
@@ -1,97 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
#define _GNU_SOURCE
|
||||
#include "../include/ls.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#define MNAME uploadchecker
|
||||
lsi_module_t MNAME;
|
||||
|
||||
static int is_bad_file(const char *path)
|
||||
{
|
||||
FILE *fp = fopen(path, "rb");
|
||||
if (!fp)
|
||||
return -1;
|
||||
|
||||
/**
|
||||
* In this example, we check if this file contains a string "_BAD_FILE_"
|
||||
* if yes, treat it as a bad file
|
||||
*/
|
||||
int ret = 0;
|
||||
char buf[8192];
|
||||
int len;
|
||||
while (len = fread(buf, 1, 8191, fp), len > 0)
|
||||
{
|
||||
buf[len] = 0x00;
|
||||
if (strstr(buf, "_BAD_FILE_"))
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int check_req_uploaded_file(lsi_param_t *param)
|
||||
{
|
||||
char *path;
|
||||
int i;
|
||||
int count = g_api->get_req_args_count(param->session);
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
if (g_api->is_post_file_upload(param->session, i))
|
||||
{
|
||||
g_api->get_req_arg_by_idx(param->session, i, NULL, &path);
|
||||
|
||||
if (is_bad_file(path))
|
||||
return LSI_ERROR;
|
||||
}
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static int set_session(lsi_param_t *param)
|
||||
{
|
||||
g_api->parse_req_args(param->session, 1, 1, "/tmp/", 0666);
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
static int init_module(lsi_module_t *pModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, set_session, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_RCVD_REQ_BODY, check_req_uploaded_file, LSI_HOOK_EARLY, LSI_FLAG_ENABLED },
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, NULL, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
@@ -1,246 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open LiteSpeed is an open source HTTP server. *
|
||||
* Copyright (C) 2013 - 2015 LiteSpeed Technologies, Inc. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
*****************************************************************************/
|
||||
|
||||
#include <ls.h>
|
||||
#include <lsdef.h>
|
||||
#include <lsr/ls_loopbuf.h>
|
||||
#include <lsr/ls_xpool.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* Define the module name, MUST BE the same as .so file name;
|
||||
* i.e., if MNAME is testmodule, then the .so must be testmodule.so.
|
||||
* You can call the below to set to wait req body read and then start
|
||||
* to handle the req either in the filter or in the begin_process()
|
||||
* of the handler struct.
|
||||
*/
|
||||
|
||||
#define MNAME waitfullreqbody
|
||||
lsi_module_t MNAME;
|
||||
|
||||
#define VERSION "V1.2"
|
||||
|
||||
static char testuri[] = "/waitfullreqbody";
|
||||
|
||||
#define CONTENT_HEAD "<html><head><title>waitfullreqbody</title></head><body><p>\r\nHead<p>\r\n"
|
||||
#define CONTENT_FORMAT "<tr><td>%s</td><td>%s</td></tr><p>\r\n"
|
||||
#define CONTENT_TAIL "</body></html><p>\r\n"
|
||||
|
||||
#define MAX_BLOCK_BUFSIZE 8192
|
||||
|
||||
typedef struct mydata_s
|
||||
{
|
||||
ls_loopbuf_t inbuf;
|
||||
} mydata_t;
|
||||
|
||||
|
||||
static int httprelease(void *data)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### waitfullreqbody %s\n",
|
||||
"httprelease");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int httpinit(lsi_param_t *param)
|
||||
{
|
||||
mydata_t *mydata;
|
||||
ls_xpool_t *pool = g_api->get_session_pool(param->session);
|
||||
mydata = ls_xpool_alloc(pool, sizeof(mydata_t));
|
||||
ls_loopbuf_x(&mydata->inbuf, MAX_BLOCK_BUFSIZE, pool);
|
||||
g_api->log(NULL, LSI_LOG_DEBUG, "#### waitfullreqbody init\n");
|
||||
g_api->set_module_data(param->session, &MNAME, LSI_DATA_HTTP,
|
||||
(void *)mydata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* httpreqread will try to read as much as possible from the next step
|
||||
* of the stream and hold the data, then double each char to the buffer.
|
||||
* If finally it has hold data, set the hasBufferedData to 1 with *((int *)param->_flag_out) = 1;
|
||||
* DO NOT SET TO 0, because the other module may already set to 1 when pass in this function.
|
||||
*
|
||||
*/
|
||||
static int httpreqread(lsi_param_t *param)
|
||||
{
|
||||
mydata_t *mydata = NULL;
|
||||
ls_xpool_t *pool = g_api->get_session_pool(param->session);
|
||||
char *pbegin;
|
||||
char tmpBuf[MAX_BLOCK_BUFSIZE];
|
||||
int len, sz, i;
|
||||
char *p = (char *)param->ptr1;
|
||||
|
||||
mydata = (mydata_t *)g_api->get_module_data(param->session, &MNAME,
|
||||
LSI_DATA_HTTP);
|
||||
if (mydata == NULL)
|
||||
return LS_FAIL;
|
||||
|
||||
while ((len = g_api->stream_read_next(param, tmpBuf,
|
||||
MAX_BLOCK_BUFSIZE)) > 0)
|
||||
{
|
||||
g_api->log(NULL, LSI_LOG_DEBUG,
|
||||
"#### waitfullreqbody httpreqread, inLn = %d\n", len);
|
||||
ls_loopbuf_xappend(&mydata->inbuf, tmpBuf, len, pool);
|
||||
}
|
||||
|
||||
while (!ls_loopbuf_empty(&mydata->inbuf)
|
||||
&& (p - (char *)param->ptr1 < param->len1))
|
||||
{
|
||||
ls_loopbuf_xstraight(&mydata->inbuf, pool);
|
||||
pbegin = ls_loopbuf_begin(&mydata->inbuf);
|
||||
sz = ls_loopbuf_size(&mydata->inbuf);
|
||||
|
||||
//#define TESTCASE_2
|
||||
#ifndef TESTCASE_2
|
||||
//test case 1: double each cahr
|
||||
if (sz > param->len1 / 2)
|
||||
sz = param->len1 / 2;
|
||||
for (i = 0; i < sz; ++i)
|
||||
{
|
||||
*p++ = *pbegin;
|
||||
*p++ = *pbegin;
|
||||
++pbegin;
|
||||
}
|
||||
#else
|
||||
//test case 2: shink to half of the org req body
|
||||
if (sz > param->_param_len * 2)
|
||||
sz = param->_param_len * 2;
|
||||
for (i = 0; i < sz / 2; ++i)
|
||||
{
|
||||
*p++ = *pbegin;
|
||||
pbegin += 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
ls_loopbuf_popfront(&mydata->inbuf, sz);
|
||||
}
|
||||
|
||||
param->len1 = p - (char *)param->ptr1;
|
||||
if (!ls_loopbuf_empty(&mydata->inbuf))
|
||||
*((int *)param->flag_out) = 1;
|
||||
|
||||
return param->len1;
|
||||
}
|
||||
|
||||
|
||||
static int rcvd_req_header_cbf(lsi_param_t *param)
|
||||
{
|
||||
const char *uri;
|
||||
int len;
|
||||
uri = g_api->get_req_uri(param->session, &len);
|
||||
if ((len >= sizeof(testuri) - 1)
|
||||
&& (strncasecmp(uri, testuri, sizeof(testuri) - 1) == 0))
|
||||
{
|
||||
g_api->register_req_handler(param->session, &MNAME, sizeof(testuri) - 1);
|
||||
//g_api->set_req_wait_full_body(param->_session);
|
||||
}
|
||||
return LSI_OK;
|
||||
}
|
||||
|
||||
|
||||
static int init_module(lsi_module_t *module)
|
||||
{
|
||||
module->about = VERSION; //set version string
|
||||
g_api->init_module_data(module, httprelease, LSI_DATA_HTTP);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int on_read(const lsi_session_t *session)
|
||||
{
|
||||
char buf[MAX_BLOCK_BUFSIZE];
|
||||
int ret;
|
||||
int count = 0;
|
||||
char *txt;
|
||||
if (!g_api->is_req_body_finished(session))
|
||||
{
|
||||
sprintf(buf, CONTENT_FORMAT, "ERROR",
|
||||
"You must forget to set wait all req body!!!<p>\r\n");
|
||||
g_api->append_resp_body(session, buf, strlen(buf));
|
||||
return 1;
|
||||
}
|
||||
|
||||
txt = (char *)"<tr><td>";
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
txt = (char *)"WHOLE REQ BODY";
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
txt = "</td><td>";
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
|
||||
while ((ret = g_api->read_req_body(session, buf, MAX_BLOCK_BUFSIZE)) > 0)
|
||||
{
|
||||
g_api->append_resp_body(session, buf, ret);
|
||||
count += ret;
|
||||
}
|
||||
txt = (char *)"</td></tr><p>\r\n";
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
|
||||
sprintf(buf, "<p>total req length read is %d<p>\r\n", count);
|
||||
g_api->append_resp_body(session, buf, strlen(buf));
|
||||
g_api->end_resp(session);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int begin_process(const lsi_session_t *session)
|
||||
{
|
||||
char *txt;
|
||||
g_api->set_req_wait_full_body(session);
|
||||
txt = (char *)CONTENT_HEAD;
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
if (g_api->is_req_body_finished(session))
|
||||
{
|
||||
txt = (char *)"Action in begin_process<p>\r\n";
|
||||
g_api->append_resp_body(session, txt, strlen(txt));
|
||||
on_read(session);
|
||||
}
|
||||
else
|
||||
g_api->flush(session);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int clean_up(const lsi_session_t *session)
|
||||
{
|
||||
g_api->free_module_data(session, &MNAME, LSI_DATA_HTTP,
|
||||
httprelease);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static lsi_serverhook_t server_hooks[] =
|
||||
{
|
||||
{ LSI_HKPT_RCVD_REQ_HEADER, rcvd_req_header_cbf, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_HTTP_BEGIN, httpinit, LSI_HOOK_NORMAL, LSI_FLAG_ENABLED },
|
||||
{ LSI_HKPT_RECV_REQ_BODY, httpreqread, LSI_HOOK_EARLY, LSI_FLAG_TRANSFORM | LSI_FLAG_ENABLED },
|
||||
|
||||
LSI_HOOK_END //Must put this at the end position
|
||||
};
|
||||
|
||||
static lsi_reqhdlr_t myhandler = { begin_process, on_read, NULL, clean_up };
|
||||
|
||||
lsi_module_t MNAME =
|
||||
{
|
||||
LSI_MODULE_SIGNATURE, init_module, &myhandler, NULL, "", server_hooks
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user