Compare commits
155 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52135a1d3a | ||
|
|
7f13bd09da | ||
|
|
7ccbb37c4e | ||
|
|
7feddf0aec | ||
|
|
e73523531a | ||
|
|
a47b790e19 | ||
|
|
319eec6124 | ||
|
|
21983f27b6 | ||
|
|
5d375b784d | ||
|
|
4b22470872 | ||
|
|
ec1c37aa06 | ||
|
|
67351ec3c2 | ||
|
|
f1887aaaf2 | ||
|
|
afd2d7b5e9 | ||
|
|
c967e585b5 | ||
|
|
73e364d4ba | ||
|
|
eb49331b21 | ||
|
|
0a1a3e023f | ||
|
|
bef5cedcd0 | ||
|
|
f8e2bc7bff | ||
|
|
09038ac7aa | ||
|
|
4c507232c7 | ||
|
|
86939a64da | ||
|
|
926ce427fc | ||
|
|
53401eebfb | ||
|
|
bef580929e | ||
|
|
c7b7c67ff4 | ||
|
|
ed42d4e3df | ||
|
|
69a2ebce36 | ||
|
|
15f08739fa | ||
|
|
571690c8c5 | ||
|
|
b2005d7f29 | ||
|
|
4354598c64 | ||
|
|
05d4bdc499 | ||
|
|
25c6a37df2 | ||
|
|
41a470fe36 | ||
|
|
8a4aa2a721 | ||
|
|
1d903770fc | ||
|
|
934be5a238 | ||
|
|
5608f0407f | ||
|
|
ce9d8dad7f | ||
|
|
d6fe263e68 | ||
|
|
156846a845 | ||
|
|
abe00b79a7 | ||
|
|
26ab659c6a | ||
|
|
b0273c68d2 | ||
|
|
720cf9d74f | ||
|
|
35cd567c48 | ||
|
|
2332d5be7b | ||
|
|
14cdc3801a | ||
|
|
d85efe480e | ||
|
|
4f2ceaa3ab | ||
|
|
3b6792d548 | ||
|
|
36de6e09d4 | ||
|
|
300c410b18 | ||
|
|
282d7d9101 | ||
|
|
48f6601003 | ||
|
|
c4c4279171 | ||
|
|
b88f9c1f18 | ||
|
|
0dac045dc9 | ||
|
|
80b5f97367 | ||
|
|
7a8b39fad0 | ||
|
|
9f5978e875 | ||
|
|
155fd757bf | ||
|
|
518ec202ab | ||
|
|
871083d613 | ||
|
|
79f0c8d28f | ||
|
|
dfbb4127e2 | ||
|
|
b9b2f00f30 | ||
|
|
6923f9d926 | ||
|
|
cacbf7fec7 | ||
|
|
73991e855c | ||
|
|
0208812013 | ||
|
|
48bd2561f7 | ||
|
|
af12c4102b | ||
|
|
d2efa3ecc4 | ||
|
|
acb04566f5 | ||
|
|
abb98ae960 | ||
|
|
0d202a7e4d | ||
|
|
c69ef20b17 | ||
|
|
5872d0682a | ||
|
|
c4fa8feb8c | ||
|
|
61a50cc657 | ||
|
|
3df3261ac0 | ||
|
|
f2636e14f0 | ||
|
|
a23f22f561 | ||
|
|
8cf3f4ee24 | ||
|
|
e83f7634f8 | ||
|
|
6eb6595a46 | ||
|
|
bd48fb7328 | ||
|
|
769525bb56 | ||
|
|
9195fb3c98 | ||
|
|
82922f7aea | ||
|
|
db1a39b6d9 | ||
|
|
7fbbc2ea0b | ||
|
|
91d4432108 | ||
|
|
c8914312aa | ||
|
|
3fd89c48e8 | ||
|
|
eceb144a77 | ||
|
|
1d9651b18a | ||
|
|
49db4e60cb | ||
|
|
53e8ccbccb | ||
|
|
6d8fc215f1 | ||
|
|
f94c303cb3 | ||
|
|
2be1873354 | ||
|
|
d1d36c32fe | ||
|
|
3b3527348f | ||
|
|
036d5f0713 | ||
|
|
a1b8807b0f | ||
|
|
356a087b6a | ||
|
|
0a77fd7150 | ||
|
|
67d67a287f | ||
|
|
1f792466bf | ||
|
|
5a6343b47c | ||
|
|
841c529107 | ||
|
|
41c3f21f0b | ||
|
|
b8c0688ba0 | ||
|
|
24e02e99fb | ||
|
|
97bb7b6227 | ||
|
|
5ceddc8c65 | ||
|
|
3a17d03796 | ||
|
|
57ae195930 | ||
|
|
9b86d576fa | ||
|
|
02a12eda13 | ||
|
|
a31da97d66 | ||
|
|
9f13aa9a12 | ||
|
|
2841051649 | ||
|
|
acfbf55d15 | ||
|
|
5848df28fd | ||
|
|
21925f48c3 | ||
|
|
17a64c58c2 | ||
|
|
0ca38cff31 | ||
|
|
5efc1849b4 | ||
|
|
f213d666e2 | ||
|
|
78495b6487 | ||
|
|
ab1c76e104 | ||
|
|
a671223823 | ||
|
|
3a99e10296 | ||
|
|
38031aaff9 | ||
|
|
65773bce57 | ||
|
|
ee5de56a94 | ||
|
|
aba97df9b2 | ||
|
|
79e670f797 | ||
|
|
8670cb6742 | ||
|
|
bde87950a5 | ||
|
|
aa1d2ab01d | ||
|
|
2a770a93b1 | ||
|
|
5b85a1c183 | ||
|
|
caf8893558 | ||
|
|
a280461cf6 | ||
|
|
455c655580 | ||
|
|
ecd707424f | ||
|
|
60fe330de1 | ||
|
|
cdb871b82b | ||
|
|
92b6914610 |
2
.github/ISSUE_TEMPLATE.md
vendored
2
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,6 +1,6 @@
|
||||
# Bug report vs. support request
|
||||
If you're unsure of whether your problem is a bug or a configuration error
|
||||
* contact us via IRC in #froxlor on freenode
|
||||
* contact us via IRC in #froxlor on irc.libera.chat
|
||||
* or post a thread in our forum at https://forum.froxlor.org
|
||||
|
||||
As a rule of thumb: before reporting an issue
|
||||
|
||||
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**As a rule of thumb: before reporting an issue**
|
||||
* see if it hasn't been [reported](https://github.com/Froxlor/froxlor/issues) (and possibly already been [fixed](https://github.com/Froxlor/froxlor/issues?utf8=✓&q=is:issue%20is:closed)) first
|
||||
* try with the git master
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**System information**
|
||||
* Froxlor version: $version/$gitSHA1
|
||||
* Web server: apache2/nginx/lighttpd
|
||||
* DNS server: Bind/PowerDNS (standalone)/PowerDNS (Bind-backend)
|
||||
* POP/IMAP server: Courier/Dovecot
|
||||
* SMTP server: postfix/exim
|
||||
* FTP server: proftpd/pureftpd
|
||||
* OS/Version: ...
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Logfiles**
|
||||
If applicable, add log-entries to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
80
.github/workflows/build-mariadb.yml
vendored
Normal file
80
.github/workflows/build-mariadb.yml
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
name: Froxlor-CI-MariaDB
|
||||
on: ['push', 'pull_request', 'create']
|
||||
|
||||
jobs:
|
||||
froxlor:
|
||||
name: Froxlor (PHP ${{ matrix.php-versions }}, MariaDB ${{ matrix.mariadb-version }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.4', '8.0']
|
||||
mariadb-version: [10.5, 10.4]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
tools: composer:v2
|
||||
extensions: mbstring, xml, ctype, pdo_mysql, mysql, curl, json, zip, session, filter, posix, openssl, fileinfo, bcmath
|
||||
|
||||
- name: Install tools
|
||||
run: sudo apt-get install -y ant
|
||||
|
||||
- name: Adjust firewall
|
||||
run: |
|
||||
sudo ufw allow out 3306/tcp
|
||||
sudo ufw allow in 3306/tcp
|
||||
|
||||
- name: Setup MariaDB
|
||||
uses: getong/mariadb-action@v1.1
|
||||
with:
|
||||
mariadb version: ${{ matrix.mariadb-version }}
|
||||
mysql database: 'froxlor010'
|
||||
mysql root password: 'fr0xl0r.TravisCI'
|
||||
|
||||
- name: Wait for database
|
||||
run: sleep 15
|
||||
|
||||
- name: Setup databases
|
||||
run: |
|
||||
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED BY 'fr0xl0r.TravisCI';"
|
||||
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"
|
||||
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI froxlor010 < install/froxlor.sql
|
||||
|
||||
- name: Run testing
|
||||
run: ant quick-build
|
||||
|
||||
# - name: irc push
|
||||
# uses: rectalogic/notify-irc@v1
|
||||
# if: github.event_name == 'push'
|
||||
# with:
|
||||
# channel: "#froxlor"
|
||||
# server: "irc.libera.chat"
|
||||
# nickname: froxlor-ci
|
||||
# message: |
|
||||
# ${{ github.actor }} pushed ${{ github.event.ref }} ${{ github.event.compare }}
|
||||
# ${{ join(github.event.commits.*.message) }}
|
||||
|
||||
# - name: irc pull request
|
||||
# uses: rectalogic/notify-irc@v1
|
||||
# if: github.event_name == 'pull_request'
|
||||
# with:
|
||||
# channel: "#froxlor"
|
||||
# server: "irc.libera.chat"
|
||||
# nickname: froxlor-ci
|
||||
# message: |
|
||||
# ${{ github.actor }} opened PR ${{ github.event.pull_request.html_url }}
|
||||
|
||||
# - name: irc tag created
|
||||
# uses: rectalogic/notify-irc@v1
|
||||
# if: github.event_name == 'create' && github.event.ref_type == 'tag'
|
||||
# with:
|
||||
# channel: "#froxlor"
|
||||
# server: "irc.libera.chat"
|
||||
# nickname: froxlor-ci
|
||||
# message: |
|
||||
# ${{ github.actor }} tagged ${{ github.repository }} ${{ github.event.ref }}
|
||||
57
.github/workflows/build-mysql.yml
vendored
Normal file
57
.github/workflows/build-mysql.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Froxlor-CI-MySQL
|
||||
on: ['push', 'pull_request', 'create']
|
||||
|
||||
jobs:
|
||||
froxlor:
|
||||
name: Froxlor (PHP ${{ matrix.php-versions }}, MySQL ${{ matrix.mysql-version }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['7.4', '8.0']
|
||||
mysql-version: [8.0, 5.7]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
tools: composer:v2
|
||||
extensions: mbstring, xml, ctype, pdo_mysql, mysql, curl, json, zip, session, filter, posix, openssl, fileinfo, bcmath
|
||||
|
||||
- name: Install tools
|
||||
run: sudo apt-get install -y ant
|
||||
|
||||
- name: Adjust firewall
|
||||
run: |
|
||||
sudo ufw allow out 3306/tcp
|
||||
sudo ufw allow in 3306/tcp
|
||||
|
||||
- name: Setup MySQL
|
||||
uses: samin/mysql-action@v1.3
|
||||
with:
|
||||
mysql version: ${{ matrix.mysql-version }}
|
||||
mysql database: 'froxlor010'
|
||||
mysql root password: 'fr0xl0r.TravisCI'
|
||||
|
||||
- name: Wait for database
|
||||
run: sleep 15
|
||||
|
||||
- name: Setup database (8.0)
|
||||
if: matrix.mysql-version == '8.0'
|
||||
run: |
|
||||
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED WITH mysql_native_password BY 'fr0xl0r.TravisCI';"
|
||||
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"
|
||||
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI froxlor010 < install/froxlor.sql
|
||||
|
||||
- name: Setup database (5.7)
|
||||
if: matrix.mysql-version == '5.7'
|
||||
run: |
|
||||
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED BY 'fr0xl0r.TravisCI';"
|
||||
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"
|
||||
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI froxlor010 < install/froxlor.sql
|
||||
|
||||
- name: Run testing
|
||||
run: ant quick-build
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -12,9 +12,10 @@ logs/*
|
||||
.well-known
|
||||
.idea
|
||||
*.iml
|
||||
img/
|
||||
|
||||
!templates/Froxlor/
|
||||
!templates/Sparkle/
|
||||
!templates/misc/
|
||||
templates/Froxlor/assets/img/logo_custom.png
|
||||
templates/Sparkle/assets/css/custom.css
|
||||
vendor/
|
||||
|
||||
@@ -55,7 +55,7 @@ script:
|
||||
- ant phpunit-no-coverage
|
||||
|
||||
notifications:
|
||||
irc: "chat.freenode.net#froxlor"
|
||||
irc: "irc.libera.chat#froxlor"
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/bdf91d1c3f745e51f796
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
[](https://travis-ci.com/Froxlor/Froxlor)
|
||||
[](https://github.com/Froxlor/Froxlor/actions/workflows/build-mariadb.yml)
|
||||
[](https://github.com/Froxlor/Froxlor/actions/workflows/build-mysql.yml)
|
||||
[](https://gitter.im/Froxlor/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
# Froxlor
|
||||
@@ -28,8 +29,8 @@ You may find help in the following places:
|
||||
|
||||
### IRC
|
||||
|
||||
froxlor may be found on freenode.net, channel #froxlor:
|
||||
irc://chat.freenode.net/froxlor
|
||||
froxlor may be found on libera.chat, channel #froxlor:
|
||||
irc://irc.libera.chat/froxlor
|
||||
|
||||
### Forum
|
||||
|
||||
|
||||
@@ -77,14 +77,6 @@ return array(
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_no_robots' => array(
|
||||
'label' => $lng['serversettings']['no_robots'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'no_robots',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_paging' => array(
|
||||
'label' => $lng['serversettings']['paging'],
|
||||
'settinggroup' => 'panel',
|
||||
@@ -265,7 +257,71 @@ return array(
|
||||
'traffic.mail' => $lng['menue']['traffic']['traffic'] . " / Mail"
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
),
|
||||
'panel_imprint_url' => array(
|
||||
'label' => $lng['serversettings']['imprint_url'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'imprint_url',
|
||||
'type' => 'string',
|
||||
'string_type' => 'url',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_terms_url' => array(
|
||||
'label' => $lng['serversettings']['terms_url'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'terms_url',
|
||||
'type' => 'string',
|
||||
'string_type' => 'url',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_privacy_url' => array(
|
||||
'label' => $lng['serversettings']['privacy_url'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'privacy_url',
|
||||
'type' => 'string',
|
||||
'string_type' => 'url',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_logo_overridetheme' => array(
|
||||
'label' => $lng['serversettings']['logo_overridetheme'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'logo_overridetheme',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_logo_overridecustom' => array(
|
||||
'label' => $lng['serversettings']['logo_overridecustom'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'logo_overridecustom',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_logo_image_header' => array(
|
||||
'label' => $lng['serversettings']['logo_image_header'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'logo_image_header',
|
||||
'type' => 'image',
|
||||
'image_name' => 'logo_header',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingImage'
|
||||
),
|
||||
'panel_logo_image_login' => array(
|
||||
'label' => $lng['serversettings']['logo_image_login'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'logo_image_login',
|
||||
'type' => 'image',
|
||||
'image_name' => 'logo_login',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingImage'
|
||||
),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -205,9 +205,21 @@ return array(
|
||||
'default' => false,
|
||||
'cronmodule' => 'froxlor/backup',
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
),
|
||||
'system_createstdsubdom_default' => array(
|
||||
'label' => $lng['serversettings']['createstdsubdom_default'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'createstdsubdom_default',
|
||||
'type' => 'option',
|
||||
'default' => '1',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'0' => $lng['panel']['no'],
|
||||
'1' => $lng['panel']['yes']
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -270,6 +270,28 @@ return array(
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_domaindefaultalias' => array(
|
||||
'label' => $lng['admin']['domaindefaultalias'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'domaindefaultalias',
|
||||
'type' => 'option',
|
||||
'default' => '0',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'0' => $lng['domains']['serveraliasoption_wildcard'],
|
||||
'1' => $lng['domains']['serveraliasoption_www'],
|
||||
'2' => $lng['domains']['serveraliasoption_none']
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'hide_incompatible_settings' => array(
|
||||
'label' => $lng['serversettings']['hide_incompatible_settings'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'hide_incompatible_settings',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -142,6 +142,9 @@ return array(
|
||||
'default' => '/etc/apache2/conf-enabled/acme.conf',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
/**
|
||||
* currently the only option anyway
|
||||
*
|
||||
'system_leapiversion' => array(
|
||||
'label' => $lng['serversettings']['leapiversion'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -154,16 +157,20 @@ return array(
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
*/
|
||||
'system_letsencryptca' => array(
|
||||
'label' => $lng['serversettings']['letsencryptca'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'letsencryptca',
|
||||
'type' => 'option',
|
||||
'default' => 'production',
|
||||
'default' => 'letsencrypt',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'testing' => 'https://acme-staging-v0' . \Froxlor\Settings::Get('system.leapiversion') . '.api.letsencrypt.org (Test)',
|
||||
'production' => 'https://acme-v0' . \Froxlor\Settings::Get('system.leapiversion') . '.api.letsencrypt.org (Live)'
|
||||
'letsencrypt_test' => 'Let\'s Encrypt (Test / Staging)',
|
||||
'letsencrypt' => 'Let\'s Encrypt (Live)',
|
||||
'buypass_test' => 'Buypass (Test / Staging)',
|
||||
'buypass' => 'Buypass (Live)',
|
||||
'zerossl' => 'ZeroSSL (Live)'
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
|
||||
@@ -99,6 +99,19 @@ return array(
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_powerdns_mode' => array(
|
||||
'label' => $lng['serversettings']['powerdns_mode'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'powerdns_mode',
|
||||
'type' => 'option',
|
||||
'default' => 'Native',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'Native' => 'Native',
|
||||
'Master' => 'Master'
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_dns_createmailentry' => array(
|
||||
'label' => $lng['serversettings']['mail_also_with_mxservers'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -132,6 +145,16 @@ return array(
|
||||
'int_min' => 3600, /* 1 hour */
|
||||
'int_max' => 2147483647, /* integer max */
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_soaemail' => array(
|
||||
'label' => $lng['serversettings']['soaemail'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'soaemail',
|
||||
'type' => 'string',
|
||||
'string_type' => 'mail',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -39,6 +39,15 @@ return array(
|
||||
'default' => '/etc/postfix/dkim/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'dkim_privkeysuffix' => array(
|
||||
'label' => $lng['dkim']['privkeysuffix'],
|
||||
'settinggroup' => 'dkim',
|
||||
'varname' => 'privkeysuffix',
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^[a-z0-9\._]+$/i',
|
||||
'default' => '.priv',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'dkim_domains' => array(
|
||||
'label' => $lng['dkim']['dkim_domains'],
|
||||
'settinggroup' => 'dkim',
|
||||
|
||||
@@ -82,7 +82,20 @@ return array(
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
),
|
||||
'system_froxlorusergroup' => array(
|
||||
'label' => $lng['serversettings']['froxlorusergroup'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'froxlorusergroup',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'plausibility_check_method' => array(
|
||||
'\\Froxlor\\Validate\\Check',
|
||||
'checkLocalGroup'
|
||||
),
|
||||
'visible' => \Froxlor\Settings::Get('system.nssextrausers')
|
||||
),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -129,7 +129,7 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
'userid' => $userinfo['userid']
|
||||
));
|
||||
|
||||
$s = md5(uniqid(microtime(), 1));
|
||||
$s = \Froxlor\Froxlor::genSessionId();
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_SESSIONS . "` SET
|
||||
`hash` = :hash, `userid` = :userid, `ipaddress` = :ip,
|
||||
|
||||
@@ -87,7 +87,7 @@ if ($page == 'showinfo') {
|
||||
$hits = $cache['num_hits'] . @sprintf(" (%.1f%%)", $cache['num_hits'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
|
||||
$misses = $cache['num_misses'] . @sprintf(" (%.1f%%)", $cache['num_misses'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
|
||||
|
||||
// Fragementation: (freeseg - 1) / total_seg
|
||||
// Fragmentation: (freeseg - 1) / total_seg
|
||||
$nseg = $freeseg = $fragsize = $freetotal = 0;
|
||||
for ($i = 0; $i < $mem['num_seg']; $i ++) {
|
||||
$ptr = 0;
|
||||
|
||||
@@ -178,7 +178,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
|
||||
'hash' => $s
|
||||
));
|
||||
|
||||
$s = md5(uniqid(microtime(), 1));
|
||||
$s = \Froxlor\Froxlor::genSessionId();
|
||||
$insert = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_SESSIONS . "` SET
|
||||
`hash` = :hash,
|
||||
|
||||
@@ -290,9 +290,9 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
|
||||
// create serveralias options
|
||||
$serveraliasoptions = "";
|
||||
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_wildcard'], '0', '0', true, true);
|
||||
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_www'], '1', '0', true, true);
|
||||
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_none'], '2', '0', true, true);
|
||||
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_wildcard'], '0', Settings::Get('system.domaindefaultalias'), true, true);
|
||||
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_www'], '1', Settings::Get('system.domaindefaultalias'), true, true);
|
||||
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_none'], '2', Settings::Get('system.domaindefaultalias'), true, true);
|
||||
|
||||
$subcanemaildomain = \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['never'], '0', '0', true, true);
|
||||
$subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', '0', true, true);
|
||||
@@ -428,7 +428,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
$customer = Database::pexecute_first($customer_stmt, array(
|
||||
'customerid' => $result['customerid']
|
||||
));
|
||||
$result['customername'] = \Froxlor\User::getCorrectFullUserDetails($customer) . ' (' . $customer['loginname'] . ')';
|
||||
$result['customername'] = \Froxlor\User::getCorrectFullUserDetails($customer);
|
||||
}
|
||||
|
||||
if ($userinfo['customers_see_all'] == '1') {
|
||||
@@ -594,6 +594,10 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
}
|
||||
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
if (Settings::Get('panel.allow_domain_change_customer') != '1') {
|
||||
$result['customername'] .= ' (<a href="' . $linker->getLink(array('section' => 'customers', 'page' => 'customers',
|
||||
'action' => 'su', 'id' => $customer['customerid'])) . '" rel="external">' . $customer['loginname'] . '</a>)';
|
||||
}
|
||||
|
||||
$domain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_edit.php';
|
||||
$domain_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($domain_edit_data);
|
||||
|
||||
@@ -57,6 +57,12 @@ if (isset($_POST['id'])) {
|
||||
if ($page == 'overview') {
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_index");
|
||||
$params = [];
|
||||
if ($userinfo['customers_see_all'] == '0') {
|
||||
$params = [
|
||||
'adminid' => $userinfo['adminid']
|
||||
];
|
||||
}
|
||||
$overview_stmt = Database::prepare("SELECT COUNT(*) AS `number_customers`,
|
||||
SUM(`diskspace_used`) AS `diskspace_used`,
|
||||
SUM(`mysqls_used`) AS `mysqls_used`,
|
||||
@@ -68,20 +74,18 @@ if ($page == 'overview') {
|
||||
SUM(`subdomains_used`) AS `subdomains_used`,
|
||||
SUM(`traffic_used`) AS `traffic_used`
|
||||
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid "));
|
||||
$overview = Database::pexecute_first($overview_stmt, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
$overview = Database::pexecute_first($overview_stmt, $params);
|
||||
|
||||
$dec_places = Settings::Get('panel.decimal_places');
|
||||
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places);
|
||||
$overview['diskspace_used'] = round($overview['diskspace_used'] / 1024, $dec_places);
|
||||
$overview['traffic_bytes_used'] = $overview['traffic_used'] * 1024;
|
||||
$overview['traffic_used'] = \Froxlor\PhpHelper::sizeReadable($overview['traffic_used'] * 1024, null, 'bi');
|
||||
$overview['diskspace_bytes_used'] = $overview['diskspace_used'] * 1024;
|
||||
$overview['diskspace_used'] = \Froxlor\PhpHelper::sizeReadable($overview['diskspace_used'] * 1024, null, 'bi');
|
||||
|
||||
$number_domains_stmt = Database::prepare("
|
||||
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid"));
|
||||
$number_domains = Database::pexecute_first($number_domains_stmt, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
$number_domains = Database::pexecute_first($number_domains_stmt, $params);
|
||||
|
||||
$overview['number_domains'] = $number_domains['number_domains'];
|
||||
|
||||
@@ -111,11 +115,17 @@ if ($page == 'overview') {
|
||||
}
|
||||
|
||||
$dec_places = Settings::Get('panel.decimal_places');
|
||||
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $dec_places);
|
||||
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $dec_places);
|
||||
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $dec_places);
|
||||
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $dec_places);
|
||||
$userinfo = \Froxlor\PhpHelper::strReplaceArray('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
// get everything in bytes for the percentage calculation on the dashboard
|
||||
$userinfo['diskspace_bytes'] = ($userinfo['diskspace'] > -1) ? $userinfo['diskspace'] * 1024 : -1;
|
||||
$userinfo['diskspace_bytes_used'] = $userinfo['diskspace_used'] * 1024;
|
||||
$userinfo['traffic_bytes'] = ($userinfo['traffic'] > -1) ? $userinfo['traffic'] * 1024 : - 1;
|
||||
$userinfo['traffic_bytes_used'] = $userinfo['traffic_used'] * 1024;
|
||||
|
||||
$userinfo['diskspace'] = ($userinfo['diskspace'] > -1) ? \Froxlor\PhpHelper::sizeReadable($userinfo['diskspace'] * 1024, null, 'bi') : - 1;
|
||||
$userinfo['diskspace_used'] = \Froxlor\PhpHelper::sizeReadable($userinfo['diskspace_used'] * 1024, null, 'bi');
|
||||
$userinfo['traffic'] = ($userinfo['traffic'] > -1) ? \Froxlor\PhpHelper::sizeReadable($userinfo['traffic'] * 1024, null, 'bi') : - 1;
|
||||
$userinfo['traffic_used'] = \Froxlor\PhpHelper::sizeReadable($userinfo['traffic_used'] * 1024, null, 'bi');
|
||||
$userinfo = \Froxlor\PhpHelper::strReplaceArray('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace diskspace_bytes traffic traffic_bytes mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
|
||||
$userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : '';
|
||||
|
||||
@@ -183,8 +193,12 @@ if ($page == 'overview') {
|
||||
\Froxlor\UI\Response::standard_error('oldpasswordnotcorrect');
|
||||
}
|
||||
|
||||
$new_password = \Froxlor\Validate\Validate::validate($_POST['new_password'], 'new password');
|
||||
$new_password_confirm = \Froxlor\Validate\Validate::validate($_POST['new_password_confirm'], 'new password confirm');
|
||||
try {
|
||||
$new_password = \Froxlor\System\Crypt::validatePassword($_POST['new_password'], 'new password');
|
||||
$new_password_confirm = \Froxlor\System\Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm');
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
|
||||
if ($old_password == '') {
|
||||
\Froxlor\UI\Response::standard_error(array(
|
||||
|
||||
@@ -32,10 +32,10 @@ if ($page == 'message') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'viewed panel_message');
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
if ($_POST['receipient'] == 0 && $userinfo['customers_see_all'] == '1') {
|
||||
if ($_POST['recipient'] == 0 && $userinfo['customers_see_all'] == '1') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to admins');
|
||||
$result = Database::query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`");
|
||||
} elseif ($_POST['receipient'] == 1) {
|
||||
} elseif ($_POST['recipient'] == 1) {
|
||||
if ($userinfo['customers_see_all'] == '1') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to ALL customers');
|
||||
$result = Database::query('SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`");
|
||||
@@ -49,7 +49,7 @@ if ($page == 'message') {
|
||||
));
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('noreceipientsgiven');
|
||||
\Froxlor\UI\Response::standard_error('norecipientsgiven');
|
||||
}
|
||||
|
||||
$subject = $_POST['subject'];
|
||||
@@ -105,7 +105,7 @@ if ($page == 'message') {
|
||||
$sentitems = isset($_GET['sentitems']) ? (int) $_GET['sentitems'] : 0;
|
||||
|
||||
if ($sentitems == 0) {
|
||||
$successmessage = $lng['message']['noreceipients'];
|
||||
$successmessage = $lng['message']['norecipients'];
|
||||
} else {
|
||||
$successmessage = str_replace('%s', $sentitems, $lng['message']['success']);
|
||||
}
|
||||
@@ -116,12 +116,12 @@ if ($page == 'message') {
|
||||
}
|
||||
|
||||
$action = '';
|
||||
$receipients = '';
|
||||
$recipients = '';
|
||||
|
||||
if ($userinfo['customers_see_all'] == '1') {
|
||||
$receipients .= \Froxlor\UI\HTML::makeoption($lng['panel']['reseller'], 0);
|
||||
$recipients .= \Froxlor\UI\HTML::makeoption($lng['panel']['reseller'], 0);
|
||||
}
|
||||
|
||||
$receipients .= \Froxlor\UI\HTML::makeoption($lng['panel']['customer'], 1);
|
||||
$recipients .= \Froxlor\UI\HTML::makeoption($lng['panel']['customer'], 1);
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('message/message') . "\";");
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ require './lib/init.php';
|
||||
|
||||
if ($action == 'reset' && function_exists('opcache_reset') && $userinfo['change_serversettings'] == '1') {
|
||||
opcache_reset();
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "reseted OPcache");
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "reset OPcache");
|
||||
header('Location: ' . $linker->getLink(array(
|
||||
'section' => 'opcacheinfo',
|
||||
'page' => 'showinfo'
|
||||
|
||||
@@ -56,6 +56,26 @@ if ($page == 'overview' || $page == 'customers') {
|
||||
$maxyears = date("Y") - $minyear['year'];
|
||||
}
|
||||
|
||||
$params = [];
|
||||
if ($userinfo['customers_see_all'] == '0') {
|
||||
$params = [
|
||||
'id' => $userinfo['adminid']
|
||||
];
|
||||
}
|
||||
$customer_name_list_stmt = Database::prepare("
|
||||
SELECT `customerid`,`company`,`name`,`firstname`
|
||||
FROM `" . TABLE_PANEL_CUSTOMERS . "`
|
||||
WHERE `deactivated`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :id") . "
|
||||
ORDER BY name"
|
||||
);
|
||||
|
||||
$traffic_list_stmt = Database::prepare("
|
||||
SELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
WHERE year = :year AND `customerid` = :id
|
||||
GROUP BY month ORDER BY month"
|
||||
);
|
||||
|
||||
for ($years = 0; $years <= $maxyears; $years ++) {
|
||||
|
||||
$overview['year'] = date("Y") - $years;
|
||||
@@ -76,14 +96,7 @@ if ($page == 'overview' || $page == 'customers') {
|
||||
'dec' => 0
|
||||
);
|
||||
|
||||
$customer_name_list_stmt = Database::prepare("
|
||||
SELECT `customerid`,`company`,`name`,`firstname`
|
||||
FROM `" . TABLE_PANEL_CUSTOMERS . "`
|
||||
WHERE `deactivated`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :id") . "
|
||||
ORDER BY name");
|
||||
Database::pexecute($customer_name_list_stmt, array(
|
||||
'id' => $userinfo['adminid']
|
||||
));
|
||||
Database::pexecute($customer_name_list_stmt, $params);
|
||||
|
||||
while ($customer_name = $customer_name_list_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
@@ -104,11 +117,6 @@ if ($page == 'overview' || $page == 'customers') {
|
||||
'dec' => '-'
|
||||
);
|
||||
|
||||
$traffic_list_stmt = Database::prepare("
|
||||
SELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
WHERE year = :year AND `customerid` = :id
|
||||
GROUP BY month ORDER BY month");
|
||||
Database::pexecute($traffic_list_stmt, array(
|
||||
'year' => (date("Y") - $years),
|
||||
'id' => $customer_name['customerid']
|
||||
|
||||
@@ -127,7 +127,7 @@ if ($action == 'delete') {
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed api::api_keys");
|
||||
|
||||
// select all my (accessable) certificates
|
||||
// select all my (accessible) certificates
|
||||
$keys_stmt_query = "SELECT ak.*, c.loginname, a.loginname as adminname
|
||||
FROM `" . TABLE_API_KEYS . "` ak
|
||||
LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` c ON `c`.`customerid` = `ak`.`customerid`
|
||||
|
||||
23
build.xml
23
build.xml
@@ -6,21 +6,20 @@
|
||||
<property name="pdepend" value="${basedir}/vendor/bin/pdepend" />
|
||||
<property name="phpcpd" value="${basedir}/vendor/bin/phpcpd" />
|
||||
<property name="phpcs" value="${basedir}/vendor/bin/phpcs" />
|
||||
<property name="phpdox" value="${basedir}/vendor/bin/phpdox" />
|
||||
<property name="phploc" value="${basedir}/vendor/bin/phploc" />
|
||||
<property name="phpmd" value="${basedir}/vendor/bin/phpmd" />
|
||||
<property name="phpunit" value="${basedir}/vendor/bin/phpunit" />
|
||||
|
||||
<target name="full-build"
|
||||
depends="prepare,composer,static-analysis,phpunit,phpdox,-check-failure"
|
||||
depends="prepare,composer,static-analysis,phpunit,-check-failure"
|
||||
description="Performs static analysis, runs the tests, and generates project documentation" />
|
||||
|
||||
<target name="full-build-parallel"
|
||||
depends="prepare,composer,static-analysis-parallel,phpunit,phpdox,-check-failure"
|
||||
depends="prepare,composer,static-analysis-parallel,phpunit,-check-failure"
|
||||
description="Performs static analysis (executing the tools in parallel), runs the tests, and generates project documentation" />
|
||||
|
||||
<target name="quick-build"
|
||||
depends="prepare,composer,lint,phpunit-no-coverage"
|
||||
depends="prepare,composer,lint,phpunit-no-coverage,-check-failure"
|
||||
description="Performs a lint check and runs the tests (without generating code coverage reports)" />
|
||||
|
||||
<target name="static-analysis"
|
||||
@@ -49,7 +48,6 @@
|
||||
<delete dir="${basedir}/build/coverage" />
|
||||
<delete dir="${basedir}/build/logs" />
|
||||
<delete dir="${basedir}/build/pdepend" />
|
||||
<delete dir="${basedir}/build/phpdox" />
|
||||
<property name="clean.done" value="true" />
|
||||
</target>
|
||||
|
||||
@@ -59,7 +57,6 @@
|
||||
<mkdir dir="${basedir}/build/coverage" />
|
||||
<mkdir dir="${basedir}/build/logs" />
|
||||
<mkdir dir="${basedir}/build/pdepend" />
|
||||
<mkdir dir="${basedir}/build/phpdox" />
|
||||
|
||||
<property name="prepare.done" value="true" />
|
||||
</target>
|
||||
@@ -257,7 +254,7 @@
|
||||
<target name="phpunit-no-coverage" unless="phpunit.done"
|
||||
depends="composer"
|
||||
description="Run unit tests with PHPUnit (without generating code coverage reports)">
|
||||
<exec executable="${phpunit}" failonerror="true"
|
||||
<exec executable="${phpunit}" failonerror="true" resultproperty="result.phpunit"
|
||||
taskname="phpunit">
|
||||
<arg value="--configuration" />
|
||||
<arg path="${basedir}/phpunit.xml" />
|
||||
@@ -269,18 +266,6 @@
|
||||
<property name="phpunit.done" value="true" />
|
||||
</target>
|
||||
|
||||
<target name="phpdox" unless="phpdox.done"
|
||||
depends="phploc-ci,phpcs-ci,phpcompat-ci,phpmd-ci"
|
||||
description="Generate project documentation using phpDox">
|
||||
<exec executable="${phpdox}" dir="${basedir}/build"
|
||||
taskname="phpdox">
|
||||
<arg value="--file" />
|
||||
<arg path="${basedir}/phpdox.xml" />
|
||||
</exec>
|
||||
|
||||
<property name="phpdox.done" value="true" />
|
||||
</target>
|
||||
|
||||
<target name="-check-failure">
|
||||
<fail message="PHPUnit did not finish successfully">
|
||||
<condition>
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
"issues": "https://github.com/Froxlor/Froxlor/issues",
|
||||
"forum": "https://forum.froxlor.org/",
|
||||
"wiki": "https://github.com/Froxlor/Froxlor/wiki",
|
||||
"irc": "irc://chat.freenode.net/froxlor",
|
||||
"irc": "irc://irc.libera.chat/froxlor",
|
||||
"source": "https://github.com/Froxlor/Froxlor",
|
||||
"docs": "https://github.com/Froxlor/Froxlor/wiki"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0",
|
||||
"php": ">=7.1",
|
||||
"ext-session": "*",
|
||||
"ext-ctype": "*",
|
||||
"ext-pdo": "*",
|
||||
@@ -43,23 +43,24 @@
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-openssl": "*",
|
||||
"ext-fileinfo": "*",
|
||||
"phpmailer/phpmailer": "~6.0",
|
||||
"monolog/monolog": "^1.24",
|
||||
"robthree/twofactorauth": "^1.6",
|
||||
"froxlor/idna-convert-legacy": "^2.1",
|
||||
"voku/anti-xss": "^4.1"
|
||||
},
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "8.4.1",
|
||||
"phpunit/phpunit": "^9",
|
||||
"php": ">=7.3",
|
||||
"ext-pcntl": "*",
|
||||
"phpcompatibility/php-compatibility": "*",
|
||||
"squizlabs/php_codesniffer": "*",
|
||||
"pdepend/pdepend": "^2.5",
|
||||
"sebastian/phpcpd": "^4.1",
|
||||
"theseer/phpdox": "^0.12.0",
|
||||
"phploc/phploc": "^5.0",
|
||||
"phpmd/phpmd": "^2.6"
|
||||
"pdepend/pdepend": "^2.9",
|
||||
"sebastian/phpcpd": "^6.0",
|
||||
"phploc/phploc": "^7.0",
|
||||
"phpmd/phpmd": "^2.10",
|
||||
"phpunit/php-timer" : "^5"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-bcmath": "*",
|
||||
|
||||
2152
composer.lock
generated
2152
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -153,7 +153,8 @@ if ($page == 'overview') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
Emails::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
'id' => $id,
|
||||
'delete_userfiles' => ($_POST['delete_userfiles'] ?? 0)
|
||||
))->delete();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
|
||||
@@ -93,22 +93,30 @@ if ($page == 'overview') {
|
||||
'cid' => $userinfo['customerid']
|
||||
));
|
||||
|
||||
if ($usages)
|
||||
{
|
||||
$userinfo['diskspace_used'] = round($usages['webspace'] / 1024, Settings::Get('panel.decimal_places'));
|
||||
$userinfo['mailspace_used'] = round($usages['mail'] / 1024, Settings::Get('panel.decimal_places'));
|
||||
$userinfo['dbspace_used'] = round($usages['mysql'] / 1024, Settings::Get('panel.decimal_places'));
|
||||
$userinfo['total_used'] = round(($usages['webspace'] + $usages['mail'] + $usages['mysql']) / 1024, Settings::Get('panel.decimal_places'));
|
||||
// get everything in bytes for the percentage calculation on the dashboard
|
||||
$userinfo['diskspace_bytes'] = ($userinfo['diskspace'] > -1) ? $userinfo['diskspace'] * 1024 : -1;
|
||||
$userinfo['traffic_bytes'] = ($userinfo['traffic'] > -1) ? $userinfo['traffic'] * 1024 : - 1;
|
||||
$userinfo['traffic_bytes_used'] = $userinfo['traffic_used'] * 1024;
|
||||
|
||||
if ($usages) {
|
||||
$userinfo['diskspace_used'] = \Froxlor\PhpHelper::sizeReadable($usages['webspace'] * 1024, null, 'bi');
|
||||
$userinfo['mailspace_used'] = \Froxlor\PhpHelper::sizeReadable($usages['mail'] * 1024, null, 'bi');
|
||||
$userinfo['dbspace_used'] = \Froxlor\PhpHelper::sizeReadable($usages['mysql'] * 1024, null, 'bi');
|
||||
$userinfo['total_used'] = \Froxlor\PhpHelper::sizeReadable(($usages['webspace'] + $usages['mail'] + $usages['mysql']) * 1024, null, 'bi');
|
||||
$userinfo['diskspace_bytes_used'] = $usages['webspace'] * 1024;
|
||||
$userinfo['total_bytes_used'] = ($usages['webspace'] + $usages['mail'] + $usages['mysql']) * 1024;
|
||||
} else {
|
||||
$userinfo['diskspace_used'] = 0;
|
||||
$userinfo['mailspace_used'] = 0;
|
||||
$userinfo['dbspace_used'] = 0;
|
||||
$userinfo['total_used'] = 0;
|
||||
$userinfo['diskspace_bytes_used'] = 0;
|
||||
$userinfo['total_bytes_used'] = 0;
|
||||
}
|
||||
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, Settings::Get('panel.decimal_places'));
|
||||
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
|
||||
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
|
||||
$userinfo = \Froxlor\PhpHelper::strReplaceArray('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
$userinfo['diskspace'] = ($userinfo['diskspace'] > -1) ? \Froxlor\PhpHelper::sizeReadable($userinfo['diskspace'] * 1024, null, 'bi') : - 1;
|
||||
$userinfo['traffic'] = ($userinfo['traffic'] > -1) ? \Froxlor\PhpHelper::sizeReadable($userinfo['traffic'] * 1024, null, 'bi') : - 1;
|
||||
$userinfo['traffic_used'] = \Froxlor\PhpHelper::sizeReadable($userinfo['traffic_used'] * 1024, null, 'bi');
|
||||
$userinfo = \Froxlor\PhpHelper::strReplaceArray('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace diskspace_bytes traffic traffic_bytes mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
|
||||
$userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : '';
|
||||
|
||||
@@ -123,19 +131,25 @@ if ($page == 'overview') {
|
||||
if ($userinfo['perlenabled'] == '1')
|
||||
$se[] = "Perl/CGI";
|
||||
if ($userinfo['api_allowed'] == '1')
|
||||
$se[] = '<a href="customer_index.php?s='.$s.'&page=apikeys">API</a>';
|
||||
$se[] = '<a href="customer_index.php?s=' . $s . '&page=apikeys">API</a>';
|
||||
$services_enabled = implode(", ", $se);
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/index') . "\";");
|
||||
} elseif ($page == 'change_password') {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$old_password = \Froxlor\Validate\Validate::validate($_POST['old_password'], 'old password');
|
||||
|
||||
if (! \Froxlor\System\Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_CUSTOMERS, 'customerid')) {
|
||||
\Froxlor\UI\Response::standard_error('oldpasswordnotcorrect');
|
||||
}
|
||||
|
||||
$new_password = \Froxlor\System\Crypt::validatePassword($_POST['new_password'], 'new password');
|
||||
$new_password_confirm = \Froxlor\System\Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm');
|
||||
try {
|
||||
$new_password = \Froxlor\System\Crypt::validatePassword($_POST['new_password'], 'new password');
|
||||
$new_password_confirm = \Froxlor\System\Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm');
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
|
||||
if ($old_password == '') {
|
||||
\Froxlor\UI\Response::standard_error(array(
|
||||
|
||||
14
index.php
14
index.php
@@ -28,6 +28,12 @@ if ($action == '') {
|
||||
}
|
||||
|
||||
if (session_status() == PHP_SESSION_NONE) {
|
||||
ini_set("session.name", "s");
|
||||
ini_set("url_rewriter.tags", "");
|
||||
ini_set("session.use_cookies", false);
|
||||
ini_set("session.cookie_httponly", true);
|
||||
ini_set("session.cookie_secure", $is_ssl);
|
||||
session_id('login');
|
||||
session_start();
|
||||
}
|
||||
|
||||
@@ -114,7 +120,7 @@ if ($action == '2fa_entercode') {
|
||||
));
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($row['customer'] == $loginname) {
|
||||
if ($row && $row['customer'] == $loginname) {
|
||||
$table = "`" . TABLE_PANEL_CUSTOMERS . "`";
|
||||
$uid = 'customerid';
|
||||
$adminsession = '0';
|
||||
@@ -142,7 +148,7 @@ if ($action == '2fa_entercode') {
|
||||
"loginname" => $loginname
|
||||
));
|
||||
$row3 = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row3['customer'] == $loginname) {
|
||||
if ($row3 && $row3['customer'] == $loginname) {
|
||||
$table = "`" . TABLE_PANEL_CUSTOMERS . "`";
|
||||
$uid = 'customerid';
|
||||
$adminsession = '0';
|
||||
@@ -181,7 +187,7 @@ if ($action == '2fa_entercode') {
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
if ($row['admin'] == $loginname) {
|
||||
if ($row && $row['admin'] == $loginname) {
|
||||
$table = "`" . TABLE_PANEL_ADMINS . "`";
|
||||
$uid = 'adminid';
|
||||
$adminsession = '1';
|
||||
@@ -669,7 +675,7 @@ function finishLogin($userinfo)
|
||||
global $version, $dbversion, $remote_addr, $http_user_agent, $languages;
|
||||
|
||||
if (isset($userinfo['userid']) && $userinfo['userid'] != '') {
|
||||
$s = md5(uniqid(microtime(), 1));
|
||||
$s = \Froxlor\Froxlor::genSessionId();
|
||||
|
||||
if (isset($_POST['language'])) {
|
||||
$language = \Froxlor\Validate\Validate::validate($_POST['language'], 'language');
|
||||
|
||||
@@ -15,10 +15,10 @@ CREATE TABLE `ftp_groups` (
|
||||
DROP TABLE IF EXISTS `ftp_users`;
|
||||
CREATE TABLE `ftp_users` (
|
||||
`id` int(20) NOT NULL auto_increment,
|
||||
`username` varchar(255) NOT NULL default '',
|
||||
`username` varchar(255) NOT NULL,
|
||||
`uid` int(5) NOT NULL default '0',
|
||||
`gid` int(5) NOT NULL default '0',
|
||||
`password` varchar(128) NOT NULL default '',
|
||||
`password` varchar(128) NOT NULL,
|
||||
`homedir` varchar(255) NOT NULL default '',
|
||||
`shell` varchar(255) NOT NULL default '/bin/false',
|
||||
`login_enabled` enum('N','Y') NOT NULL default 'N',
|
||||
@@ -71,6 +71,7 @@ CREATE TABLE `mail_virtual` (
|
||||
`customerid` int(11) NOT NULL default '0',
|
||||
`popaccountid` int(11) NOT NULL default '0',
|
||||
`iscatchall` tinyint(1) unsigned NOT NULL default '0',
|
||||
`description` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `email` (`email`)
|
||||
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
@@ -90,8 +91,8 @@ CREATE TABLE `panel_activation` (
|
||||
DROP TABLE IF EXISTS `panel_admins`;
|
||||
CREATE TABLE `panel_admins` (
|
||||
`adminid` int(11) unsigned NOT NULL auto_increment,
|
||||
`loginname` varchar(50) NOT NULL default '',
|
||||
`password` varchar(255) NOT NULL default '',
|
||||
`loginname` varchar(50) NOT NULL,
|
||||
`password` varchar(255) NOT NULL,
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
`email` varchar(255) NOT NULL default '',
|
||||
`def_language` varchar(100) NOT NULL default '',
|
||||
@@ -142,7 +143,7 @@ CREATE TABLE `panel_admins` (
|
||||
DROP TABLE IF EXISTS `panel_customers`;
|
||||
CREATE TABLE `panel_customers` (
|
||||
`customerid` int(11) unsigned NOT NULL auto_increment,
|
||||
`loginname` varchar(50) NOT NULL default '',
|
||||
`loginname` varchar(50) NOT NULL,
|
||||
`password` varchar(255) NOT NULL default '',
|
||||
`adminid` int(11) unsigned NOT NULL default '0',
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
@@ -223,7 +224,7 @@ CREATE TABLE `panel_databases` (
|
||||
DROP TABLE IF EXISTS `panel_domains`;
|
||||
CREATE TABLE `panel_domains` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`domain` varchar(255) NOT NULL default '',
|
||||
`domain` varchar(255) NOT NULL,
|
||||
`domain_ace` varchar(255) NOT NULL default '',
|
||||
`adminid` int(11) unsigned NOT NULL default '0',
|
||||
`customerid` int(11) unsigned NOT NULL default '0',
|
||||
@@ -269,12 +270,13 @@ CREATE TABLE `panel_domains` (
|
||||
`writeaccesslog` tinyint(1) DEFAULT '1',
|
||||
`writeerrorlog` tinyint(1) DEFAULT '1',
|
||||
`override_tls` tinyint(1) DEFAULT '0',
|
||||
`ssl_protocols` text,
|
||||
`ssl_cipher_list` text,
|
||||
`tlsv13_cipher_list` text,
|
||||
`ssl_protocols` varchar(255) NOT NULL DEFAULT '',
|
||||
`ssl_cipher_list` varchar(500) NOT NULL DEFAULT '',
|
||||
`tlsv13_cipher_list` varchar(500) NOT NULL DEFAULT '',
|
||||
`ssl_enabled` tinyint(1) DEFAULT '1',
|
||||
`ssl_honorcipherorder` tinyint(1) DEFAULT '0',
|
||||
`ssl_sessiontickets` tinyint(1) DEFAULT '1',
|
||||
`description` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customerid` (`customerid`),
|
||||
KEY `parentdomain` (`parentdomainid`),
|
||||
@@ -286,7 +288,7 @@ CREATE TABLE `panel_domains` (
|
||||
DROP TABLE IF EXISTS `panel_ipsandports`;
|
||||
CREATE TABLE `panel_ipsandports` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`ip` varchar(39) NOT NULL default '',
|
||||
`ip` varchar(39) NOT NULL,
|
||||
`port` int(5) NOT NULL default '80',
|
||||
`listen_statement` tinyint(1) NOT NULL default '0',
|
||||
`namevirtualhost_statement` tinyint(1) NOT NULL default '0',
|
||||
@@ -387,6 +389,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
|
||||
('dkim', 'dkim_domains', 'domains'),
|
||||
('dkim', 'dkim_dkimkeys', 'dkim-keys.conf'),
|
||||
('dkim', 'dkimrestart_command', '/etc/init.d/dkim-filter restart'),
|
||||
('dkim', 'privkeysuffix', '.priv'),
|
||||
('admin', 'show_news_feed', '0'),
|
||||
('admin', 'show_version_login', '0'),
|
||||
('admin', 'show_version_footer', '0'),
|
||||
@@ -608,6 +611,7 @@ opcache.interned_strings_buffer'),
|
||||
('system', 'documentroot_use_default_value', '0'),
|
||||
('system', 'passwordcryptfunc', '3'),
|
||||
('system', 'axfrservers', ''),
|
||||
('system', 'powerdns_mode', 'Native'),
|
||||
('system', 'customer_ssl_path', '/etc/ssl/froxlor-custom/'),
|
||||
('system', 'allow_error_report_admin', '1'),
|
||||
('system', 'allow_error_report_customer', '0'),
|
||||
@@ -625,7 +629,7 @@ opcache.interned_strings_buffer'),
|
||||
('system', 'apacheitksupport', '0'),
|
||||
('system', 'leprivatekey', 'unset'),
|
||||
('system', 'lepublickey', 'unset'),
|
||||
('system', 'letsencryptca', 'production'),
|
||||
('system', 'letsencryptca', 'letsencrypt'),
|
||||
('system', 'letsencryptcountrycode', 'DE'),
|
||||
('system', 'letsencryptstate', 'Hessen'),
|
||||
('system', 'letsencryptchallengepath', '/var/www/froxlor'),
|
||||
@@ -671,6 +675,13 @@ opcache.interned_strings_buffer'),
|
||||
('system', 'froxloraliases', ''),
|
||||
('system', 'apply_specialsettings_default', '1'),
|
||||
('system', 'apply_phpconfigs_default', '1'),
|
||||
('system', 'hide_incompatible_settings', '0'),
|
||||
('system', 'include_default_vhostconf', '0'),
|
||||
('system', 'soaemail', ''),
|
||||
('system', 'domaindefaultalias', '0'),
|
||||
('system', 'createstdsubdom_default', '1'),
|
||||
('system', 'froxlorusergroup', ''),
|
||||
('system', 'froxlorusergroup_gid', ''),
|
||||
('api', 'enabled', '0'),
|
||||
('2fa', 'enabled', '1'),
|
||||
('panel', 'decimal_places', '4'),
|
||||
@@ -683,7 +694,6 @@ opcache.interned_strings_buffer'),
|
||||
('panel', 'paging', '20'),
|
||||
('panel', 'natsorting', '1'),
|
||||
('panel', 'sendalternativemail', '0'),
|
||||
('panel', 'no_robots', '1'),
|
||||
('panel', 'allow_domain_change_admin', '0'),
|
||||
('panel', 'allow_domain_change_customer', '0'),
|
||||
('panel', 'frontend', 'froxlor'),
|
||||
@@ -705,8 +715,15 @@ opcache.interned_strings_buffer'),
|
||||
('panel', 'password_special_char', '!?<>§$%+#=@'),
|
||||
('panel', 'customer_hide_options', ''),
|
||||
('panel', 'is_configured', '0'),
|
||||
('panel', 'version', '0.10.22'),
|
||||
('panel', 'db_version', '202009070');
|
||||
('panel', 'imprint_url', ''),
|
||||
('panel', 'terms_url', ''),
|
||||
('panel', 'privacy_url', ''),
|
||||
('panel', 'logo_image_header', ''),
|
||||
('panel', 'logo_image_login', ''),
|
||||
('panel', 'logo_overridetheme', '0'),
|
||||
('panel', 'logo_overridecustom', '0'),
|
||||
('panel', 'version', '0.10.29'),
|
||||
('panel', 'db_version', '202109040');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `panel_tasks`;
|
||||
@@ -805,7 +822,8 @@ INSERT INTO `panel_languages` (`id`, `language`, `iso`, `file`) VALUES
|
||||
(4, 'Português', 'pt', 'lng/portugues.lng.php'),
|
||||
(5, 'Italiano', 'it', 'lng/italian.lng.php'),
|
||||
(6, 'Nederlands', 'nl', 'lng/dutch.lng.php'),
|
||||
(7, 'Svenska', 'sv', 'lng/swedish.lng.php');
|
||||
(7, 'Svenska', 'sv', 'lng/swedish.lng.php'),
|
||||
(8, 'Česká republika', 'cs', 'lng/czech.lng.php');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `panel_syslog`;
|
||||
@@ -923,7 +941,7 @@ CREATE TABLE IF NOT EXISTS `ftp_quotalimits` (
|
||||
|
||||
|
||||
|
||||
INSERT INTO `ftp_quotalimits` (`name`, `quota_type`, `per_session`, `limit_type`, `bytes_in_avail`, `bytes_out_avail`, `bytes_xfer_avail`, `files_in_avail`, `files_out_avail`, `files_xfer_avail`) VALUES
|
||||
INSERT INTO `ftp_quotalimits` (`name`, `quota_type`, `per_session`, `limit_type`, `bytes_in_avail`, `bytes_out_avail`, `bytes_xfer_avail`, `files_in_avail`, `files_out_avail`, `files_xfer_avail`) VALUES
|
||||
('froxlor', 'user', 'false', 'hard', 0, 0, 0, 0, 0, 0);
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Install
|
||||
*
|
||||
*
|
||||
*/
|
||||
class FroxlorInstall
|
||||
{
|
||||
@@ -123,7 +123,7 @@ class FroxlorInstall
|
||||
if ((isset($_POST['installstep']) && $_POST['installstep'] == '1') || (isset($_GET['check']) && $_GET['check'] == '1')) {
|
||||
$pagetitle = $this->_lng['install']['title'];
|
||||
if ($this->_checkPostData()) {
|
||||
// ceck data and create userdata etc.etc.etc.
|
||||
// check data and create userdata etc.etc.etc.
|
||||
$result = $this->_doInstall();
|
||||
} elseif (isset($_GET['check']) && $_GET['check'] == '1') {
|
||||
// gather data
|
||||
@@ -163,10 +163,13 @@ class FroxlorInstall
|
||||
|
||||
$this->_getPostField('mysql_host', '127.0.0.1');
|
||||
$this->_getPostField('mysql_database', 'froxlor');
|
||||
$this->_getPostField('mysql_forcecreate', '0');
|
||||
$this->_getPostField('mysql_unpriv_user', 'froxlor');
|
||||
$this->_getPostField('mysql_unpriv_pass');
|
||||
$this->_getPostField('mysql_root_user', 'root');
|
||||
$this->_getPostField('mysql_root_pass');
|
||||
$this->_getPostField('mysql_ssl_ca_file');
|
||||
$this->_getPostField('mysql_ssl_verify_server_certificate', 0);
|
||||
$this->_getPostField('admin_user', 'admin');
|
||||
$this->_getPostField('admin_pass1');
|
||||
$this->_getPostField('admin_pass2');
|
||||
@@ -212,6 +215,12 @@ class FroxlorInstall
|
||||
$options = array(
|
||||
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8'
|
||||
);
|
||||
|
||||
if (!empty($this->_data['mysql_ssl_ca_file'])) {
|
||||
$options[\PDO::MYSQL_ATTR_SSL_CA] = $this->_data['mysql_ssl_ca_file'];
|
||||
$options[\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = (bool) $this->_data['mysql_ssl_verify_server_certificate'];
|
||||
}
|
||||
|
||||
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";";
|
||||
$fatal_fail = false;
|
||||
try {
|
||||
@@ -246,15 +255,23 @@ class FroxlorInstall
|
||||
$content .= $this->_status_message('green', "OK");
|
||||
// check for existing db and create backup if so
|
||||
$content .= $this->_backupExistingDatabase($db_root);
|
||||
// create unprivileged user and the database itself
|
||||
$content .= $this->_createDatabaseAndUser($db_root);
|
||||
// importing data to new database
|
||||
$content .= $this->_importDatabaseData();
|
||||
if (!$this->_abort) {
|
||||
// create unprivileged user and the database itself
|
||||
$content .= $this->_createDatabaseAndUser($db_root);
|
||||
// importing data to new database
|
||||
$content .= $this->_importDatabaseData();
|
||||
}
|
||||
if (! $this->_abort) {
|
||||
// create DB object for new database
|
||||
$options = array(
|
||||
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8'
|
||||
);
|
||||
|
||||
if (!empty($this->_data['mysql_ssl_ca_file'])) {
|
||||
$options[\PDO::MYSQL_ATTR_SSL_CA] = $this->_data['mysql_ssl_ca_file'];
|
||||
$options[\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = (bool) $this->_data['mysql_ssl_verify_server_certificate'];
|
||||
}
|
||||
|
||||
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";dbname=" . $this->_data['mysql_database'] . ";";
|
||||
$another_fail = false;
|
||||
try {
|
||||
@@ -324,10 +341,14 @@ class FroxlorInstall
|
||||
$userdata .= "\$sql['user']='" . addcslashes($this->_data['mysql_unpriv_user'], "'\\") . "';\n";
|
||||
$userdata .= "\$sql['password']='" . addcslashes($this->_data['mysql_unpriv_pass'], "'\\") . "';\n";
|
||||
$userdata .= "\$sql['db']='" . addcslashes($this->_data['mysql_database'], "'\\") . "';\n";
|
||||
$userdata .= "\$sql['ssl']['caFile']='" . addcslashes($this->_data['mysql_ssl_ca_file'], "'\\") . "';\n";
|
||||
$userdata .= "\$sql['ssl']['verifyServerCertificate']='" . addcslashes($this->_data['mysql_ssl_verify_server_certificate'], "'\\") . "';\n";
|
||||
$userdata .= "\$sql_root[0]['caption']='Default';\n";
|
||||
$userdata .= "\$sql_root[0]['host']='" . addcslashes($this->_data['mysql_host'], "'\\") . "';\n";
|
||||
$userdata .= "\$sql_root[0]['user']='" . addcslashes($this->_data['mysql_root_user'], "'\\") . "';\n";
|
||||
$userdata .= "\$sql_root[0]['password']='" . addcslashes($this->_data['mysql_root_pass'], "'\\") . "';\n";
|
||||
$userdata .= "\$sql_root[0]['ssl']['caFile']='" . addcslashes($this->_data['mysql_ssl_ca_file'], "'\\") . "';\n";
|
||||
$userdata .= "\$sql_root[0]['ssl']['verifyServerCertificate']='" . addcslashes($this->_data['mysql_ssl_verify_server_certificate'], "'\\") . "';\n";
|
||||
$userdata .= "// enable debugging to browser in case of SQL errors\n";
|
||||
$userdata .= "\$sql['debug'] = false;\n";
|
||||
$userdata .= "?>";
|
||||
@@ -360,6 +381,30 @@ class FroxlorInstall
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate safe unique token
|
||||
*
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
private function genUniqueToken(int $length = 16)
|
||||
{
|
||||
if(!isset($length) || intval($length) <= 8 ){
|
||||
$length = 16;
|
||||
}
|
||||
if (function_exists('random_bytes')) {
|
||||
return bin2hex(random_bytes($length));
|
||||
}
|
||||
if (function_exists('mcrypt_create_iv')) {
|
||||
return bin2hex(mcrypt_create_iv($length, MCRYPT_DEV_URANDOM));
|
||||
}
|
||||
if (function_exists('openssl_random_pseudo_bytes')) {
|
||||
return bin2hex(openssl_random_pseudo_bytes($length));
|
||||
}
|
||||
// if everything else fails, use unsafe fallback
|
||||
return md5(uniqid(microtime(), 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* create corresponding entries in froxlor database
|
||||
*
|
||||
@@ -403,8 +448,8 @@ class FroxlorInstall
|
||||
$content .= $this->_status_message('begin', $this->_lng['install']['adding_admin_user']);
|
||||
$ins_data = array(
|
||||
'loginname' => $this->_data['admin_user'],
|
||||
/* use SHA256 default crypt */
|
||||
'password' => crypt($this->_data['admin_pass1'], '$5$' . md5(uniqid(microtime(), 1)) . md5(uniqid(microtime(), 1))),
|
||||
/* use SHA256 default crypt */
|
||||
'password' => crypt($this->_data['admin_pass1'], '$5$' . $this->genUniqueToken() . $this->genUniqueToken()),
|
||||
'email' => 'admin@' . $this->_data['servername'],
|
||||
'deflang' => $this->_languages[$this->_activelng]
|
||||
);
|
||||
@@ -507,7 +552,7 @@ class FroxlorInstall
|
||||
|
||||
$distros = glob(\Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . '/lib/configfiles/') . '*.xml');
|
||||
foreach ($distros as $_distribution) {
|
||||
if($this->_data['distribution'] == str_replace(".xml", "", strtolower(basename($_distribution)))) {
|
||||
if ($this->_data['distribution'] == str_replace(".xml", "", strtolower(basename($_distribution)))) {
|
||||
$dist = new \Froxlor\Config\ConfigParser($_distribution);
|
||||
$defaults = $dist->getDefaults();
|
||||
foreach ($defaults->property as $property) {
|
||||
@@ -522,6 +567,13 @@ class FroxlorInstall
|
||||
// insert the lastcronrun to be the installation date
|
||||
$this->_updateSetting($upd_stmt, time(), 'system', 'lastcronrun');
|
||||
|
||||
// check currently used php version and set values of fpm/fcgid accordingly
|
||||
if (defined('PHP_MAJOR_VERSION') && defined('PHP_MINOR_VERSION')) {
|
||||
$reload = "service php" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "-fpm restart";
|
||||
$config_dir = "/etc/php/" . PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "/fpm/pool.d/";
|
||||
$db->query("UPDATE `" . TABLE_PANEL_FPMDAEMONS . "` SET `reload_cmd` = '" . $reload . "', `config_dir` = '" . $config_dir . "' WHERE `id` ='1';");
|
||||
}
|
||||
|
||||
// set specific times for some crons (traffic only at night, etc.)
|
||||
$ts = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `lastrun` = '" . $ts . "' WHERE `cronfile` ='cron_traffic';");
|
||||
@@ -548,6 +600,12 @@ class FroxlorInstall
|
||||
$options = array(
|
||||
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8'
|
||||
);
|
||||
|
||||
if (!empty($this->_data['mysql_ssl_ca_file'])) {
|
||||
$options[\PDO::MYSQL_ATTR_SSL_CA] = $this->_data['mysql_ssl_ca_file'];
|
||||
$options[\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = (bool) $this->_data['mysql_ssl_verify_server_certificate'];
|
||||
}
|
||||
|
||||
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";dbname=" . $this->_data['mysql_database'] . ";";
|
||||
$fatal_fail = false;
|
||||
try {
|
||||
@@ -680,7 +738,7 @@ class FroxlorInstall
|
||||
if (version_compare($db_root->getAttribute(\PDO::ATTR_SERVER_VERSION), '8.0.11', '>=')) {
|
||||
// create user
|
||||
$stmt = $db_root->prepare("
|
||||
CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED BY :password
|
||||
CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED WITH mysql_native_password BY :password
|
||||
");
|
||||
$stmt->execute(array(
|
||||
"password" => $password
|
||||
@@ -726,13 +784,17 @@ class FroxlorInstall
|
||||
));
|
||||
$rows = $db_root->query("SELECT FOUND_ROWS()")->fetchColumn();
|
||||
|
||||
$content .= $this->_status_message('begin', $this->_lng['install']['check_db_exists']);
|
||||
|
||||
// check result
|
||||
if ($result_stmt !== false && $rows > 0) {
|
||||
$tables_exist = true;
|
||||
}
|
||||
|
||||
if ($tables_exist) {
|
||||
// tell whats going on
|
||||
if ($tables_exist && (int)$this->_data['mysql_forcecreate'] > 0) {
|
||||
// set status
|
||||
$content .= $this->_status_message('orange', 'exists (' . $this->_data['mysql_database'] . ')');
|
||||
// tell what's going on
|
||||
$content .= $this->_status_message('begin', $this->_lng['install']['backup_old_db']);
|
||||
|
||||
// create temporary backup-filename
|
||||
@@ -748,17 +810,29 @@ class FroxlorInstall
|
||||
$mysql_dump = '/usr/local/bin/mysqldump';
|
||||
}
|
||||
|
||||
// create temporary .cnf file
|
||||
$cnffilename = "/tmp/froxlor_dump.cnf";
|
||||
$dumpcnf = "[mysqldump]".PHP_EOL."password=\"".$this->_data['mysql_root_pass']."\"".PHP_EOL;
|
||||
file_put_contents($cnffilename, $dumpcnf);
|
||||
|
||||
if ($do_backup) {
|
||||
$command = $mysql_dump . " " . escapeshellarg($this->_data['mysql_database']) . " -u " . escapeshellarg($this->_data['mysql_root_user']) . " --password='" . escapeshellarg($this->_data['mysql_root_pass']) . "' --result-file=" . $filename;
|
||||
$output = exec($command);
|
||||
if (stristr($output, "error")) {
|
||||
$command = $mysql_dump . " --defaults-extra-file=" . $cnffilename . " " . escapeshellarg($this->_data['mysql_database']) . " -u " . escapeshellarg($this->_data['mysql_root_user']) . " --result-file=" . $filename;
|
||||
$output = [];
|
||||
exec($command, $output);
|
||||
@unlink($cnffilename);
|
||||
if (stristr(implode(" ", $output), "error") || !file_exists($filename)) {
|
||||
$content .= $this->_status_message('red', $this->_lng['install']['backup_failed']);
|
||||
$this->_abort = true;
|
||||
} else {
|
||||
$content .= $this->_status_message('green', 'OK (' . $filename . ')');
|
||||
}
|
||||
} else {
|
||||
$content .= $this->_status_message('red', $this->_lng['install']['backup_binary_missing']);
|
||||
$this->_abort = true;
|
||||
}
|
||||
} else {
|
||||
$content .= $this->_status_message('red', $this->_lng['install']['db_exists']);
|
||||
$this->_abort = true;
|
||||
}
|
||||
|
||||
return $content;
|
||||
@@ -777,7 +851,7 @@ class FroxlorInstall
|
||||
}
|
||||
// language selection
|
||||
$language_options = '';
|
||||
foreach ($this->_languages as $language_name => $language_file) {
|
||||
foreach ($this->_languages as $language_file => $language_name) {
|
||||
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $this->_activelng, true, true);
|
||||
}
|
||||
// get language-form-template
|
||||
@@ -794,6 +868,8 @@ class FroxlorInstall
|
||||
$formdata .= $this->_getSectionItemString('mysql_host', true);
|
||||
// database
|
||||
$formdata .= $this->_getSectionItemString('mysql_database', true);
|
||||
// database overwrite if exists?
|
||||
$formdata .= $this->_getSectionItemYesNo('mysql_forcecreate', false);
|
||||
// unpriv-user has to be different from root
|
||||
if ($this->_data['mysql_unpriv_user'] == $this->_data['mysql_root_user']) {
|
||||
$style = 'blue';
|
||||
@@ -823,6 +899,9 @@ class FroxlorInstall
|
||||
}
|
||||
$formdata .= $this->_getSectionItemString('mysql_root_pass', true, $style, 'password');
|
||||
|
||||
$formdata .= $this->_getSectionItemString('mysql_ssl_ca_file', false, $style);
|
||||
$formdata .= $this->_getSectionItemYesNo('mysql_ssl_verify_server_certificate', false, $style);
|
||||
|
||||
/**
|
||||
* admin data
|
||||
*/
|
||||
@@ -860,20 +939,25 @@ class FroxlorInstall
|
||||
}
|
||||
|
||||
// show list of available distro's
|
||||
$distributions_select_data = [];
|
||||
$distros = glob(\Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . '/lib/configfiles/') . '*.xml');
|
||||
foreach ($distros as $_distribution) {
|
||||
$dist = new \Froxlor\Config\ConfigParser($_distribution);
|
||||
$dist_display = $dist->distributionName." ".$dist->distributionCodename." (" . $dist->distributionVersion . ")";
|
||||
$dist_display = $dist->distributionName . " " . $dist->distributionCodename . " (" . $dist->distributionVersion . ")";
|
||||
if (!array_key_exists($dist_display, $distributions_select_data)) {
|
||||
$distributions_select_data[$dist_display] = '';
|
||||
}
|
||||
$distributions_select_data[$dist_display] .= str_replace(".xml", "", strtolower(basename($_distribution)));
|
||||
}
|
||||
|
||||
// sort by distribution name
|
||||
ksort($distributions_select_data);
|
||||
|
||||
$distributions_select = '';
|
||||
foreach ($distributions_select_data as $dist_display => $dist_index) {
|
||||
// create select-box-option
|
||||
$distributions_select .= \Froxlor\UI\HTML::makeoption($dist_display, $dist_index, $this->_data['distribution']);
|
||||
//$this->_data['distribution']
|
||||
$distributions_select .= \Froxlor\UI\HTML::makeoption($dist_display, $dist_index, $this->_data['distribution'] ?? '');
|
||||
// $this->_data['distribution']
|
||||
}
|
||||
|
||||
$formdata .= $this->_getSectionItemSelectbox('distribution', $distributions_select, $diststyle);
|
||||
@@ -940,7 +1024,7 @@ class FroxlorInstall
|
||||
* optional css
|
||||
* @param string $type
|
||||
* optional type of input-box (default: text)
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getSectionItemString($fieldname = null, $required = false, $style = "", $type = 'text')
|
||||
@@ -956,7 +1040,7 @@ class FroxlorInstall
|
||||
}
|
||||
|
||||
/**
|
||||
* generate form radio field
|
||||
* generate form radio field
|
||||
*
|
||||
* @param string $fieldname
|
||||
* @param boolean $checked
|
||||
@@ -987,7 +1071,6 @@ class FroxlorInstall
|
||||
*/
|
||||
private function _getSectionItemSelectbox($fieldname = null, $options = null, $style = "")
|
||||
{
|
||||
$groupname = $this->_lng['install'][$groupname];
|
||||
$fieldlabel = $this->_lng['install'][$fieldname];
|
||||
|
||||
$sectionitem = "";
|
||||
@@ -1029,11 +1112,11 @@ class FroxlorInstall
|
||||
// check for correct php version
|
||||
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpversion']);
|
||||
|
||||
if (version_compare("7.0.0", PHP_VERSION, ">=")) {
|
||||
if (version_compare("7.1.0", PHP_VERSION, ">=")) {
|
||||
$content .= $this->_status_message('red', $this->_lng['requirements']['notfound'] . ' (' . PHP_VERSION . ')');
|
||||
$_die = true;
|
||||
} else {
|
||||
if (version_compare("7.1.0", PHP_VERSION, ">=")) {
|
||||
if (version_compare("7.4.0", PHP_VERSION, ">=")) {
|
||||
$content .= $this->_status_message('orange', $this->_lng['requirements']['newerphpprefered'] . ' (' . PHP_VERSION . ')');
|
||||
} else {
|
||||
$content .= $this->_status_message('green', PHP_VERSION);
|
||||
@@ -1232,7 +1315,7 @@ class FroxlorInstall
|
||||
*
|
||||
* @param string $template
|
||||
* name of the template including subdirectory
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getTemplate($template = null)
|
||||
@@ -1299,10 +1382,12 @@ class FroxlorInstall
|
||||
// from form
|
||||
if (! empty($_POST['serverip'])) {
|
||||
$this->_data['serverip'] = $_POST['serverip'];
|
||||
$this->_data['serverip'] = inet_ntop(inet_pton($this->_data['serverip']));
|
||||
return;
|
||||
// from $_SERVER
|
||||
} elseif (! empty($_SERVER['SERVER_ADDR'])) {
|
||||
$this->_data['serverip'] = $_SERVER['SERVER_ADDR'];
|
||||
$this->_data['serverip'] = inet_ntop(inet_pton($this->_data['serverip']));
|
||||
return;
|
||||
}
|
||||
// empty
|
||||
@@ -1331,7 +1416,6 @@ class FroxlorInstall
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get/guess linux distribution
|
||||
*/
|
||||
@@ -1341,15 +1425,26 @@ class FroxlorInstall
|
||||
if (! empty($_POST['distribution'])) {
|
||||
$this->_data['distribution'] = $_POST['distribution'];
|
||||
} else {
|
||||
//set default os.
|
||||
$os_dist = array('ID' => 'buster');
|
||||
$os_version = array('0' => '10');
|
||||
// set default os.
|
||||
$os_dist = array(
|
||||
'ID' => 'buster'
|
||||
);
|
||||
$os_version = array(
|
||||
'0' => '10'
|
||||
);
|
||||
|
||||
//read os-release
|
||||
if(file_exists('/etc/os-release')) {
|
||||
$os_dist = parse_ini_file('/etc/os-release', false);
|
||||
if(is_array($os_dist) && array_key_exists('ID', $os_dist) && array_key_exists('VERSION_ID', $os_dist)) {
|
||||
$os_version = explode('.',$os_dist['VERSION_ID'])[0];
|
||||
// read os-release
|
||||
if (file_exists('/etc/os-release')) {
|
||||
$os_dist_content = file_get_contents('/etc/os-release');
|
||||
$os_dist_arr = explode("\n", $os_dist_content);
|
||||
$os_dist = [];
|
||||
foreach ($os_dist_arr as $os_dist_line) {
|
||||
if (empty(trim($os_dist_line))) continue;
|
||||
$tmp = explode("=", $os_dist_line);
|
||||
$os_dist[$tmp[0]] = str_replace('"', "", trim($tmp[1]));
|
||||
}
|
||||
if (is_array($os_dist) && array_key_exists('ID', $os_dist) && array_key_exists('VERSION_ID', $os_dist)) {
|
||||
$os_version = explode('.', $os_dist['VERSION_ID'])[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
function showUpdateStep($task = null, $needs_status = true)
|
||||
{
|
||||
set_time_limit(30);
|
||||
if (! $needs_status)
|
||||
echo "<b>";
|
||||
|
||||
@@ -41,7 +42,6 @@ function showUpdateStep($task = null, $needs_status = true)
|
||||
}
|
||||
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, $task);
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, $task);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +82,6 @@ function lastStepStatus($status = -1, $message = '')
|
||||
|
||||
if ($status == - 1 || $status == 2) {
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
|
||||
} elseif ($status == 0 || $status == 1) {
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Success');
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ $lng['requirements']['notfound'] = 'not found';
|
||||
$lng['requirements']['notinstalled'] = 'not installed';
|
||||
$lng['requirements']['activated'] = 'enabled';
|
||||
$lng['requirements']['phpversion'] = 'PHP version >= 7.0';
|
||||
$lng['requirements']['newerphpprefered'] = 'Good, but php-7.1 is prefered.';
|
||||
$lng['requirements']['newerphpprefered'] = 'Good, but php-7.1 is preferred.';
|
||||
$lng['requirements']['phppdo'] = 'PHP PDO extension and PDO-MySQL driver...';
|
||||
$lng['requirements']['phpsession'] = 'PHP session-extension...';
|
||||
$lng['requirements']['phpctype'] = 'PHP ctype-extension...';
|
||||
@@ -39,7 +39,7 @@ $lng['requirements']['phpjson'] = 'PHP json-extension...';
|
||||
$lng['requirements']['bcmathdescription'] = 'Traffic-calculation related functions will not work correctly!';
|
||||
$lng['requirements']['zipdescription'] = 'The auto-update feature requires the zip extension.';
|
||||
$lng['requirements']['openbasedir'] = 'open_basedir...';
|
||||
$lng['requirements']['openbasedirenabled'] = 'Froxlor will not work properly with open_basedir enabled. Please disable open_basedir for Froxlor in the coresponding php.ini';
|
||||
$lng['requirements']['openbasedirenabled'] = 'Froxlor will not work properly with open_basedir enabled. Please disable open_basedir for Froxlor in the corresponding php.ini';
|
||||
$lng['requirements']['mysqldump'] = 'MySQL dump tool';
|
||||
$lng['requirements']['mysqldumpmissing'] = 'Automatic backup of possible existing database is not possible. Please install mysql-client tools';
|
||||
$lng['requirements']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Try to fix them and retry.';
|
||||
@@ -53,10 +53,13 @@ $lng['install']['welcometext'] = 'Thank you for choosing Froxlor. Please fill ou
|
||||
$lng['install']['database'] = 'Database connection';
|
||||
$lng['install']['mysql_host'] = 'MySQL-Hostname';
|
||||
$lng['install']['mysql_database'] = 'Database name';
|
||||
$lng['install']['mysql_forcecreate'] = 'Backup and overwrite database if exists?';
|
||||
$lng['install']['mysql_unpriv_user'] = 'Username for the unprivileged MySQL-account';
|
||||
$lng['install']['mysql_unpriv_pass'] = 'Password for the unprivileged MySQL-account';
|
||||
$lng['install']['mysql_root_user'] = 'Username for the MySQL-root-account';
|
||||
$lng['install']['mysql_root_pass'] = 'Password for the MySQL-root-account';
|
||||
$lng['install']['mysql_ssl_ca_file'] = 'MySQL server certificate file path';
|
||||
$lng['install']['mysql_ssl_verify_server_certificate'] = 'Verify MySQL TLS certificate';
|
||||
$lng['install']['admin_account'] = 'Administrator Account';
|
||||
$lng['install']['admin_user'] = 'Administrator Username';
|
||||
$lng['install']['admin_pass1'] = 'Administrator Password';
|
||||
@@ -79,6 +82,8 @@ $lng['install']['testing_mysql_fail'] = 'There seems to be a problem with the da
|
||||
$lng['install']['backup_old_db'] = 'Creating backup of old database...';
|
||||
$lng['install']['backup_binary_missing'] = 'Could not find mysqldump';
|
||||
$lng['install']['backup_failed'] = 'Could not backup database';
|
||||
$lng['install']['check_db_exists'] = 'Checking database...';
|
||||
$lng['install']['db_exists'] = 'Unable to create database. A database with the same name exists and should not be overwritten';
|
||||
$lng['install']['prepare_db'] = 'Preparing database...';
|
||||
$lng['install']['create_mysqluser_and_db'] = 'Creating database and username...';
|
||||
$lng['install']['testing_new_db'] = 'Testing if database and user have been created correctly...';
|
||||
|
||||
@@ -53,10 +53,13 @@ $lng['install']['welcometext'] = 'Vielen Dank dass Sie sich für Froxlor entschi
|
||||
$lng['install']['database'] = 'Datenbankverbindung';
|
||||
$lng['install']['mysql_host'] = 'MySQL-Hostname';
|
||||
$lng['install']['mysql_database'] = 'Datenbank Name';
|
||||
$lng['install']['mysql_forcecreate'] = 'Datenbank sichern und überschreiben wenn vorhanden?';
|
||||
$lng['install']['mysql_unpriv_user'] = 'Benutzername für den unprivilegierten MySQL-Account';
|
||||
$lng['install']['mysql_unpriv_pass'] = 'Passwort für den unprivilegierten MySQL-Account';
|
||||
$lng['install']['mysql_root_user'] = 'Benutzername für den MySQL-Root-Account';
|
||||
$lng['install']['mysql_root_pass'] = 'Passwort für den MySQL-Root-Account';
|
||||
$lng['install']['mysql_ssl_ca_file'] = 'MySQL-Server Zertifikatspfad';
|
||||
$lng['install']['mysql_ssl_verify_server_certificate'] = 'Validieren des MySQL-Server Zertifikats';
|
||||
$lng['install']['admin_account'] = 'Admin-Zugang';
|
||||
$lng['install']['admin_user'] = 'Administrator-Benutzername';
|
||||
$lng['install']['admin_pass1'] = 'Administrator-Passwort';
|
||||
@@ -79,6 +82,8 @@ $lng['install']['testing_mysql_fail'] = 'Bei der Verwendung der Datenbank gibt e
|
||||
$lng['install']['backup_old_db'] = 'Sicherung vorheriger Datenbank...';
|
||||
$lng['install']['backup_binary_missing'] = 'Konnte mysqldump nicht finden';
|
||||
$lng['install']['backup_failed'] = 'Sicherung fehlgeschlagen';
|
||||
$lng['install']['check_db_exists'] = 'Databenbank wird geprüft...';
|
||||
$lng['install']['db_exists'] = 'Datenbank kann nicht erstellt werden. Eine Datenbank mit dem selben Namen existiert bereits und soll nicht überschrieben werden.';
|
||||
$lng['install']['prepare_db'] = 'Datenbank wird vorbereitet...';
|
||||
$lng['install']['create_mysqluser_and_db'] = 'Erstelle Datenbank und Benutzer...';
|
||||
$lng['install']['testing_new_db'] = 'Teste, ob Datenbank und Benutzer korrekt angelegt wurden...';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Validate\Validate;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
@@ -14,7 +15,7 @@ use Froxlor\Settings;
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Install
|
||||
*
|
||||
*
|
||||
*/
|
||||
if (! defined('_CRON_UPDATE')) {
|
||||
if (! defined('AREA') || (defined('AREA') && AREA != 'admin') || ! isset($userinfo['loginname']) || (isset($userinfo['loginname']) && $userinfo['loginname'] == '')) {
|
||||
@@ -692,3 +693,248 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.10.21')) {
|
||||
showUpdateStep("Updating from 0.10.21 to 0.10.22", false);
|
||||
\Froxlor\Froxlor::updateToVersion('0.10.22');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.22')) {
|
||||
showUpdateStep("Updating from 0.10.22 to 0.10.23", false);
|
||||
\Froxlor\Froxlor::updateToVersion('0.10.23');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.23')) {
|
||||
showUpdateStep("Updating from 0.10.23 to 0.10.23.1", false);
|
||||
\Froxlor\Froxlor::updateToVersion('0.10.23.1');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202009070')) {
|
||||
|
||||
showUpdateStep("Adding setting to hide incompatible settings", true);
|
||||
Settings::AddNew("system.hide_incompatible_settings", '0');
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('202012300');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202012300')) {
|
||||
|
||||
showUpdateStep("Adding setting for DKIM private key extension/suffix", true);
|
||||
Settings::AddNew("dkim.privkeysuffix", '.priv');
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('202101200');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.23.1')) {
|
||||
showUpdateStep("Updating from 0.10.23.1 to 0.10.24", false);
|
||||
\Froxlor\Froxlor::updateToVersion('0.10.24');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202101200')) {
|
||||
|
||||
showUpdateStep("Adding setting for mail address used in SOA records", true);
|
||||
Settings::AddNew("system.soaemail", '');
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('202102200');
|
||||
}
|
||||
|
||||
/*
|
||||
* skip due to potential "1118 Row size too large" error
|
||||
*
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202102200')) {
|
||||
|
||||
showUpdateStep("Add new description fields to mail and domain table", true);
|
||||
Database::query("ALTER TABLE panel_domains ADD `description` varchar(255) NOT NULL DEFAULT '' AFTER `ssl_sessiontickets`;");
|
||||
Database::query("ALTER TABLE mail_virtual ADD `description` varchar(255) NOT NULL DEFAULT '' AFTER `iscatchall`");
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('202103030');
|
||||
}
|
||||
*/
|
||||
|
||||
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.24')) {
|
||||
showUpdateStep("Updating from 0.10.24 to 0.10.25", false);
|
||||
\Froxlor\Froxlor::updateToVersion('0.10.25');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202102200') || \Froxlor\Froxlor::isDatabaseVersion('202103030')) {
|
||||
|
||||
showUpdateStep("Refactoring columns from large tables", true);
|
||||
Database::query("ALTER TABLE panel_domains CHANGE `ssl_protocols` `ssl_protocols` varchar(255) NOT NULL DEFAULT '';");
|
||||
Database::query("ALTER TABLE panel_domains CHANGE `ssl_cipher_list` `ssl_cipher_list` varchar(500) NOT NULL DEFAULT '';");
|
||||
Database::query("ALTER TABLE panel_domains CHANGE `tlsv13_cipher_list` `tlsv13_cipher_list` varchar(500) NOT NULL DEFAULT '';");
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Add new description fields to mail and domain table", true);
|
||||
$result = Database::query("DESCRIBE `panel_domains`");
|
||||
$columnfound = 0;
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($row['Field'] == 'description') {
|
||||
$columnfound = 1;
|
||||
}
|
||||
}
|
||||
if (! $columnfound) {
|
||||
Database::query("ALTER TABLE panel_domains ADD `description` varchar(255) NOT NULL DEFAULT '' AFTER `ssl_sessiontickets`;");
|
||||
}
|
||||
$result = Database::query("DESCRIBE `mail_virtual`");
|
||||
$columnfound = 0;
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($row['Field'] == 'description') {
|
||||
$columnfound = 1;
|
||||
}
|
||||
}
|
||||
if (! $columnfound) {
|
||||
Database::query("ALTER TABLE mail_virtual ADD `description` varchar(255) NOT NULL DEFAULT '' AFTER `iscatchall`");
|
||||
}
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('202103110');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202103110')) {
|
||||
|
||||
showUpdateStep("Adding settings for imprint, terms of use and privacy policy URLs", true);
|
||||
Settings::AddNew("panel.imprint_url", '');
|
||||
Settings::AddNew("panel.terms_url", '');
|
||||
Settings::AddNew("panel.privacy_url", '');
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('202103240');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.25')) {
|
||||
showUpdateStep("Updating from 0.10.25 to 0.10.26", false);
|
||||
\Froxlor\Froxlor::updateToVersion('0.10.26');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202103240')) {
|
||||
|
||||
showUpdateStep("Adding setting for default serveralias value for new domains", true);
|
||||
Settings::AddNew("system.domaindefaultalias", '0');
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('202106160');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202106160')) {
|
||||
|
||||
showUpdateStep("Adjusting Let's Encrypt endpoint configuration to support ZeroSSL", true);
|
||||
if (Settings::Get('system.letsencryptca') == 'testing') {
|
||||
Settings::Set("system.letsencryptca", 'letsencrypt_test');
|
||||
} else {
|
||||
Settings::Set("system.letsencryptca", 'letsencrypt');
|
||||
}
|
||||
lastStepStatus(0);
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('202106270');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202106270')) {
|
||||
showUpdateStep("Adding custom logo image settings", true);
|
||||
Settings::AddNew("panel.logo_image_header", '');
|
||||
Settings::AddNew("panel.logo_image_login", '');
|
||||
lastStepStatus(0);
|
||||
|
||||
// Migrating old custom logo over, if exists
|
||||
$custom_logo_file_old = \Froxlor\Froxlor::getInstallDir() . '/templates/Sparkle/assets/img/logo_custom.png';
|
||||
if (file_exists($custom_logo_file_old)) {
|
||||
showUpdateStep("Migrating existing custom logo to new settings", true);
|
||||
|
||||
$path = \Froxlor\Froxlor::getInstallDir().'/img/';
|
||||
if (!is_dir($path) && !mkdir($path, 0775)) {
|
||||
throw new \Exception("img directory does not exist and cannot be created");
|
||||
}
|
||||
if (!is_writable($path)) {
|
||||
if (!chmod($path, '0775')) {
|
||||
throw new \Exception("Cannot write to img directory");
|
||||
}
|
||||
}
|
||||
|
||||
// Save as new custom logo header
|
||||
$save_to = 'logo_header.png';
|
||||
copy($custom_logo_file_old, $path.$save_to);
|
||||
Settings::Set("panel.logo_image_header", "img/{$save_to}?v=".time());
|
||||
|
||||
// Save as new custom logo login
|
||||
$save_to = 'logo_login.png';
|
||||
copy($custom_logo_file_old, $path.$save_to);
|
||||
Settings::Set("panel.logo_image_login", "img/{$save_to}?v=".time());
|
||||
|
||||
lastStepStatus(0);
|
||||
}
|
||||
|
||||
\Froxlor\Froxlor::updateToDbVersion('202107070');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.26')) {
|
||||
showUpdateStep("Updating from 0.10.26 to 0.10.27", false);
|
||||
\Froxlor\Froxlor::updateToVersion('0.10.27');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202107070')) {
|
||||
showUpdateStep("Adding settings to overwrite theme- or custom theme-logo with the new logo settings", true);
|
||||
Settings::AddNew("panel.logo_overridetheme", '0');
|
||||
Settings::AddNew("panel.logo_overridecustom", '0');
|
||||
lastStepStatus(0);
|
||||
\Froxlor\Froxlor::updateToDbVersion('202107200');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202107200')) {
|
||||
showUpdateStep("Adding settings to define default value of 'create std-subdomain' when creating a customer", true);
|
||||
Settings::AddNew("system.createstdsubdom_default", '1');
|
||||
lastStepStatus(0);
|
||||
\Froxlor\Froxlor::updateToDbVersion('202107210');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202107210')) {
|
||||
showUpdateStep("Normalizing ipv6 for correct comparison", true);
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "`"
|
||||
);
|
||||
Database::pexecute($result_stmt);
|
||||
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_IPSANDPORTS . "` SET `ip` = :ip WHERE `id` = :id");
|
||||
while ($iprow = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (Validate::is_ipv6($iprow['ip'])) {
|
||||
$ip = inet_ntop(inet_pton($iprow['ip']));
|
||||
Database::pexecute($upd_stmt, [
|
||||
'ip' => $ip,
|
||||
'id' => $iprow['id']
|
||||
]);
|
||||
}
|
||||
}
|
||||
lastStepStatus(0);
|
||||
\Froxlor\Froxlor::updateToDbVersion('202107260');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202107260')) {
|
||||
showUpdateStep("Removing setting for search-engine allow yes/no", true);
|
||||
Database::query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'panel' AND `varname` = 'no_robots'");
|
||||
lastStepStatus(0);
|
||||
showUpdateStep("Adding setting to have all froxlor customers in a local group", true);
|
||||
Settings::AddNew("system.froxlorusergroup", '');
|
||||
Settings::AddNew("system.froxlorusergroup_gid", '');
|
||||
lastStepStatus(0);
|
||||
\Froxlor\Froxlor::updateToDbVersion('202107300');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202107300')) {
|
||||
showUpdateStep("Adds the possibility to select the PowerDNS Operation Mode", true);
|
||||
Settings::AddNew("system.powerdns_mode", 'Native');
|
||||
lastStepStatus(0);
|
||||
\Froxlor\Froxlor::updateToDbVersion('202108180');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.27')) {
|
||||
showUpdateStep("Updating from 0.10.27 to 0.10.28", false);
|
||||
\Froxlor\Froxlor::updateToVersion('0.10.28');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('202108180')) {
|
||||
showUpdateStep("Adding czech language file", true);
|
||||
Database::query("INSERT INTO `" . TABLE_PANEL_LANGUAGE . "` SET `language` = 'Česká republika', `iso` = 'cs', `file` = 'lng/czech.lng.php'");
|
||||
lastStepStatus(0);
|
||||
\Froxlor\Froxlor::updateToDbVersion('202109040');
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.28')) {
|
||||
showUpdateStep("Updating from 0.10.28 to 0.10.29", false);
|
||||
\Froxlor\Froxlor::updateToVersion('0.10.29');
|
||||
}
|
||||
|
||||
@@ -2505,7 +2505,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.30')) {
|
||||
showUpdateStep("Updating from 0.9.30 to 0.9.31-dev1", true);
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Removing unsused tables");
|
||||
showUpdateStep("Removing unused tables");
|
||||
Database::query("DROP TABLE IF EXISTS `ipsandports_docrootsettings`;");
|
||||
Database::query("DROP TABLE IF EXISTS `domain_docrootsettings`;");
|
||||
lastStepStatus(0);
|
||||
@@ -2856,7 +2856,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.32-rc1')) {
|
||||
Settings::AddNew("system.croncmdline", $croncmdline);
|
||||
// add task to generate cron.d-file
|
||||
\Froxlor\System\Cronjob::inserttask('99');
|
||||
// silenty add the auto-update setting - we do not want everybody to know and use this
|
||||
// silently add the auto-update setting - we do not want everybody to know and use this
|
||||
// as it is a very dangerous setting
|
||||
Settings::AddNew("system.cron_allowautoupdate", 0);
|
||||
lastStepStatus(0);
|
||||
@@ -3872,7 +3872,7 @@ opcache.interned_strings_buffer');
|
||||
|
||||
if (\Froxlor\Froxlor::isDatabaseVersion('201801110')) {
|
||||
|
||||
showUpdateStep("Adding php-fpm php PATH setting for envrironment");
|
||||
showUpdateStep("Adding php-fpm php PATH setting for environment");
|
||||
Settings::AddNew("phpfpm.envpath", '/usr/local/bin:/usr/bin:/bin');
|
||||
lastStepStatus(0);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* Function getPreConfig
|
||||
*
|
||||
* outputs various content before the update process
|
||||
* can be continued (askes for agreement whatever is being asked)
|
||||
* can be continued (asks for agreement whatever is being asked)
|
||||
*
|
||||
* @param string $current_version
|
||||
* @param int $current_db_version
|
||||
|
||||
@@ -414,7 +414,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version, $c
|
||||
|
||||
if (Settings::Get('system.webserver') == 'apache2') {
|
||||
$has_preconfig = true;
|
||||
$description = 'Froxlor now supports the new Apache 2.4. Please be aware that you need to load additional apache-modules in ordner to use it.<br />';
|
||||
$description = 'Froxlor now supports the new Apache 2.4. Please be aware that you need to load additional apache-modules in order to use it.<br />';
|
||||
$description .= '<pre>LoadModule authz_core_module modules/mod_authz_core.so
|
||||
LoadModule authz_host_module modules/mod_authz_host.so</pre><br />';
|
||||
$question = '<strong>Do you want to enable the Apache-2.4 modification?:</strong> ';
|
||||
|
||||
@@ -310,6 +310,13 @@ abstract class ApiCommand extends ApiParameter
|
||||
} elseif (in_array($valoper['op'], $ops)) {
|
||||
$condition .= $field . ' ' . $valoper['op'] . ':' . $cleanfield;
|
||||
$query_fields[':' . $cleanfield] = $valoper['value'] ?? '';
|
||||
} elseif (strtolower($valoper['op']) == 'in' && is_array($valoper['value']) && count($valoper['value']) > 0) {
|
||||
$condition .= $field . ' ' . $valoper['op'] . ' (';
|
||||
foreach ($valoper['value'] as $incnt => $invalue) {
|
||||
$condition .= ":" . $cleanfield . $incnt . ", ";
|
||||
$query_fields[':' . $cleanfield . $incnt] = $invalue ?? '';
|
||||
}
|
||||
$condition = substr($condition, 0, - 2) . ')';
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@@ -518,7 +525,7 @@ abstract class ApiCommand extends ApiParameter
|
||||
$customer_ids[] = $customer['customerid'];
|
||||
}
|
||||
} else {
|
||||
if (!$this->isInternal() && ! empty($customer_hide_option) && \Froxlor\Settings::IsInList('panel.customer_hide_options', $customer_hide_option)) {
|
||||
if (! $this->isInternal() && ! empty($customer_hide_option) && \Froxlor\Settings::IsInList('panel.customer_hide_options', $customer_hide_option)) {
|
||||
throw new \Exception("You cannot access this resource", 405);
|
||||
}
|
||||
$customer_ids = array(
|
||||
|
||||
@@ -189,7 +189,7 @@ class Certificates extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resou
|
||||
*/
|
||||
public function listing()
|
||||
{
|
||||
// select all my (accessable) certificates
|
||||
// select all my (accessible) certificates
|
||||
$certs_stmt_query = "SELECT s.*, d.domain, d.letsencrypt, c.customerid, c.loginname
|
||||
FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` s
|
||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` d ON `d`.`id` = `s`.`domainid`
|
||||
@@ -237,7 +237,7 @@ class Certificates extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resou
|
||||
*/
|
||||
public function listingCount()
|
||||
{
|
||||
// select all my (accessable) certificates
|
||||
// select all my (accessible) certificates
|
||||
$certs_stmt_query = "SELECT COUNT(*) as num_certs
|
||||
FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` s
|
||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` d ON `d`.`id` = `s`.`domainid`
|
||||
|
||||
@@ -23,7 +23,7 @@ class CustomerBackups extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Re
|
||||
{
|
||||
|
||||
/**
|
||||
* check whether backup is enabled systemwide and if accessable for customer (hide_options)
|
||||
* check whether backup is enabled systemwide and if accessible for customer (hide_options)
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
|
||||
@@ -33,7 +33,9 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
* optional specify offset for resultset
|
||||
* @param array $sql_orderby
|
||||
* optional array with index = fieldname and value = ASC|DESC to order the resultset by one or more fields
|
||||
*
|
||||
* @param bool $show_usages
|
||||
* optional, default false
|
||||
*
|
||||
* @access admin
|
||||
* @throws \Exception
|
||||
* @return string json-encoded array count|list
|
||||
@@ -41,6 +43,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
public function listing()
|
||||
{
|
||||
if ($this->isAdmin()) {
|
||||
$show_usages = $this->getBoolParam('show_usages', true, false);
|
||||
$this->logger()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "[API] list customers");
|
||||
$query_fields = array();
|
||||
$result_stmt = Database::prepare("
|
||||
@@ -57,7 +60,47 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
$params = array_merge($params, $query_fields);
|
||||
Database::pexecute($result_stmt, $params, true, true);
|
||||
$result = array();
|
||||
|
||||
$domains_stmt = null;
|
||||
$usages_stmt = null;
|
||||
if ($show_usages) {
|
||||
$domains_stmt = Database::prepare("
|
||||
SELECT COUNT(`id`) AS `domains`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `customerid` = :cid
|
||||
AND `parentdomainid` = '0'
|
||||
AND `id`<> :stdd
|
||||
");
|
||||
$usages_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_DISKSPACE . "`
|
||||
WHERE `customerid` = :cid
|
||||
ORDER BY `stamp` DESC LIMIT 1
|
||||
");
|
||||
}
|
||||
|
||||
while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if ($show_usages) {
|
||||
// get number of domains
|
||||
Database::pexecute($domains_stmt, array(
|
||||
'cid' => $row['customerid'],
|
||||
'stdd' => $row['standardsubdomain']
|
||||
));
|
||||
$domains = $domains_stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$row['domains'] = intval($domains['domains']);
|
||||
// get disk-space usages for web, mysql and mail
|
||||
$usages = Database::pexecute_first($usages_stmt, array(
|
||||
'cid' => $row['customerid']
|
||||
));
|
||||
if ($usages) {
|
||||
$row['webspace_used'] = $usages['webspace'];
|
||||
$row['mailspace_used'] = $usages['mail'];
|
||||
$row['dbspace_used'] = $usages['mysql'];
|
||||
} else {
|
||||
$row['webspace_used'] = 0;
|
||||
$row['mailspace_used'] = 0;
|
||||
$row['dbspace_used'] = 0;
|
||||
}
|
||||
}
|
||||
$result[] = $row;
|
||||
}
|
||||
return $this->response(200, "successful", array(
|
||||
@@ -103,6 +146,8 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
* optional, the customer-id
|
||||
* @param string $loginname
|
||||
* optional, the loginname
|
||||
* @param bool $show_usages
|
||||
* optional, default false
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws \Exception
|
||||
@@ -113,6 +158,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
$id = $this->getParam('id', true, 0);
|
||||
$ln_optional = ($id <= 0 ? false : true);
|
||||
$loginname = $this->getParam('loginname', $ln_optional, '');
|
||||
$show_usages = $this->getBoolParam('show_usages', true, false);
|
||||
|
||||
if ($this->isAdmin()) {
|
||||
$result_stmt = Database::prepare("
|
||||
@@ -142,6 +188,40 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
if (! $this->isAdmin() && $result['custom_notes_show'] != 1) {
|
||||
$result['custom_notes'] = "";
|
||||
}
|
||||
if ($show_usages) {
|
||||
// get number of domains
|
||||
$domains_stmt = Database::prepare("
|
||||
SELECT COUNT(`id`) AS `domains`
|
||||
FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `customerid` = :cid
|
||||
AND `parentdomainid` = '0'
|
||||
AND `id`<> :stdd
|
||||
");
|
||||
Database::pexecute($domains_stmt, array(
|
||||
'cid' => $result['customerid'],
|
||||
'stdd' => $result['standardsubdomain']
|
||||
));
|
||||
$domains = $domains_stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$result['domains'] = intval($domains['domains']);
|
||||
// get disk-space usages for web, mysql and mail
|
||||
$usages_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_DISKSPACE . "`
|
||||
WHERE `customerid` = :cid
|
||||
ORDER BY `stamp` DESC LIMIT 1
|
||||
");
|
||||
$usages = Database::pexecute_first($usages_stmt, array(
|
||||
'cid' => $result['customerid']
|
||||
));
|
||||
if ($usages) {
|
||||
$result['webspace_used'] = $usages['webspace'];
|
||||
$result['mailspace_used'] = $usages['mail'];
|
||||
$result['dbspace_used'] = $usages['mysql'];
|
||||
} else {
|
||||
$result['webspace_used'] = 0;
|
||||
$result['mailspace_used'] = 0;
|
||||
$result['dbspace_used'] = 0;
|
||||
}
|
||||
}
|
||||
$this->logger()->logAction($this->isAdmin() ? \Froxlor\FroxlorLogger::ADM_ACTION : \Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "[API] get customer '" . $result['loginname'] . "'");
|
||||
return $this->response(200, "successful", $result);
|
||||
}
|
||||
@@ -228,7 +308,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
* @param bool $mysqls_ul
|
||||
* optional, whether customer should have unlimited mysql-databases, default 0 (false)
|
||||
* @param bool $createstdsubdomain
|
||||
* optional, whether to create a standard-subdomain ([loginname].froxlor-hostname.tld), default 0 (false)
|
||||
* optional, whether to create a standard-subdomain ([loginname].froxlor-hostname.tld), default [system.createstdsubdom_default]
|
||||
* @param bool $phpenabled
|
||||
* optional, whether to allow usage of PHP, default 0 (false)
|
||||
* @param array $allowed_phpconfigs
|
||||
@@ -236,9 +316,9 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
* @param bool $perlenabled
|
||||
* optional, whether to allow usage of Perl/CGI, default 0 (false)
|
||||
* @param bool $dnsenabled
|
||||
* optional, wether to allow usage of the DNS editor (requires activated nameserver in settings), default 0 (false)
|
||||
* optional, whether to allow usage of the DNS editor (requires activated nameserver in settings), default 0 (false)
|
||||
* @param bool $logviewenabled
|
||||
* optional, wether to allow acccess to webserver access/error-logs, default 0 (false)
|
||||
* optional, whether to allow access to webserver access/error-logs, default 0 (false)
|
||||
* @param bool $store_defaultindex
|
||||
* optional, whether to store the default index file to customers homedir
|
||||
* @param int $hosting_plan_id
|
||||
@@ -272,7 +352,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
$gender = (int) $this->getParam('gender', true, 0);
|
||||
$custom_notes = $this->getParam('custom_notes', true, '');
|
||||
$custom_notes_show = $this->getBoolParam('custom_notes_show', true, 0);
|
||||
$createstdsubdomain = $this->getBoolParam('createstdsubdomain', true, 0);
|
||||
$createstdsubdomain = $this->getBoolParam('createstdsubdomain', true, Settings::Get('system.createstdsubdom_default'));
|
||||
$password = $this->getParam('new_customer_password', true, '');
|
||||
$sendpassword = $this->getBoolParam('sendpassword', true, 0);
|
||||
$store_defaultindex = $this->getBoolParam('store_defaultindex', true, 0);
|
||||
@@ -843,9 +923,9 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
* @param bool $perlenabled
|
||||
* optional, whether to allow usage of Perl/CGI, default 0 (false)
|
||||
* @param bool $dnsenabled
|
||||
* optional, ether to allow usage of the DNS editor (requires activated nameserver in settings), default 0 (false)
|
||||
* optional, whether to allow usage of the DNS editor (requires activated nameserver in settings), default 0 (false)
|
||||
* @param bool $logviewenabled
|
||||
* optional, ether to allow acccess to webserver access/error-logs, default 0 (false)
|
||||
* optional, whether to allow access to webserver access/error-logs, default 0 (false)
|
||||
* @param string $theme
|
||||
* optional, change theme
|
||||
*
|
||||
@@ -873,7 +953,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
$email = $this->getParam('email', true, $idna_convert->decode($result['email']));
|
||||
$name = $this->getParam('name', true, $result['name']);
|
||||
$firstname = $this->getParam('firstname', true, $result['firstname']);
|
||||
$company_required = (! empty($name) && empty($firstname)) || (empty($name) && ! empty($firstname)) || (empty($name) && empty($firstname));
|
||||
$company_required = empty($result['company']) && ((! empty($name) && empty($firstname)) || (empty($name) && ! empty($firstname)) || (empty($name) && empty($firstname)));
|
||||
$company = $this->getParam('company', ($company_required ? false : true), $result['company']);
|
||||
$street = $this->getParam('street', true, $result['street']);
|
||||
$zipcode = $this->getParam('zipcode', true, $result['zipcode']);
|
||||
@@ -1025,7 +1105,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
\Froxlor\System\Cronjob::inserttask('1');
|
||||
}
|
||||
|
||||
if ($phpenabled != $result['phpenabled'] || $perlenabled != $result['perlenabled']) {
|
||||
if ($phpenabled != $result['phpenabled'] || $perlenabled != $result['perlenabled'] || $email != $result['email']) {
|
||||
\Froxlor\System\Cronjob::inserttask('1');
|
||||
}
|
||||
|
||||
@@ -1411,7 +1491,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
), true, true);
|
||||
|
||||
// first gather all domain-id's to clean up panel_domaintoip, dns-entries and certificates accordingly
|
||||
$did_stmt = Database::prepare("SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid` = :id");
|
||||
$did_stmt = Database::prepare("SELECT `id`, `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid` = :id");
|
||||
Database::pexecute($did_stmt, array(
|
||||
'id' => $id
|
||||
), true, true);
|
||||
@@ -1431,6 +1511,10 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
Database::pexecute($stmt, array(
|
||||
'did' => $row['id']
|
||||
), true, true);
|
||||
// remove domains DNS from powerDNS if used, #581
|
||||
\Froxlor\System\Cronjob::inserttask('11', $row['domain']);
|
||||
// remove domain from acme.sh / lets encrypt if used
|
||||
\Froxlor\System\Cronjob::inserttask('12', $row['domain']);
|
||||
}
|
||||
// remove customer domains
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid` = :id");
|
||||
|
||||
@@ -322,7 +322,7 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the total number of accessable directory options
|
||||
* returns the total number of accessible directory options
|
||||
*
|
||||
* @param int $customerid
|
||||
* optional, admin-only, select directory-protections of a specific customer by id
|
||||
|
||||
@@ -305,7 +305,7 @@ class DirProtections extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Res
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the total number of accessable directory protections
|
||||
* returns the total number of accessible directory protections
|
||||
*
|
||||
* @param int $customerid
|
||||
* optional, admin-only, select directory-protections of a specific customer by id
|
||||
|
||||
@@ -136,8 +136,24 @@ class DomainZones extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
||||
// types
|
||||
if ($type == 'A' && filter_var($content, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false) {
|
||||
$errors[] = $this->lng['error']['dns_arec_noipv4'];
|
||||
} elseif ($type == 'A') {
|
||||
// check whether there is a CNAME-record for the same resource
|
||||
foreach ($dom_entries as $existing_entries) {
|
||||
if ($existing_entries['type'] == 'CNAME' && $existing_entries['record'] == $record) {
|
||||
$errors[] = $this->lng['error']['dns_other_nomorerr'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
} elseif ($type == 'AAAA' && filter_var($content, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
|
||||
$errors[] = $this->lng['error']['dns_aaaarec_noipv6'];
|
||||
} elseif ($type == 'AAAA') {
|
||||
// check whether there is a CNAME-record for the same resource
|
||||
foreach ($dom_entries as $existing_entries) {
|
||||
if ($existing_entries['type'] == 'CNAME' && $existing_entries['record'] == $record) {
|
||||
$errors[] = $this->lng['error']['dns_other_nomorerr'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
} elseif ($type == 'CAA' && ! empty($content)) {
|
||||
$re = '/(?\'critical\'\d)\h*(?\'type\'iodef|issue|issuewild)\h*(?\'value\'(?\'issuevalue\'"(?\'domain\'(?=.{3,128}$)(?>(?>[a-zA-Z0-9]+[a-zA-Z0-9-]*[a-zA-Z0-9]+|[a-zA-Z0-9]+)\.)*(?>[a-zA-Z]{2,}|[a-zA-Z0-9]{2,}\.[a-zA-Z]{2,}))[;\h]*(?\'parameters\'(?>[a-zA-Z0-9]{1,60}=[a-zA-Z0-9]{1,60}\h*)+)?")|(?\'iodefvalue\'"(?\'url\'(mailto:.*|http:\/\/.*|https:\/\/.*))"))/';
|
||||
preg_match($re, $content, $matches);
|
||||
@@ -198,6 +214,10 @@ class DomainZones extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
||||
$errors[] = $this->lng['error']['dns_mx_noalias'];
|
||||
break;
|
||||
}
|
||||
elseif ($existing_entries['type'] == 'CNAME' && $existing_entries['record'] == $record) {
|
||||
$errors[] = $this->lng['error']['dns_other_nomorerr'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// append trailing dot (again)
|
||||
@@ -210,6 +230,14 @@ class DomainZones extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
||||
}
|
||||
if (! \Froxlor\Validate\Validate::validateDomain($content)) {
|
||||
$errors[] = $this->lng['error']['dns_ns_invaliddom'];
|
||||
} else {
|
||||
// check whether there is a CNAME-record for the same resource
|
||||
foreach ($dom_entries as $existing_entries) {
|
||||
if ($existing_entries['type'] == 'CNAME' && $existing_entries['record'] == $record) {
|
||||
$errors[] = $this->lng['error']['dns_other_nomorerr'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// append trailing dot (again)
|
||||
$content .= '.';
|
||||
@@ -316,7 +344,7 @@ class DomainZones extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
||||
return $this->response(200, "successful", $result);
|
||||
}
|
||||
// return $errors
|
||||
throw new \Exception(implode("\n", $errors));
|
||||
throw new \Exception(implode("\n", $errors), 406);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,7 +77,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the total number of accessable domains
|
||||
* returns the total number of accessible domains
|
||||
*
|
||||
* @access admin
|
||||
* @throws \Exception
|
||||
@@ -193,6 +193,27 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
return $ipandports;
|
||||
}
|
||||
|
||||
/**
|
||||
* get ips from array of id's
|
||||
*
|
||||
* @param array $ips
|
||||
* @return array
|
||||
*/
|
||||
private function getIpsFromIdArray(array $ids)
|
||||
{
|
||||
$resultips_stmt = Database::prepare("
|
||||
SELECT `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE id = :id
|
||||
");
|
||||
$result = [];
|
||||
foreach ($ids as $id) {
|
||||
$entry = Database::pexecute_first($resultips_stmt, array(
|
||||
'id' => $id
|
||||
));
|
||||
$result[] = $entry['ip'];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* add new domain entry
|
||||
*
|
||||
@@ -213,7 +234,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
* @param bool $email_only
|
||||
* optional, restrict domain to email usage, default 0 (false)
|
||||
* @param int $selectserveralias
|
||||
* optional, 0 = wildcard, 1 = www-alias, 2 = none, default 0
|
||||
* optional, 0 = wildcard, 1 = www-alias, 2 = none, default [system.domaindefaultalias]
|
||||
* @param bool $speciallogfile
|
||||
* optional, whether to create an exclusive web-logfile for this domain, default 0 (false)
|
||||
* @param int $alias
|
||||
@@ -288,6 +309,8 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
* optional list of allowed/used ssl/tls ciphers, see system.ssl_cipher_list setting, only used/required if $override_tls is true, default empty or system.ssl_cipher_list setting if $override_tls is true
|
||||
* @param string $tlsv13_cipher_list
|
||||
* optional list of allowed/used tls-1.3 specific ciphers, see system.tlsv13_cipher_list setting, only used/required if $override_tls is true, default empty or system.tlsv13_cipher_list setting if $override_tls is true
|
||||
* @param string $description
|
||||
* optional custom description (currently not used/shown in the frontend), default empty
|
||||
*
|
||||
* @access admin
|
||||
* @throws \Exception
|
||||
@@ -307,7 +330,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
$subcanemaildomain = $this->getParam('subcanemaildomain', true, 0);
|
||||
$isemaildomain = $this->getBoolParam('isemaildomain', true, 0);
|
||||
$email_only = $this->getBoolParam('email_only', true, 0);
|
||||
$serveraliasoption = $this->getParam('selectserveralias', true, 0);
|
||||
$serveraliasoption = $this->getParam('selectserveralias', true, Settings::Get('system.domaindefaultalias'));
|
||||
$speciallogfile = $this->getBoolParam('speciallogfile', true, 0);
|
||||
$aliasdomain = intval($this->getParam('alias', true, 0));
|
||||
$issubof = $this->getParam('issubof', true, 0);
|
||||
@@ -354,6 +377,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
$tlsv13_cipher_list = $this->getParam('tlsv13_cipher_list', true, Settings::Get('system.tlsv13_cipher_list'));
|
||||
}
|
||||
}
|
||||
$description = $this->getParam('description', true, '');
|
||||
|
||||
// validation
|
||||
$p_domain = strtolower($p_domain);
|
||||
@@ -571,6 +595,15 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
$include_specialsettings = 0;
|
||||
}
|
||||
|
||||
// validate dns if lets encrypt is enabled to check whether we can use it at all
|
||||
if ($letsencrypt == '1' && Settings::Get('system.le_domain_dnscheck') == '1') {
|
||||
$domain_ips = \Froxlor\PhpHelper::gethostbynamel6($domain);
|
||||
$selected_ips = $this->getIpsFromIdArray($ssl_ipandports);
|
||||
if ($domain_ips == false || count(array_intersect($selected_ips, $domain_ips)) <= 0) {
|
||||
\Froxlor\UI\Response::standard_error('invaliddnsforletsencrypt', '', true);
|
||||
}
|
||||
}
|
||||
|
||||
// We can't enable let's encrypt for wildcard-domains
|
||||
if ($serveraliasoption == '0' && $letsencrypt == '1') {
|
||||
\Froxlor\UI\Response::standard_error('nowildcardwithletsencrypt', '', true);
|
||||
@@ -728,7 +761,8 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
'tlsv13_cipher_list' => $tlsv13_cipher_list,
|
||||
'sslenabled' => $sslenabled,
|
||||
'honorcipherorder' => $honorcipherorder,
|
||||
'sessiontickets' => $sessiontickets
|
||||
'sessiontickets' => $sessiontickets,
|
||||
'description' => $description
|
||||
);
|
||||
|
||||
$ins_stmt = Database::prepare("
|
||||
@@ -780,7 +814,8 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
`tlsv13_cipher_list` = :tlsv13_cipher_list,
|
||||
`ssl_enabled` = :sslenabled,
|
||||
`ssl_honorcipherorder` = :honorcipherorder,
|
||||
`ssl_sessiontickets`= :sessiontickets
|
||||
`ssl_sessiontickets` = :sessiontickets,
|
||||
`description` = :description
|
||||
");
|
||||
Database::pexecute($ins_stmt, $ins_data, true, true);
|
||||
$domainid = Database::lastInsertId();
|
||||
@@ -932,6 +967,8 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
* optional whether to honor the (server) cipher order for this domain. default 0 (false), requires SSL
|
||||
* @param bool $sessiontickets
|
||||
* optional whether to enable or disable TLS sessiontickets (RFC 5077) for this domain. default 1 (true), requires SSL
|
||||
* @param string $description
|
||||
* optional custom description (currently not used/shown in the frontend), default empty
|
||||
*
|
||||
* @access admin
|
||||
* @throws \Exception
|
||||
@@ -1027,6 +1064,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
$ssl_cipher_list = $result['ssl_cipher_list'];
|
||||
$tlsv13_cipher_list = $result['tlsv13_cipher_list'];
|
||||
}
|
||||
$description = $this->getParam('description', true, $result['description']);
|
||||
|
||||
// count subdomain usage of source-domain
|
||||
$subdomains_stmt = Database::prepare("
|
||||
@@ -1318,6 +1356,15 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
$include_specialsettings = 0;
|
||||
}
|
||||
|
||||
// validate dns if lets encrypt is enabled to check whether we can use it at all
|
||||
if ($letsencrypt == '1' && Settings::Get('system.le_domain_dnscheck') == '1') {
|
||||
$domain_ips = \Froxlor\PhpHelper::gethostbynamel6($result['domain']);
|
||||
$selected_ips = $this->getIpsFromIdArray($ssl_ipandports);
|
||||
if ($domain_ips == false || count(array_intersect($selected_ips, $domain_ips)) <= 0) {
|
||||
\Froxlor\UI\Response::standard_error('invaliddnsforletsencrypt', '', true);
|
||||
}
|
||||
}
|
||||
|
||||
// We can't enable let's encrypt for wildcard-domains
|
||||
if ($serveraliasoption == '0' && $letsencrypt == '1') {
|
||||
\Froxlor\UI\Response::standard_error('nowildcardwithletsencrypt', '', true);
|
||||
@@ -1589,6 +1636,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
$update_data['sslenabled'] = $sslenabled;
|
||||
$update_data['honorcipherorder'] = $honorcipherorder;
|
||||
$update_data['sessiontickets'] = $sessiontickets;
|
||||
$update_data['description'] = $description;
|
||||
$update_data['id'] = $id;
|
||||
|
||||
$update_stmt = Database::prepare("
|
||||
@@ -1634,7 +1682,8 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
`tlsv13_cipher_list` = :tlsv13_cipher_list,
|
||||
`ssl_enabled` = :sslenabled,
|
||||
`ssl_honorcipherorder` = :honorcipherorder,
|
||||
`ssl_sessiontickets` = :sessiontickets
|
||||
`ssl_sessiontickets` = :sessiontickets,
|
||||
`description` = :description
|
||||
WHERE `id` = :id
|
||||
");
|
||||
Database::pexecute($update_stmt, $update_data, true, true);
|
||||
@@ -1692,9 +1741,6 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
");
|
||||
Database::pexecute($_update_stmt, $_update_data, true, true);
|
||||
|
||||
// insert a rebuild-task
|
||||
\Froxlor\System\Cronjob::inserttask('1');
|
||||
|
||||
// Cleanup domain <-> ip mapping
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_domain` = :id
|
||||
|
||||
@@ -100,7 +100,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
||||
// alternative email address to send info to
|
||||
if (Settings::Get('panel.sendalternativemail') == 1) {
|
||||
$alternative_email = $idna_convert->encode(\Froxlor\Validate\Validate::validate($alternative_email, 'alternative_email', '', '', array(), true));
|
||||
if (!empty($alternative_email) && ! \Froxlor\Validate\Validate::validateEmail($alternative_email)) {
|
||||
if (! empty($alternative_email) && ! \Froxlor\Validate\Validate::validateEmail($alternative_email)) {
|
||||
\Froxlor\UI\Response::standard_error('alternativeemailiswrong', $alternative_email, true);
|
||||
}
|
||||
} else {
|
||||
@@ -192,7 +192,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
||||
$replace_arr = array(
|
||||
'EMAIL' => $email_full,
|
||||
'USERNAME' => $username,
|
||||
'PASSWORD' => $password,
|
||||
'PASSWORD' => htmlentities(htmlentities($password)),
|
||||
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($customer),
|
||||
'NAME' => $customer['name'],
|
||||
'FIRSTNAME' => $customer['firstname'],
|
||||
@@ -236,7 +236,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
||||
$this->mailer()->clearAddresses();
|
||||
|
||||
// customer wants to send the e-mail to an alternative email address too
|
||||
if (Settings::Get('panel.sendalternativemail') == 1 && !empty($alternative_email)) {
|
||||
if (Settings::Get('panel.sendalternativemail') == 1 && ! empty($alternative_email)) {
|
||||
// get template for mail subject
|
||||
$mail_subject = $this->getMailTemplate($customer, 'mails', 'pop_success_alternative_subject', $replace_arr, $this->lng['mails']['pop_success_alternative']['subject']);
|
||||
// get template for mail body
|
||||
@@ -302,6 +302,8 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
||||
* optional, update quota
|
||||
* @param string $email_password
|
||||
* optional, update password
|
||||
* @param bool $deactivated
|
||||
* optional, admin-only
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws \Exception
|
||||
@@ -331,6 +333,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
||||
|
||||
$password = $this->getParam('email_password', true, '');
|
||||
$quota = $this->getParam('email_quota', true, $result['quota']);
|
||||
$deactivated = $this->getBoolParam('deactivated', true, (strtolower($result['postfix']) == 'n' ? true : false));
|
||||
|
||||
// get needed customer info to reduce the email-account-counter by one
|
||||
$customer = $this->getCustomerData();
|
||||
@@ -372,6 +375,18 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
||||
$quota = 0;
|
||||
}
|
||||
|
||||
if ($this->isAdmin()) {
|
||||
if (($deactivated == true && strtolower($result['postfix']) == 'y') || ($deactivated == false && strtolower($result['postfix']) == 'n')) {
|
||||
if (! empty($upd_query)) {
|
||||
$upd_query .= ", ";
|
||||
}
|
||||
$upd_query .= "`postfix` = :postfix, `imap` = :imap, `pop3` = :pop3";
|
||||
$upd_params['postfix'] = $deactivated ? 'N' : 'Y';
|
||||
$upd_params['imap'] = $deactivated ? '0' : '1';
|
||||
$upd_params['pop3'] = $deactivated ? '0' : '1';
|
||||
}
|
||||
}
|
||||
|
||||
// build update query
|
||||
if (! empty($upd_query)) {
|
||||
$upd_stmt = Database::prepare("
|
||||
|
||||
@@ -35,6 +35,8 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
* optional, required when called as admin (if $loginname is not specified)
|
||||
* @param string $loginname
|
||||
* optional, required when called as admin (if $customerid is not specified)
|
||||
* @param string $description
|
||||
* optional custom description (currently not used/shown in the frontend), default empty
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws \Exception
|
||||
@@ -54,6 +56,7 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
|
||||
// parameters
|
||||
$iscatchall = $this->getBoolParam('iscatchall', true, 0);
|
||||
$description = $this->getParam('description', true, '');
|
||||
|
||||
// validation
|
||||
if (substr($domain, 0, 4) != 'xn--') {
|
||||
@@ -121,14 +124,16 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
`email` = :email,
|
||||
`email_full` = :email_full,
|
||||
`iscatchall` = :iscatchall,
|
||||
`domainid` = :domainid
|
||||
`domainid` = :domainid,
|
||||
`description` = :description
|
||||
");
|
||||
$params = array(
|
||||
"cid" => $customer['customerid'],
|
||||
"email" => $email,
|
||||
"email_full" => $email_full,
|
||||
"iscatchall" => $iscatchall,
|
||||
"domainid" => $domain_check['id']
|
||||
"domainid" => $domain_check['id'],
|
||||
"description" => $description
|
||||
);
|
||||
Database::pexecute($stmt, $params, true, true);
|
||||
|
||||
@@ -167,7 +172,7 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
$customer_ids = $this->getAllowedCustomerIds('email');
|
||||
$params['idea'] = ($id <= 0 ? $emailaddr : $id);
|
||||
|
||||
$result_stmt = Database::prepare("SELECT v.`id`, v.`email`, v.`email_full`, v.`iscatchall`, v.`destination`, v.`customerid`, v.`popaccountid`, v.`domainid`, u.`quota`
|
||||
$result_stmt = Database::prepare("SELECT v.`id`, v.`email`, v.`email_full`, v.`iscatchall`, v.`destination`, v.`customerid`, v.`popaccountid`, v.`domainid`, v.`description`, u.`quota`, u.`imap`, u.`pop3`, u.`postfix`, u.`mboxsize`
|
||||
FROM `" . TABLE_MAIL_VIRTUAL . "` v
|
||||
LEFT JOIN `" . TABLE_MAIL_USERS . "` u ON v.`popaccountid` = u.`id`
|
||||
WHERE v.`customerid` IN (" . implode(", ", $customer_ids) . ")
|
||||
@@ -195,6 +200,8 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
* optional, required when called as admin (if $customerid is not specified)
|
||||
* @param boolean $iscatchall
|
||||
* optional
|
||||
* @param string $description
|
||||
* optional custom description (currently not used/shown in the frontend), default empty
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws \Exception
|
||||
@@ -227,6 +234,7 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
|
||||
// parameters
|
||||
$iscatchall = $this->getBoolParam('iscatchall', true, $result['iscatchall']);
|
||||
$description = $this->getParam('description', true, $result['description']);
|
||||
|
||||
// get needed customer info to reduce the email-address-counter by one
|
||||
$customer = $this->getCustomerData();
|
||||
@@ -256,12 +264,13 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
|
||||
$stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_MAIL_VIRTUAL . "`
|
||||
SET `email` = :email , `iscatchall` = :caflag
|
||||
SET `email` = :email , `iscatchall` = :caflag, `description` = :description
|
||||
WHERE `customerid`= :cid AND `id`= :id
|
||||
");
|
||||
$params = array(
|
||||
"email" => $email,
|
||||
"caflag" => $iscatchall,
|
||||
"description" => $description,
|
||||
"cid" => $customer['customerid'],
|
||||
"id" => $id
|
||||
);
|
||||
@@ -300,7 +309,7 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
$result = array();
|
||||
$query_fields = array();
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT m.`id`, m.`domainid`, m.`email`, m.`email_full`, m.`iscatchall`, u.`quota`, m.`destination`, m.`popaccountid`, d.`domain`, u.`mboxsize`
|
||||
SELECT m.`id`, m.`domainid`, m.`email`, m.`email_full`, m.`iscatchall`, m.`destination`, m.`popaccountid`, d.`domain`, u.`quota`, u.`imap`, u.`pop3`, u.`postfix`, u.`mboxsize`
|
||||
FROM `" . TABLE_MAIL_VIRTUAL . "` m
|
||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` d ON (m.`domainid` = d.`id`)
|
||||
LEFT JOIN `" . TABLE_MAIL_USERS . "` u ON (m.`popaccountid` = u.`id`)
|
||||
@@ -317,7 +326,7 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the total number of accessable email addresses
|
||||
* returns the total number of accessible email addresses
|
||||
*
|
||||
* @param int $customerid
|
||||
* optional, admin-only, select email addresses of a specific customer by id
|
||||
|
||||
@@ -79,7 +79,7 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the total number of accessable fpm daemons
|
||||
* returns the total number of accessible fpm daemons
|
||||
*
|
||||
* @access admin
|
||||
* @throws \Exception
|
||||
|
||||
@@ -62,7 +62,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
|
||||
|
||||
if (($this->getUserDetail('ftps_used') < $this->getUserDetail('ftps') || $this->getUserDetail('ftps') == '-1') || $this->isAdmin() && $is_defaultuser == 1) {
|
||||
|
||||
// required paramters
|
||||
// required parameters
|
||||
$path = $this->getParam('path');
|
||||
$password = $this->getParam('ftp_password');
|
||||
|
||||
@@ -245,7 +245,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
|
||||
'COMPANY' => $customer['company'],
|
||||
'CUSTOMER_NO' => $customer['customernumber'],
|
||||
'USR_NAME' => $username,
|
||||
'USR_PASS' => $password,
|
||||
'USR_PASS' => htmlentities(htmlentities($password)),
|
||||
'USR_PATH' => \Froxlor\FileDir::makeCorrectDir(str_replace($customer['documentroot'], "/", $path))
|
||||
);
|
||||
// get template for mail subject
|
||||
@@ -512,7 +512,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the total number of accessable ftp accounts
|
||||
* returns the total number of accessible ftp accounts
|
||||
*
|
||||
* @param int $customerid
|
||||
* optional, admin-only, select ftp-users of a specific customer by id
|
||||
|
||||
@@ -66,7 +66,7 @@ class HostingPlans extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resou
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the total number of accessable hosting plans
|
||||
* returns the total number of accessible hosting plans
|
||||
*
|
||||
* @access admin
|
||||
* @throws \Exception
|
||||
@@ -182,9 +182,9 @@ class HostingPlans extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resou
|
||||
* @param bool $perlenabled
|
||||
* optional, whether to allow usage of Perl/CGI, default 0 (false)
|
||||
* @param bool $dnsenabled
|
||||
* optional, ether to allow usage of the DNS editor (requires activated nameserver in settings), default 0 (false)
|
||||
* optional, whether to allow usage of the DNS editor (requires activated nameserver in settings), default 0 (false)
|
||||
* @param bool $logviewenabled
|
||||
* optional, ether to allow acccess to webserver access/error-logs, default 0 (false)
|
||||
* optional, whether to allow access to webserver access/error-logs, default 0 (false)
|
||||
*
|
||||
* @access admin
|
||||
* @throws \Exception
|
||||
@@ -309,9 +309,9 @@ class HostingPlans extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resou
|
||||
* @param bool $perlenabled
|
||||
* optional, whether to allow usage of Perl/CGI, default 0 (false)
|
||||
* @param bool $dnsenabled
|
||||
* optional, ether to allow usage of the DNS editor (requires activated nameserver in settings), default 0 (false)
|
||||
* optional, either to allow usage of the DNS editor (requires activated nameserver in settings), default 0 (false)
|
||||
* @param bool $logviewenabled
|
||||
* optional, ether to allow acccess to webserver access/error-logs, default 0 (false)
|
||||
* optional, either to allow access to webserver access/error-logs, default 0 (false)
|
||||
*
|
||||
* @access admin
|
||||
* @throws \Exception
|
||||
|
||||
@@ -65,7 +65,7 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the total number of accessable ip/port entries
|
||||
* returns the total number of accessible ip/port entries
|
||||
*
|
||||
* @access admin
|
||||
* @throws \Exception
|
||||
@@ -247,6 +247,9 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
||||
$docroot = '';
|
||||
}
|
||||
|
||||
// always use compressed ipv6 format
|
||||
$ip = inet_ntop(inet_pton($ip));
|
||||
|
||||
$result_checkfordouble_stmt = Database::prepare("
|
||||
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
WHERE `ip` = :ip AND `port` = :port");
|
||||
@@ -462,6 +465,9 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
||||
$docroot = '';
|
||||
}
|
||||
|
||||
// always use compressed ipv6 format
|
||||
$ip = inet_ntop(inet_pton($ip));
|
||||
|
||||
if ($result['ip'] != $ip && $result['ip'] == Settings::Get('system.ipaddress') && $result_sameipotherport == false) {
|
||||
\Froxlor\UI\Response::standard_error('cantchangesystemip', '', true);
|
||||
} elseif ($result_checkfordouble && $result_checkfordouble['id'] != '' && $result_checkfordouble['id'] != $id) {
|
||||
|
||||
@@ -17,7 +17,7 @@ use Froxlor\Settings;
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package API
|
||||
* @since 0.10.0
|
||||
*
|
||||
*
|
||||
*/
|
||||
class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntity
|
||||
{
|
||||
@@ -31,25 +31,28 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
* optional, default is 0
|
||||
* @param string $description
|
||||
* optional, description for database
|
||||
* @param string $custom_suffix
|
||||
* optional, name for database
|
||||
* @param bool $sendinfomail
|
||||
* optional, send created resource-information to customer, default: false
|
||||
* @param int $customerid
|
||||
* optional, required when called as admin (if $loginname is not specified)
|
||||
* @param string $loginname
|
||||
* optional, required when called as admin (if $customerid is not specified)
|
||||
*
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws \Exception
|
||||
* @return string json-encoded array
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
// required paramters
|
||||
// required parameters
|
||||
$password = $this->getParam('mysql_password');
|
||||
|
||||
// parameters
|
||||
$dbserver = $this->getParam('mysql_server', true, 0);
|
||||
$databasedescription = $this->getParam('description', true, '');
|
||||
$databasename = $this->getParam('custom_suffix', true, '');
|
||||
$sendinfomail = $this->getBoolParam('sendinfomail', true, 0);
|
||||
// get needed customer info to reduce the mysql-usage-counter by one
|
||||
$customer = $this->getCustomerData('mysqls');
|
||||
@@ -58,6 +61,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
$password = \Froxlor\Validate\Validate::validate($password, 'password', '', '', array(), true);
|
||||
$password = \Froxlor\System\Crypt::validatePassword($password, true);
|
||||
$databasedescription = \Froxlor\Validate\Validate::validate(trim($databasedescription), 'description', '', '', array(), true);
|
||||
$databasename = \Froxlor\Validate\Validate::validate(trim($databasename), 'database_name', '', '', array(), true);
|
||||
|
||||
// validate whether the dbserver exists
|
||||
$dbserver = \Froxlor\Validate\Validate::validate($dbserver, html_entity_decode($this->lng['mysql']['mysql_server']), '', '', 0, true);
|
||||
@@ -79,7 +83,12 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
);
|
||||
// create database, user, set permissions, etc.pp.
|
||||
$dbm = new \Froxlor\Database\DbManager($this->logger());
|
||||
$username = $dbm->createDatabase($newdb_params['loginname'], $password, $newdb_params['mysql_lastaccountnumber']);
|
||||
|
||||
if(strtoupper(Settings::Get('customer.mysqlprefix')) == 'DBNAME' && !empty($databasename)) {
|
||||
$username = $dbm->createDatabase($newdb_params['loginname'].'_'.$databasename, $password);
|
||||
} else {
|
||||
$username = $dbm->createDatabase($newdb_params['loginname'], $password, $newdb_params['mysql_lastaccountnumber']);
|
||||
}
|
||||
|
||||
// we've checked against the password in dbm->createDatabase
|
||||
if ($username == false) {
|
||||
@@ -88,13 +97,13 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
|
||||
// add database info to froxlor
|
||||
$stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_DATABASES . "`
|
||||
SET
|
||||
`customerid` = :customerid,
|
||||
`databasename` = :databasename,
|
||||
`description` = :description,
|
||||
`dbserver` = :dbserver
|
||||
");
|
||||
INSERT INTO `" . TABLE_PANEL_DATABASES . "`
|
||||
SET
|
||||
`customerid` = :customerid,
|
||||
`databasename` = :databasename,
|
||||
`description` = :description,
|
||||
`dbserver` = :dbserver
|
||||
");
|
||||
$params = array(
|
||||
"customerid" => $customer['customerid'],
|
||||
"databasename" => $username,
|
||||
@@ -130,7 +139,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
'COMPANY' => $userinfo['company'],
|
||||
'CUSTOMER_NO' => $userinfo['customernumber'],
|
||||
'DB_NAME' => $username,
|
||||
'DB_PASS' => $password,
|
||||
'DB_PASS' => htmlentities(htmlentities($password)),
|
||||
'DB_DESC' => $databasedescription,
|
||||
'DB_SRV' => $sql_root['host'],
|
||||
'PMA_URI' => $pma
|
||||
@@ -181,7 +190,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
* optional, the databasename
|
||||
* @param int $mysql_server
|
||||
* optional, specify database-server, default is none
|
||||
*
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws \Exception
|
||||
* @return string json-encoded array
|
||||
@@ -281,7 +290,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
* optional, required when called as admin (if $loginname is not specified)
|
||||
* @param string $loginname
|
||||
* optional, required when called as admin (if $customerid is not specified)
|
||||
*
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws \Exception
|
||||
* @return string json-encoded array
|
||||
@@ -305,7 +314,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
));
|
||||
$id = $result['id'];
|
||||
|
||||
// paramters
|
||||
// parameters
|
||||
$password = $this->getParam('mysql_password', true, '');
|
||||
$databasedescription = $this->getParam('description', true, $result['description']);
|
||||
|
||||
@@ -370,7 +379,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
* optional specify offset for resultset
|
||||
* @param array $sql_orderby
|
||||
* optional array with index = fieldname and value = ASC|DESC to order the resultset by one or more fields
|
||||
*
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws \Exception
|
||||
* @return string json-encoded array count|list
|
||||
@@ -428,13 +437,13 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the total number of accessable databases
|
||||
* returns the total number of accessible databases
|
||||
*
|
||||
* @param int $customerid
|
||||
* optional, admin-only, select dbs of a specific customer by id
|
||||
* @param string $loginname
|
||||
* optional, admin-only, select dbs of a specific customer by loginname
|
||||
*
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws \Exception
|
||||
* @return string json-encoded array
|
||||
@@ -465,7 +474,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
* optional, required when called as admin (if $loginname is not specified)
|
||||
* @param string $loginname
|
||||
* optional, required when called as admin (if $customerid is not specified)
|
||||
*
|
||||
*
|
||||
* @access admin, customer
|
||||
* @throws \Exception
|
||||
* @return string json-encoded array
|
||||
|
||||
@@ -59,7 +59,7 @@ class PhpSettings extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
||||
);
|
||||
|
||||
$query = "SELECT * FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `phpsettingid` = :id";
|
||||
WHERE `phpsettingid` = :id AND `email_only` = '0' AND `phpenabled` = '1'";
|
||||
|
||||
if (! $with_subdomains) {
|
||||
$query .= " AND `parentdomainid` = '0'";
|
||||
@@ -122,7 +122,7 @@ class PhpSettings extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the total number of accessable php-setting entries
|
||||
* returns the total number of accessible php-setting entries
|
||||
*
|
||||
* @access admin
|
||||
* @throws \Exception
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace Froxlor\Api\Commands;
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Domain\Domain;
|
||||
use Froxlor\Settings;
|
||||
|
||||
/**
|
||||
@@ -230,6 +231,15 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
}
|
||||
}
|
||||
|
||||
// validate dns if lets encrypt is enabled to check whether we can use it at all
|
||||
if ($letsencrypt == '1' && Settings::Get('system.le_domain_dnscheck') == '1') {
|
||||
$our_ips = Domain::getIpsOfDomain($domain_check['id']);
|
||||
$domain_ips = \Froxlor\PhpHelper::gethostbynamel6($completedomain);
|
||||
if ($domain_ips == false || count(array_intersect($our_ips, $domain_ips)) <= 0) {
|
||||
\Froxlor\UI\Response::standard_error('invaliddnsforletsencrypt', '', true);
|
||||
}
|
||||
}
|
||||
|
||||
// Temporarily deactivate ssl_redirect until Let's Encrypt certificate was generated
|
||||
if ($ssl_redirect > 0 && $letsencrypt == 1) {
|
||||
$ssl_redirect = 2;
|
||||
@@ -595,6 +605,15 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
}
|
||||
}
|
||||
|
||||
// validate dns if lets encrypt is enabled to check whether we can use it at all
|
||||
if ($result['letsencrypt'] != $letsencrypt && $letsencrypt == '1' && Settings::Get('system.le_domain_dnscheck') == '1') {
|
||||
$our_ips = Domain::getIpsOfDomain($result['parentdomainid']);
|
||||
$domain_ips = \Froxlor\PhpHelper::gethostbynamel6($result['domain']);
|
||||
if ($domain_ips == false || count(array_intersect($our_ips, $domain_ips)) <= 0) {
|
||||
\Froxlor\UI\Response::standard_error('invaliddnsforletsencrypt', '', true);
|
||||
}
|
||||
}
|
||||
|
||||
// We can't enable let's encrypt for wildcard-domains
|
||||
if ($iswildcarddomain == '1' && $letsencrypt == '1') {
|
||||
\Froxlor\UI\Response::standard_error('nowildcardwithletsencrypt');
|
||||
@@ -624,7 +643,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
\Froxlor\Domain\Domain::updateRedirectOfDomain($id, $redirectcode);
|
||||
}
|
||||
|
||||
if ($path != $result['documentroot'] || $isemaildomain != $result['isemaildomain'] || $wwwserveralias != $result['wwwserveralias'] || $iswildcarddomain != $result['iswildcarddomain'] || $aliasdomain != $result['aliasdomain'] || $openbasedir_path != $result['openbasedir_path'] || $ssl_redirect != $result['ssl_redirect'] || $letsencrypt != $result['letsencrypt'] || $hsts_maxage != $result['hsts'] || $hsts_sub != $result['hsts_sub'] || $hsts_preload != $result['hsts_preload'] || $phpsettingid != $result['phpsettingid']) {
|
||||
if ($path != $result['documentroot'] || $isemaildomain != $result['isemaildomain'] || $wwwserveralias != $result['wwwserveralias'] || $iswildcarddomain != $result['iswildcarddomain'] || $aliasdomain != (int)$result['aliasdomain'] || $openbasedir_path != $result['openbasedir_path'] || $ssl_redirect != $result['ssl_redirect'] || $letsencrypt != $result['letsencrypt'] || $hsts_maxage != $result['hsts'] || $hsts_sub != $result['hsts_sub'] || $hsts_preload != $result['hsts_preload'] || $phpsettingid != $result['phpsettingid']) {
|
||||
$stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
|
||||
`documentroot` = :documentroot,
|
||||
@@ -810,7 +829,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the total number of accessable subdomain entries
|
||||
* returns the total number of accessible subdomain entries
|
||||
*
|
||||
* @param int $customerid
|
||||
* optional, admin-only, select (sub)domains of a specific customer by id
|
||||
|
||||
@@ -60,6 +60,10 @@ class Traffic extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
* optional, default empty
|
||||
* @param int $day
|
||||
* optional, default empty
|
||||
* @param int $date_from
|
||||
* optional timestamp, default empty, if specified, $year, $month and $day will be ignored
|
||||
* @param int $date_until
|
||||
* optional timestamp, default empty, if specified, $year, $month and $day will be ignored
|
||||
* @param bool $customer_traffic
|
||||
* optional, admin-only, whether to output ones own traffic or all of ones customers, default is 0 (false)
|
||||
* @param int $customerid
|
||||
@@ -76,10 +80,29 @@ class Traffic extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
$year = $this->getParam('year', true, "");
|
||||
$month = $this->getParam('month', true, "");
|
||||
$day = $this->getParam('day', true, "");
|
||||
$date_from = $this->getParam('date_from', true, - 1);
|
||||
$date_until = $this->getParam('date_until', true, - 1);
|
||||
$customer_traffic = $this->getBoolParam('customer_traffic', true, 0);
|
||||
$customer_ids = $this->getAllowedCustomerIds();
|
||||
$result = array();
|
||||
$params = array();
|
||||
|
||||
// validate parameters
|
||||
if ($date_from >= 0 || $date_until >= 0) {
|
||||
$year = "";
|
||||
$month = "";
|
||||
$day = "";
|
||||
if ($date_from == $date_until) {
|
||||
$date_until = -1;
|
||||
}
|
||||
if ($date_from >= 0 && $date_until >= 0 && $date_until < $date_from) {
|
||||
// switch
|
||||
$temp_ts = $date_from;
|
||||
$date_from = $date_until;
|
||||
$date_until = $temp_ts;
|
||||
}
|
||||
}
|
||||
|
||||
// check for year/month/day
|
||||
$where_str = "";
|
||||
if (! empty($year) && is_numeric($year)) {
|
||||
@@ -94,6 +117,17 @@ class Traffic extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
$where_str .= " AND `day` = :day";
|
||||
$params['day'] = $day;
|
||||
}
|
||||
if ($date_from >= 0 && $date_until >= 0) {
|
||||
$where_str .= " AND `stamp` BETWEEN :df AND :du";
|
||||
$params['df'] = $date_from;
|
||||
$params['du'] = $date_until;
|
||||
} elseif ($date_from >= 0 && $date_until < 0) {
|
||||
$where_str .= " AND `stamp` > :df";
|
||||
$params['df'] = $date_from;
|
||||
} elseif ($date_from < 0 && $date_until >= 0) {
|
||||
$where_str .= " AND `stamp` < :du";
|
||||
$params['du'] = $date_until;
|
||||
}
|
||||
|
||||
if (! $this->isAdmin() || ($this->isAdmin() && $customer_traffic)) {
|
||||
$result_stmt = Database::prepare("
|
||||
|
||||
@@ -150,7 +150,7 @@ abstract class BulkAction
|
||||
|
||||
/**
|
||||
* reads in the csv import file and returns an array with
|
||||
* all the entites to be imported
|
||||
* all the entities to be imported
|
||||
*
|
||||
* @param string $separator
|
||||
*
|
||||
|
||||
@@ -402,7 +402,7 @@ class ConfigServicesAction extends \Froxlor\Cli\Action
|
||||
} elseif (! file_exists($this->_args["froxlor-dir"])) {
|
||||
throw new \Exception("Given froxlor directory cannot be found ('" . $this->_args["froxlor-dir"] . "')");
|
||||
} elseif (! is_readable($this->_args["froxlor-dir"])) {
|
||||
throw new \Exception("Given froxlor direcotry cannot be read ('" . $this->_args["froxlor-dir"] . "')");
|
||||
throw new \Exception("Given froxlor directory cannot be read ('" . $this->_args["froxlor-dir"] . "')");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class SwitchServerIpAction extends \Froxlor\Cli\Action
|
||||
$ip_list = $this->_args['switch'];
|
||||
|
||||
if (empty($ip_list) || is_bool($ip_list)) {
|
||||
throw new \Exception("No paramters given for --switch action.");
|
||||
throw new \Exception("No parameters given for --switch action.");
|
||||
}
|
||||
|
||||
$ips_to_switch = array();
|
||||
@@ -179,7 +179,7 @@ class SwitchServerIpAction extends \Froxlor\Cli\Action
|
||||
} elseif (! file_exists($this->_args["froxlor-dir"])) {
|
||||
throw new \Exception("Given froxlor directory cannot be found ('" . $this->_args["froxlor-dir"] . "')");
|
||||
} elseif (! is_readable($this->_args["froxlor-dir"])) {
|
||||
throw new \Exception("Given froxlor direcotry cannot be read ('" . $this->_args["froxlor-dir"] . "')");
|
||||
throw new \Exception("Given froxlor directory cannot be read ('" . $this->_args["froxlor-dir"] . "')");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class ConfigDaemon
|
||||
private $isparsed = false;
|
||||
|
||||
/**
|
||||
* Sub - area of the full - XML only holding the daemon - data we are interessted in
|
||||
* Sub - area of the full - XML only holding the daemon - data we are interested in
|
||||
*
|
||||
* @var \SimpleXMLElement
|
||||
*/
|
||||
|
||||
@@ -200,14 +200,14 @@ abstract class DnsBase
|
||||
|
||||
while ($domain = $result_domains_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
|
||||
$privkey_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('dkim.dkim_prefix') . '/dkim' . $domain['dkim_id'] . '.priv');
|
||||
$privkey_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('dkim.dkim_prefix') . '/dkim' . $domain['dkim_id'] . Settings::Get('dkim.privkeysuffix'));
|
||||
$pubkey_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('dkim.dkim_prefix') . '/dkim' . $domain['dkim_id'] . '.public');
|
||||
|
||||
if ($domain['dkim_privkey'] == '' || $domain['dkim_pubkey'] == '') {
|
||||
$max_dkim_id_stmt = Database::query("SELECT MAX(`dkim_id`) as `max_dkim_id` FROM `" . TABLE_PANEL_DOMAINS . "`");
|
||||
$max_dkim_id = $max_dkim_id_stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$domain['dkim_id'] = (int) $max_dkim_id['max_dkim_id'] + 1;
|
||||
$privkey_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('dkim.dkim_prefix') . '/dkim' . $domain['dkim_id'] . '.priv');
|
||||
$privkey_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('dkim.dkim_prefix') . '/dkim' . $domain['dkim_id'] . Settings::Get('dkim.privkeysuffix'));
|
||||
\Froxlor\FileDir::safe_exec('openssl genrsa -out ' . escapeshellarg($privkey_filename) . ' ' . Settings::Get('dkim.dkim_keylength'));
|
||||
$domain['dkim_privkey'] = file_get_contents($privkey_filename);
|
||||
\Froxlor\FileDir::safe_exec("chmod 0640 " . escapeshellarg($privkey_filename));
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace Froxlor\Cron\Dns;
|
||||
|
||||
use Froxlor\Settings;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2016 the Froxlor Team (see authors).
|
||||
@@ -13,7 +15,7 @@ namespace Froxlor\Cron\Dns;
|
||||
* @author Froxlor team <team@froxlor.org> (2016-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Cron
|
||||
*
|
||||
*
|
||||
*/
|
||||
class PowerDNS extends DnsBase
|
||||
{
|
||||
@@ -111,15 +113,16 @@ class PowerDNS extends DnsBase
|
||||
|
||||
private function insertZone($domainname, $serial = 0)
|
||||
{
|
||||
$ins_stmt = \Froxlor\Dns\PowerDNS::getDB()->prepare("
|
||||
INSERT INTO domains set `name` = :domainname, `notified_serial` = :serial, `type` = 'NATIVE'
|
||||
$ins_stmt = \Froxlor\Dns\PowerDNS::getDB()->prepare("
|
||||
INSERT INTO domains set `name` = :domainname, `notified_serial` = :serial, `type` = :type
|
||||
");
|
||||
$ins_stmt->execute(array(
|
||||
'domainname' => $domainname,
|
||||
'serial' => $serial
|
||||
));
|
||||
$lastid = \Froxlor\Dns\PowerDNS::getDB()->lastInsertId();
|
||||
return $lastid;
|
||||
$ins_stmt->execute(array(
|
||||
'domainname' => $domainname,
|
||||
'serial' => $serial,
|
||||
'type' => strtoupper(Settings::Get('system.powerdns_mode'))
|
||||
));
|
||||
$lastid = \Froxlor\Dns\PowerDNS::getDB()->lastInsertId();
|
||||
return $lastid;;
|
||||
}
|
||||
|
||||
private function insertRecords($domainid = 0, $records = array(), $origin = "")
|
||||
|
||||
@@ -425,6 +425,11 @@ class Apache extends HttpConfigBase
|
||||
|
||||
if ($row_ipsandports['ssl_key_file'] == '') {
|
||||
$row_ipsandports['ssl_key_file'] = Settings::Get('system.ssl_key_file');
|
||||
if (! file_exists($row_ipsandports['ssl_key_file'])) {
|
||||
// explicitly disable ssl for this vhost
|
||||
$row_ipsandports['ssl_cert_file'] = "";
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_DEBUG, 'System certificate key-file "' . Settings::Get('system.ssl_key_file') . '" does not seem to exist. Disabling SSL-vhost for "' . Settings::Get('system.hostname') . '"');
|
||||
}
|
||||
}
|
||||
|
||||
if ($row_ipsandports['ssl_ca_file'] == '') {
|
||||
@@ -560,7 +565,7 @@ class Apache extends HttpConfigBase
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function composePhpOptions($domain, $ssl_vhost = false)
|
||||
protected function composePhpOptions(&$domain, $ssl_vhost = false)
|
||||
{
|
||||
$php_options_text = '';
|
||||
|
||||
@@ -783,14 +788,6 @@ class Apache extends HttpConfigBase
|
||||
));
|
||||
$logfiles_text .= ' CustomLog "|' . $command . '" ' . $logtype . "\n";
|
||||
} else {
|
||||
// Create the logfile if it does not exist (fixes #46)
|
||||
touch($error_log);
|
||||
chown($error_log, Settings::Get('system.httpuser'));
|
||||
chgrp($error_log, Settings::Get('system.httpgroup'));
|
||||
touch($access_log);
|
||||
chown($access_log, Settings::Get('system.httpuser'));
|
||||
chgrp($access_log, Settings::Get('system.httpgroup'));
|
||||
|
||||
$logfiles_text .= ' ErrorLog "' . $error_log . '"' . "\n";
|
||||
$logfiles_text .= ' CustomLog "' . $access_log . '" ' . $logtype . "\n";
|
||||
}
|
||||
@@ -829,7 +826,7 @@ class Apache extends HttpConfigBase
|
||||
// After inserting the AWStats information,
|
||||
// be sure to build the awstats conf file as well
|
||||
// and chown it using $awstats_params, #258
|
||||
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations
|
||||
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the information
|
||||
\Froxlor\Http\Statistics::createAWStatsConf(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias, $domain['customerroot'], $domain);
|
||||
}
|
||||
}
|
||||
@@ -960,8 +957,13 @@ class Apache extends HttpConfigBase
|
||||
}
|
||||
}
|
||||
|
||||
if ($domain['ssl_key_file'] == '') {
|
||||
if ($domain['ssl_key_file'] == '' || ! file_exists($domain['ssl_key_file'])) {
|
||||
$domain['ssl_key_file'] = Settings::Get('system.ssl_key_file');
|
||||
if (! file_exists($domain['ssl_key_file'])) {
|
||||
// explicitly disable ssl for this vhost
|
||||
$domain['ssl_cert_file'] = "";
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_DEBUG, 'System certificate key-file "' . Settings::Get('system.ssl_key_file') . '" does not seem to exist. Disabling SSL-vhost for "' . $domain['domain'] . '"');
|
||||
}
|
||||
}
|
||||
|
||||
if ($domain['ssl_ca_file'] == '') {
|
||||
|
||||
@@ -24,7 +24,7 @@ use Froxlor\Cron\Http\Php\PhpInterface;
|
||||
class ApacheFcgi extends Apache
|
||||
{
|
||||
|
||||
protected function composePhpOptions($domain, $ssl_vhost = false)
|
||||
protected function composePhpOptions(&$domain, $ssl_vhost = false)
|
||||
{
|
||||
$php_options_text = '';
|
||||
|
||||
@@ -43,6 +43,8 @@ class ApacheFcgi extends Apache
|
||||
$php_options_text .= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
|
||||
}
|
||||
|
||||
$domain['fpm_socket'] = $php->getInterface()->getSocketFile();
|
||||
|
||||
// mod_proxy stuff for apache-2.4
|
||||
if (Settings::Get('system.apache24') == '1' && Settings::Get('phpfpm.use_mod_proxy') == '1') {
|
||||
$filesmatch = $phpconfig['fpm_settings']['limit_extensions'];
|
||||
@@ -54,7 +56,7 @@ class ApacheFcgi extends Apache
|
||||
// start block, cut off last pipe and close block
|
||||
$filesmatch = '(' . str_replace(".", "\.", substr($filesmatch, 0, - 1)) . ')';
|
||||
$php_options_text .= ' <FilesMatch \.' . $filesmatch . '$>' . "\n";
|
||||
$php_options_text .= ' SetHandler proxy:unix:' . $php->getInterface()->getSocketFile() . '|fcgi://localhost' . "\n";
|
||||
$php_options_text .= ' SetHandler proxy:unix:' . $domain['fpm_socket'] . '|fcgi://localhost' . "\n";
|
||||
$php_options_text .= ' </FilesMatch>' . "\n";
|
||||
|
||||
$mypath_dir = new \Froxlor\Http\Directory($domain['documentroot']);
|
||||
@@ -80,7 +82,7 @@ class ApacheFcgi extends Apache
|
||||
if ($phpconfig['pass_authorizationheader'] == '1') {
|
||||
$addheader = " -pass-header Authorization";
|
||||
}
|
||||
$php_options_text .= ' FastCgiExternalServer ' . $php->getInterface()->getAliasConfigDir() . $srvName . ' -socket ' . $php->getInterface()->getSocketFile() . ' -idle-timeout ' . $phpconfig['fpm_settings']['idle_timeout'] . $addheader . "\n";
|
||||
$php_options_text .= ' FastCgiExternalServer ' . $php->getInterface()->getAliasConfigDir() . $srvName . ' -socket ' . $domain['fpm_socket'] . ' -idle-timeout ' . $phpconfig['fpm_settings']['idle_timeout'] . $addheader . "\n";
|
||||
$php_options_text .= ' <Directory "' . \Froxlor\FileDir::makeCorrectDir($domain['documentroot']) . '">' . "\n";
|
||||
$filesmatch = $phpconfig['fpm_settings']['limit_extensions'];
|
||||
$extensions = explode(" ", $filesmatch);
|
||||
|
||||
@@ -287,7 +287,7 @@ class ConfigIO
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a file/direcotry from the settings and checks whether it exists
|
||||
* returns a file/directory from the settings and checks whether it exists
|
||||
*
|
||||
* @param string $group
|
||||
* settings-group
|
||||
|
||||
@@ -105,7 +105,11 @@ class DomainSSL
|
||||
$_fh = fopen($filename, 'w');
|
||||
fwrite($_fh, $dom_certs[$type]);
|
||||
fclose($_fh);
|
||||
chmod($filename, 0600);
|
||||
if ($type == 'ssl_key_file') {
|
||||
chmod($filename, 0600);
|
||||
} else {
|
||||
chmod($filename, 0644);
|
||||
}
|
||||
}
|
||||
}
|
||||
// override corresponding array values
|
||||
|
||||
@@ -98,8 +98,12 @@ class HttpConfigBase
|
||||
'IP' => $ip,
|
||||
'PORT' => $port,
|
||||
'SCHEME' => ($is_ssl_vhost) ? 'https' : 'http',
|
||||
'DOCROOT' => $domain['documentroot']
|
||||
'DOCROOT' => $domain['documentroot'],
|
||||
'FPMSOCKET' => ''
|
||||
);
|
||||
if ((int) Settings::Get('phpfpm.enabled') == 1 && isset($domain['fpm_socket']) && !empty($domain['fpm_socket'])) {
|
||||
$templateVars['FPMSOCKET'] = $domain['fpm_socket'];
|
||||
}
|
||||
return \Froxlor\PhpHelper::replaceVariables($template, $templateVars);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,21 @@ use Froxlor\FileDir;
|
||||
* @author Froxlor team <team@froxlor.org> (2016-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Cron
|
||||
*
|
||||
*
|
||||
* @since 0.9.35
|
||||
*
|
||||
*
|
||||
*/
|
||||
class AcmeSh extends \Froxlor\Cron\FroxlorCron
|
||||
{
|
||||
|
||||
const ACME_PROVIDER = [
|
||||
'letsencrypt' => "https://acme-v02.api.letsencrypt.org/directory",
|
||||
'letsencrypt_test' => "https://acme-staging-v02.api.letsencrypt.org/directory",
|
||||
'buypass' => "https://api.buypass.com/acme/directory",
|
||||
'buypass_test' => "https://api.test4.buypass.no/acme/directory",
|
||||
'zerossl' => "https://acme.zerossl.com/v2/DV90"
|
||||
];
|
||||
|
||||
private static $apiserver = "";
|
||||
|
||||
private static $acmesh = "/root/.acme.sh/acme.sh";
|
||||
@@ -63,7 +71,7 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron
|
||||
$issue_domains = self::issueDomains();
|
||||
$renew_froxlor = self::renewFroxlorVhost();
|
||||
$renew_domains = self::renewDomains(true);
|
||||
if ($issue_froxlor || !empty($issue_domains) || !empty($renew_froxlor) || $renew_domains) {
|
||||
if ($issue_froxlor || ! empty($issue_domains) || ! empty($renew_froxlor) || $renew_domains) {
|
||||
// insert task to generate certificates and vhost-configs
|
||||
\Froxlor\System\Cronjob::inserttask(1);
|
||||
}
|
||||
@@ -71,7 +79,7 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron
|
||||
}
|
||||
|
||||
// set server according to settings
|
||||
self::$apiserver = 'https://acme-' . (Settings::Get('system.letsencryptca') == 'testing' ? 'staging-' : '') . 'v0' . \Froxlor\Settings::Get('system.leapiversion') . '.api.letsencrypt.org/directory';
|
||||
self::$apiserver = self::ACME_PROVIDER[Settings::Get('system.letsencryptca')];
|
||||
|
||||
// validate acme.sh installation
|
||||
if (! self::checkInstall()) {
|
||||
@@ -271,7 +279,7 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron
|
||||
* @param int $domain_id
|
||||
* @param FroxlorLogger $cronlog
|
||||
*/
|
||||
private static function validateDns(&$domains = array(), $domain_id, &$cronlog)
|
||||
private static function validateDns(array &$domains, $domain_id, &$cronlog)
|
||||
{
|
||||
if (Settings::Get('system.le_domain_dnscheck') == '1' && ! empty($domains)) {
|
||||
$loop_domains = $domains;
|
||||
@@ -279,18 +287,24 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron
|
||||
$our_ips = Domain::getIpsOfDomain($domain_id);
|
||||
foreach ($loop_domains as $idx => $domain) {
|
||||
$cronlog->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, "Validating DNS of " . $domain);
|
||||
// ips accordint to NS
|
||||
// ips according to NS
|
||||
$domain_ips = PhpHelper::gethostbynamel6($domain);
|
||||
if ($domain_ips == false || count(array_intersect($our_ips, $domain_ips)) <= 0) {
|
||||
// no common ips...
|
||||
$cronlog->logAction(FroxlorLogger::CRON_ACTION, LOG_WARNING, "Skipping Let's Encrypt generation for " . $domain . " due to no system known IP address via DNS check");
|
||||
unset($domains[$idx]);
|
||||
// in order to avoid a cron-loop that tries to get a certificate every 5 minutes, we disable let's encrypt for this domain
|
||||
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `letsencrypt` = '0' WHERE `id` = :did");
|
||||
Database::pexecute($upd_stmt, [
|
||||
'did' => $domain_id
|
||||
]);
|
||||
$cronlog->logAction(FroxlorLogger::CRON_ACTION, LOG_WARNING, "Let's Encrypt deactivated for domain " . $domain);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function runAcmeSh($certrow = array(), $domains = array(), &$cronlog = null, $force = false)
|
||||
private static function runAcmeSh(array $certrow, array $domains, &$cronlog = null, $force = false)
|
||||
{
|
||||
if (! empty($domains)) {
|
||||
|
||||
@@ -306,7 +320,7 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron
|
||||
if (Settings::Get('system.letsencryptreuseold') != '1') {
|
||||
$acmesh_cmd .= " --always-force-new-domain-key";
|
||||
}
|
||||
if (Settings::Get('system.letsencryptca') == 'testing') {
|
||||
if (Settings::Get('system.letsencryptca') == 'letsencrypt_test') {
|
||||
$acmesh_cmd .= " --staging";
|
||||
}
|
||||
if ($force) {
|
||||
@@ -497,8 +511,8 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron
|
||||
|
||||
private static function checkFsFilesAreNewer($domain, $cert_date = 0)
|
||||
{
|
||||
$certificate_folder = self::getWorkingDirFromEnv($domain);
|
||||
$ssl_file = \Froxlor\FileDir::makeCorrectFile($certificate_folder . '/' . $domain . '.cer');
|
||||
$certificate_folder = self::getWorkingDirFromEnv(strtolower($domain));
|
||||
$ssl_file = \Froxlor\FileDir::makeCorrectFile($certificate_folder . '/' . strtolower($domain) . '.cer');
|
||||
|
||||
if (is_dir($certificate_folder) && file_exists($ssl_file) && is_readable($ssl_file)) {
|
||||
$cert_data = openssl_x509_parse(file_get_contents($ssl_file));
|
||||
@@ -517,7 +531,7 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron
|
||||
$env_file = FileDir::makeCorrectFile(dirname(self::$acmesh) . '/acme.sh.env');
|
||||
if (file_exists($env_file)) {
|
||||
$output = [];
|
||||
$cut = <<<EOC
|
||||
$cut = <<<EOC
|
||||
cut -d'"' -f2
|
||||
EOC;
|
||||
exec('grep "LE_WORKING_DIR" ' . escapeshellarg($env_file) . ' | ' . $cut, $output);
|
||||
|
||||
@@ -364,7 +364,7 @@ class Lighttpd extends HttpConfigBase
|
||||
return;
|
||||
}
|
||||
|
||||
protected function composePhpOptions($domain)
|
||||
protected function composePhpOptions(&$domain)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -678,7 +678,7 @@ class Lighttpd extends HttpConfigBase
|
||||
// After inserting the AWStats information,
|
||||
// be sure to build the awstats conf file as well
|
||||
// and chown it using $awstats_params, #258
|
||||
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations
|
||||
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the information
|
||||
\Froxlor\Http\Statistics::createAWStatsConf(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias, $domain['customerroot'], $domain);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ use Froxlor\Cron\Http\Php\PhpInterface;
|
||||
class LighttpdFcgi extends Lighttpd
|
||||
{
|
||||
|
||||
protected function composePhpOptions($domain)
|
||||
protected function composePhpOptions(&$domain)
|
||||
{
|
||||
$php_options_text = '';
|
||||
|
||||
@@ -32,10 +32,11 @@ class LighttpdFcgi extends Lighttpd
|
||||
|
||||
// vhost data for php-fpm
|
||||
if ((int) Settings::Get('phpfpm.enabled') == 1) {
|
||||
$domain['fpm_socket'] = $php->getInterface()->getSocketFile();
|
||||
$php_options_text = ' fastcgi.server = ( ' . "\n";
|
||||
$php_options_text .= "\t" . '".php" => (' . "\n";
|
||||
$php_options_text .= "\t\t" . '"localhost" => (' . "\n";
|
||||
$php_options_text .= "\t\t" . '"socket" => "' . $php->getInterface()->getSocketFile() . '",' . "\n";
|
||||
$php_options_text .= "\t\t" . '"socket" => "' . $domain['fpm_socket'] . '",' . "\n";
|
||||
$php_options_text .= "\t\t" . '"check-local" => "enable",' . "\n";
|
||||
$php_options_text .= "\t\t" . '"disable-time" => 1' . "\n";
|
||||
$php_options_text .= "\t" . ')' . "\n";
|
||||
|
||||
@@ -166,6 +166,11 @@ class Nginx extends HttpConfigBase
|
||||
}
|
||||
if ($row_ipsandports['ssl_key_file'] == '') {
|
||||
$row_ipsandports['ssl_key_file'] = Settings::Get('system.ssl_key_file');
|
||||
if (! file_exists($row_ipsandports['ssl_key_file'])) {
|
||||
// explicitly disable ssl for this vhost
|
||||
$row_ipsandports['ssl_cert_file'] = "";
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_DEBUG, 'System certificate key-file "' . Settings::Get('system.ssl_key_file') . '" does not seem to exist. Disabling SSL-vhost for "' . Settings::Get('system.hostname') . '"');
|
||||
}
|
||||
}
|
||||
if ($row_ipsandports['ssl_ca_file'] == '') {
|
||||
$row_ipsandports['ssl_ca_file'] = Settings::Get('system.ssl_ca_file');
|
||||
@@ -669,8 +674,15 @@ class Nginx extends HttpConfigBase
|
||||
}
|
||||
}
|
||||
|
||||
if ($domain_or_ip['ssl_key_file'] == '') {
|
||||
if ($domain_or_ip['ssl_key_file'] == '' || ! file_exists($domain_or_ip['ssl_key_file'])) {
|
||||
// use fallback
|
||||
$domain_or_ip['ssl_key_file'] = Settings::Get('system.ssl_key_file');
|
||||
// check whether it exists
|
||||
if (! file_exists($domain_or_ip['ssl_key_file'])) {
|
||||
// explicitly disable ssl for this vhost
|
||||
$domain_or_ip['ssl_cert_file'] = "";
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_DEBUG, 'System certificate key-file "' . Settings::Get('system.ssl_key_file') . '" does not seem to exist. Disabling SSL-vhost for "' . $domain_or_ip['domain'] . '"');
|
||||
}
|
||||
}
|
||||
|
||||
if ($domain_or_ip['ssl_ca_file'] == '') {
|
||||
@@ -958,7 +970,7 @@ class Nginx extends HttpConfigBase
|
||||
return $returnval;
|
||||
}
|
||||
|
||||
protected function composePhpOptions($domain, $ssl_vhost = false)
|
||||
protected function composePhpOptions(&$domain, $ssl_vhost = false)
|
||||
{
|
||||
$phpopts = '';
|
||||
if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1') {
|
||||
@@ -1041,7 +1053,7 @@ class Nginx extends HttpConfigBase
|
||||
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
// awstats
|
||||
$stats_text .= "\t" . 'location ^~ /awstats {' . "\n";
|
||||
$stats_text .= "\t" . 'location ^~ /awstats/ {' . "\n";
|
||||
} else {
|
||||
// webalizer
|
||||
$stats_text .= "\t" . 'location ^~ /webalizer {' . "\n";
|
||||
@@ -1141,7 +1153,7 @@ class Nginx extends HttpConfigBase
|
||||
// After inserting the AWStats information,
|
||||
// be sure to build the awstats conf file as well
|
||||
// and chown it using $awstats_params, #258
|
||||
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations
|
||||
// Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the information
|
||||
\Froxlor\Http\Statistics::createAWStatsConf(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias, $domain['customerroot'], $domain);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ use Froxlor\Cron\Http\Php\PhpInterface;
|
||||
class NginxFcgi extends Nginx
|
||||
{
|
||||
|
||||
protected function composePhpOptions($domain, $ssl_vhost = false)
|
||||
protected function composePhpOptions(&$domain, $ssl_vhost = false)
|
||||
{
|
||||
$php_options_text = '';
|
||||
|
||||
@@ -43,7 +43,8 @@ class NginxFcgi extends Nginx
|
||||
if ($domain['ssl'] == '1' && $ssl_vhost) {
|
||||
$php_options_text .= "\t\t" . 'fastcgi_param HTTPS on;' . "\n";
|
||||
}
|
||||
$php_options_text .= "\t\t" . 'fastcgi_pass unix:' . $php->getInterface()->getSocketFile() . ";\n";
|
||||
$domain['fpm_socket'] = $php->getInterface()->getSocketFile();
|
||||
$php_options_text .= "\t\t" . 'fastcgi_pass unix:' . $domain['fpm_socket'] . ";\n";
|
||||
$php_options_text .= "\t\t" . 'fastcgi_index index.php;' . "\n";
|
||||
$php_options_text .= "\t}\n\n";
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class Fcgid
|
||||
// Set Binary
|
||||
$starter_file .= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($this->getConfigDir()) . "\n";
|
||||
|
||||
// remove +i attibute, so starter can be overwritten
|
||||
// remove +i attribute, so starter can be overwritten
|
||||
if (file_exists($this->getStarterFile())) {
|
||||
\Froxlor\FileDir::removeImmutable($this->getStarterFile());
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ class Fpm
|
||||
$openbasedir .= $_phpappendopenbasedir;
|
||||
}
|
||||
}
|
||||
$fpm_config .= 'php_admin_value[session.save_path] = ' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->domain['loginname'] . '/') . "\n";
|
||||
|
||||
$fpm_config .= 'php_admin_value[upload_tmp_dir] = ' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->domain['loginname'] . '/') . "\n";
|
||||
|
||||
$admin = $this->getAdminData($this->domain['adminid']);
|
||||
@@ -261,6 +261,11 @@ class Fpm
|
||||
$fpm_config .= 'php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f ' . $this->domain['email'] . "\n";
|
||||
}
|
||||
|
||||
// check for session.save_path, whether it has been specified by the user, if not, set a default
|
||||
if (strpos($fpm_config, 'php_value[session.save_path]') === false && strpos($fpm_config, 'php_admin_value[session.save_path]') === false) {
|
||||
$fpm_config .= 'php_admin_value[session.save_path] = ' . $this->getTempDir() . "\n";
|
||||
}
|
||||
|
||||
// append custom phpfpm configuration
|
||||
if (! empty($fpm_custom_config)) {
|
||||
$fpm_config .= "\n; Custom Configuration\n";
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace Froxlor\Cron\System;
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
@@ -24,13 +25,14 @@ class Extrausers
|
||||
{
|
||||
// passwd
|
||||
$passwd = '/var/lib/extrausers/passwd';
|
||||
$sql = "SELECT customerid,username,'x' as password,uid,gid,'Froxlor User' as comment,homedir,shell, login_enabled FROM ftp_users ORDER BY uid ASC";
|
||||
self::generateFile($passwd, $sql, $cronlog);
|
||||
$sql = "SELECT customerid,username,'x' as password,uid,gid,'Froxlor User' as comment,homedir,shell, login_enabled FROM ftp_users ORDER BY uid, LENGTH(username) ASC";
|
||||
$users_list = [];
|
||||
self::generateFile($passwd, $sql, $cronlog, $users_list);
|
||||
|
||||
// group
|
||||
$group = '/var/lib/extrausers/group';
|
||||
$sql = "SELECT groupname,'x' as password,gid,members FROM ftp_groups ORDER BY gid ASC";
|
||||
self::generateFile($group, $sql, $cronlog);
|
||||
self::generateFile($group, $sql, $cronlog, $users_list);
|
||||
|
||||
// shadow
|
||||
$shadow = '/var/lib/extrausers/shadow';
|
||||
@@ -44,7 +46,7 @@ class Extrausers
|
||||
@chmod('/var/lib/extrausers/shadow', 0640);
|
||||
}
|
||||
|
||||
private static function generateFile($file, $query, &$cronlog)
|
||||
private static function generateFile($file, $query, &$cronlog, &$result_list = null)
|
||||
{
|
||||
$type = basename($file);
|
||||
$cronlog->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_NOTICE, 'Creating ' . $type . ' file');
|
||||
@@ -74,6 +76,9 @@ class Extrausers
|
||||
$u['comment'] = 'Locked Froxlor User';
|
||||
}
|
||||
$line = $u['username'] . ':' . $u['password'] . ':' . $u['uid'] . ':' . $u['gid'] . ':' . $u['comment'] . ':' . $u['homedir'] . ':' . $u['shell'] . PHP_EOL;
|
||||
if (is_array($result_list)) {
|
||||
$result_list[] = $u['username'];
|
||||
}
|
||||
break;
|
||||
case 'group':
|
||||
$line = $u['groupname'] . ':' . $u['password'] . ':' . $u['gid'] . ':' . $u['members'] . PHP_EOL;
|
||||
@@ -84,6 +89,19 @@ class Extrausers
|
||||
}
|
||||
$data_content .= $line;
|
||||
}
|
||||
|
||||
// check for local group to generate
|
||||
if ($type == 'group' && Settings::Get('system.froxlorusergroup') != '') {
|
||||
$guid = intval(Settings::Get('system.froxlorusergroup_gid'));
|
||||
if (empty($guid)) {
|
||||
$guid = intval(Settings::Get('system.lastguid')) + 1;
|
||||
Settings::Set('system.lastguid', $guid, true);
|
||||
Settings::Set('system.froxlorusergroup_gid', $guid, true);
|
||||
}
|
||||
$line = Settings::Get('system.froxlorusergroup') . ':x:' . $guid . ':' . implode(',', $result_list) . PHP_EOL;
|
||||
$data_content .= $line;
|
||||
}
|
||||
|
||||
if (file_put_contents($file, $data_content) !== false) {
|
||||
$cronlog->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_NOTICE, 'Succesfully wrote ' . $type . ' file');
|
||||
} else {
|
||||
|
||||
@@ -69,7 +69,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
||||
}
|
||||
|
||||
/**
|
||||
* TRAFFIC AND DISKUSAGE MESSURE
|
||||
* TRAFFIC AND DISKUSAGE MEASURE
|
||||
*/
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_INFO, 'Traffic run started...');
|
||||
$admin_traffic = array();
|
||||
@@ -163,6 +163,13 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
||||
|
||||
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "` ORDER BY `customerid` ASC");
|
||||
|
||||
$currentDate = date("Y-m-d");
|
||||
|
||||
$current_stamp = time();
|
||||
$current_year = date('Y', $current_stamp);
|
||||
$current_month = date('m', $current_stamp);
|
||||
$current_day = date('d', $current_stamp);
|
||||
|
||||
while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
/**
|
||||
* HTTP-Traffic
|
||||
@@ -208,7 +215,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
||||
// will iterate through all customer-domains and the awstats-configs
|
||||
// know the logfile-name, #246
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$httptraffic += floatval(self::callAwstatsGetTraffic($row['customerid'], $row['documentroot'] . '/awstats/', $domainlist[$row['customerid']]));
|
||||
$httptraffic += floatval(self::callAwstatsGetTraffic($row['customerid'], $row['documentroot'] . '/awstats/', $domainlist[$row['customerid']], $current_stamp));
|
||||
} else {
|
||||
$httptraffic += floatval(self::callWebalizerGetTraffic($row['loginname'], $row['documentroot'] . '/webalizer/', $caption, $domainlist[$row['customerid']]));
|
||||
}
|
||||
@@ -250,8 +257,6 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
||||
if (Settings::Get("system.mailtraffic_enabled")) {
|
||||
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_INFO, 'mail traffic usage for ' . $row['loginname'] . " started...");
|
||||
|
||||
$currentDate = date("Y-m-d");
|
||||
|
||||
$domains_stmt = Database::prepare("SELECT domain FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid` = :cid");
|
||||
Database::pexecute($domains_stmt, array(
|
||||
"cid" => $row['customerid']
|
||||
@@ -312,10 +317,10 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
||||
|
||||
$ins_data = array(
|
||||
'customerid' => $row['customerid'],
|
||||
'year' => date('Y', time()),
|
||||
'month' => date('m', time()),
|
||||
'day' => date('d', time()),
|
||||
'stamp' => time(),
|
||||
'year' => $current_year,
|
||||
'month' => $current_month,
|
||||
'day' => $current_day,
|
||||
'stamp' => $current_stamp,
|
||||
'http' => $current_traffic['http'],
|
||||
'ftp_up' => $current_traffic['ftp_up'],
|
||||
'ftp_down' => $current_traffic['ftp_down'],
|
||||
@@ -340,8 +345,8 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `year` = :year AND `month` = :month AND `customerid` = :customerid
|
||||
");
|
||||
$sum_month_traffic = Database::pexecute_first($sum_month_traffic_stmt, array(
|
||||
'year' => date('Y', time()),
|
||||
'month' => date('m', time()),
|
||||
'year' => $current_year,
|
||||
'month' => $current_month,
|
||||
'customerid' => $row['customerid']
|
||||
));
|
||||
$sum_month_traffic['all'] = $sum_month_traffic['http'] + $sum_month_traffic['ftp_up'] + $sum_month_traffic['ftp_down'] + $sum_month_traffic['mail'];
|
||||
@@ -425,10 +430,10 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
||||
|
||||
$ins_data = array(
|
||||
'customerid' => $row['customerid'],
|
||||
'year' => date('Y', time()),
|
||||
'month' => date('m', time()),
|
||||
'day' => date('d', time()),
|
||||
'stamp' => time(),
|
||||
'year' => $current_year,
|
||||
'month' => $current_month,
|
||||
'day' => $current_day,
|
||||
'stamp' => $current_stamp,
|
||||
'webspace' => $current_diskspace['webspace'],
|
||||
'mail' => $current_diskspace['mail'],
|
||||
'mysql' => $current_diskspace['mysql']
|
||||
@@ -534,10 +539,10 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
||||
|
||||
$ins_data = array(
|
||||
'adminid' => $row['adminid'],
|
||||
'year' => date('Y', time()),
|
||||
'month' => date('m', time()),
|
||||
'day' => date('d', time()),
|
||||
'stamp' => time(),
|
||||
'year' => $current_year,
|
||||
'month' => $current_month,
|
||||
'day' => $current_day,
|
||||
'stamp' => $current_stamp,
|
||||
'http' => $admin_traffic[$row['adminid']]['http'],
|
||||
'ftp_up' => $admin_traffic[$row['adminid']]['ftp_up'],
|
||||
'ftp_down' => $admin_traffic[$row['adminid']]['ftp_down'],
|
||||
@@ -734,7 +739,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
||||
return;
|
||||
}
|
||||
|
||||
private static function callAwstatsGetTraffic($customerid, $outputdir, $usersdomainlist)
|
||||
private static function callAwstatsGetTraffic($customerid, $outputdir, $usersdomainlist, $current_stamp)
|
||||
{
|
||||
$returnval = 0;
|
||||
|
||||
@@ -766,8 +771,8 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
|
||||
");
|
||||
$result_data = array(
|
||||
'customerid' => $customerid,
|
||||
'year' => date('Y', time()),
|
||||
'month' => date('m', time())
|
||||
'year' => date('Y', $current_stamp),
|
||||
'month' => date('m', $current_stamp)
|
||||
);
|
||||
$result = Database::pexecute_first($result_stmt, $result_data);
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ class Database
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the sql-access data as array using indeces
|
||||
* returns the sql-access data as array using indices
|
||||
* 'user', 'passwd' and 'host'.
|
||||
* Returns false if not enabled
|
||||
*
|
||||
@@ -279,6 +279,8 @@ class Database
|
||||
$host = $sql_root[self::$dbserver]['host'];
|
||||
$socket = isset($sql_root[self::$dbserver]['socket']) ? $sql_root[self::$dbserver]['socket'] : null;
|
||||
$port = isset($sql_root[self::$dbserver]['port']) ? $sql_root[self::$dbserver]['port'] : '3306';
|
||||
$sslCAFile = $sql_root[self::$dbserver]['ssl']['caFile'] ?? "";
|
||||
$sslVerifyServerCertificate = $sql_root[self::$dbserver]['ssl']['verifyServerCertificate'] ?? false;
|
||||
} else {
|
||||
$caption = 'localhost';
|
||||
$user = $sql["user"];
|
||||
@@ -286,6 +288,8 @@ class Database
|
||||
$host = $sql["host"];
|
||||
$socket = isset($sql['socket']) ? $sql['socket'] : null;
|
||||
$port = isset($sql['port']) ? $sql['port'] : '3306';
|
||||
$sslCAFile = $sql['ssl']['caFile'] ?? "";
|
||||
$sslVerifyServerCertificate = $sql['ssl']['verifyServerCertificate'] ?? false;
|
||||
}
|
||||
|
||||
// save sql-access-data if needed
|
||||
@@ -297,7 +301,9 @@ class Database
|
||||
'port' => $port,
|
||||
'socket' => $socket,
|
||||
'db' => $sql["db"],
|
||||
'caption' => $caption
|
||||
'caption' => $caption,
|
||||
'ssl_ca_file' => $sslCAFile,
|
||||
'ssl_verify_server_certificate' => $sslVerifyServerCertificate
|
||||
);
|
||||
}
|
||||
|
||||
@@ -321,6 +327,11 @@ class Database
|
||||
} else {
|
||||
$dbconf["dsn"]['host'] = $host;
|
||||
$dbconf["dsn"]['port'] = $port;
|
||||
|
||||
if (!empty(self::$sqldata['ssl_ca_file'])) {
|
||||
$options[\PDO::MYSQL_ATTR_SSL_CA] = self::$sqldata['ssl_ca_file'];
|
||||
$options[\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = (bool) self::$sqldata['ssl_verify_server_certificate'];
|
||||
}
|
||||
}
|
||||
|
||||
self::$dbname = $sql["db"];
|
||||
|
||||
@@ -16,9 +16,9 @@ use Froxlor\Settings;
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Classes
|
||||
*
|
||||
*
|
||||
* @since 0.9.31
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -82,11 +82,13 @@ class DbManager
|
||||
// get all usernames from db-manager
|
||||
$allsqlusers = $this->getManager()->getAllSqlUsers();
|
||||
// generate random username
|
||||
$username = $loginname . '-' . substr(md5(uniqid(microtime(), 1)), 20, 3);
|
||||
$username = $loginname . '-' . substr(\Froxlor\Froxlor::genSessionId(), 20, 3);
|
||||
// check whether it exists on the DBMS
|
||||
while (in_array($username, $allsqlusers)) {
|
||||
$username = $loginname . '-' . substr(md5(uniqid(microtime(), 1)), 20, 3);
|
||||
$username = $loginname . '-' . substr(\Froxlor\Froxlor::genSessionId(), 20, 3);
|
||||
}
|
||||
} elseif (strtoupper(Settings::Get('customer.mysqlprefix')) == 'DBNAME') {
|
||||
$username = $loginname;
|
||||
} else {
|
||||
$username = $loginname . Settings::Get('customer.mysqlprefix') . (intval($last_accnumber) + 1);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class IntegrityCheck
|
||||
'dbname' => Database::getDbName()
|
||||
));
|
||||
$charset = isset($resp['default_character_set_name']) ? $resp['default_character_set_name'] : null;
|
||||
if (! empty($charset) && strtolower($charset) != 'utf8') {
|
||||
if (! empty($charset) && substr(strtolower($charset), 0, 4) != 'utf8') {
|
||||
$this->log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "database charset seems to be different from UTF-8, integrity-check can fix that");
|
||||
if ($fix) {
|
||||
// fix database
|
||||
|
||||
@@ -53,7 +53,7 @@ class Dns
|
||||
$domain = $domain_id;
|
||||
}
|
||||
|
||||
if ($domain['isbinddomain'] != '1') {
|
||||
if (!isset($domain['isbinddomain']) || $domain['isbinddomain'] != '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,9 +131,26 @@ class Dns
|
||||
}
|
||||
|
||||
// additional required records for CAA if activated
|
||||
if (Settings::Get('system.dns_createcaaentry') && Settings::Get('system.use_ssl') == "1" && !empty($domain['p_ssl_ipandports'])) {
|
||||
// check for CAA content later
|
||||
self::addRequiredEntry('@CAA@', 'CAA', $required_entries);
|
||||
if (Settings::Get('system.dns_createcaaentry') && Settings::Get('system.use_ssl') == "1") {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT i.`ip`, i.`port`, i.`ssl`
|
||||
FROM " . TABLE_PANEL_IPSANDPORTS . " i
|
||||
LEFT JOIN " . TABLE_DOMAINTOIP . " dip ON dip.id_ipandports = i.id
|
||||
WHERE i.ssl = 1 AND dip.id_domain = :domainid
|
||||
");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'domainid' => $domain['id']
|
||||
));
|
||||
|
||||
$ssl_ipandports = array();
|
||||
while ($ssl_ipandport = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$ssl_ipandports[] = $ssl_ipandport;
|
||||
}
|
||||
|
||||
if (! empty($ssl_ipandports)) {
|
||||
// check for CAA content later
|
||||
self::addRequiredEntry('@CAA@', 'CAA', $required_entries);
|
||||
}
|
||||
}
|
||||
|
||||
// additional required records for SPF and DKIM if activated
|
||||
@@ -160,21 +177,39 @@ class Dns
|
||||
// unset special CAA required-entry
|
||||
unset($required_entries[$entry['type']][md5("@CAA@")]);
|
||||
}
|
||||
if (Settings::Get('spf.use_spf') == '1' && $entry['type'] == 'TXT' && $entry['record'] == '@' && (strtolower(substr($entry['content'], 0, 7)) == '"v=spf1' || strtolower(substr($entry['content'], 0, 6)) == 'v=spf1') ) {
|
||||
if (Settings::Get('spf.use_spf') == '1' && $entry['type'] == 'TXT' && $entry['record'] == '@' && (strtolower(substr($entry['content'], 0, 7)) == '"v=spf1' || strtolower(substr($entry['content'], 0, 6)) == 'v=spf1')) {
|
||||
// unset special spf required-entry
|
||||
unset($required_entries[$entry['type']][md5("@SPF@")]);
|
||||
}
|
||||
if (empty($primary_ns) && $entry['type'] == 'NS') {
|
||||
// use the first NS entry as primary ns
|
||||
if (empty($primary_ns) && $entry['record'] == '@' && $entry['type'] == 'NS') {
|
||||
// use the first NS entry pertaining to the current domain as primary ns
|
||||
$primary_ns = $entry['content'];
|
||||
}
|
||||
// check for CNAME on @, www- or wildcard-Alias and remove A/AAAA record accordingly
|
||||
foreach (['@', 'www', '*'] as $crceord) {
|
||||
if ($entry['type'] == 'CNAME' && $entry['record'] == '@' && (array_key_exists(md5($crceord), $required_entries['A']) || array_key_exists(md5($crceord), $required_entries['AAAA']))) {
|
||||
unset($required_entries['A'][md5($crceord)]);
|
||||
unset($required_entries['AAAA'][md5($crceord)]);
|
||||
foreach ([
|
||||
'@',
|
||||
'www',
|
||||
'*'
|
||||
] as $crecord) {
|
||||
if ($entry['type'] == 'CNAME' && $entry['record'] == '@' && (array_key_exists(md5($crecord), $required_entries['A']) || array_key_exists(md5($crecord), $required_entries['AAAA']))) {
|
||||
unset($required_entries['A'][md5($crecord)]);
|
||||
unset($required_entries['AAAA'][md5($crecord)]);
|
||||
}
|
||||
}
|
||||
// also allow overriding of auto-generated values (imap,pop3,mail,smtp) if enabled in the settings
|
||||
if (Settings::Get('system.dns_createmailentry')) {
|
||||
foreach (array(
|
||||
'imap',
|
||||
'pop3',
|
||||
'mail',
|
||||
'smtp'
|
||||
) as $crecord) {
|
||||
if ($entry['type'] == 'CNAME' && $entry['record'] == $crecord && (array_key_exists(md5($crecord), $required_entries['A']) || array_key_exists(md5($crecord), $required_entries['AAAA']))) {
|
||||
unset($required_entries['A'][md5($crecord)]);
|
||||
unset($required_entries['AAAA'][md5($crecord)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$zonerecords[] = new DnsEntry($entry['record'], $entry['type'], $entry['content'], $entry['prio'], $entry['ttl']);
|
||||
}
|
||||
|
||||
@@ -186,16 +221,16 @@ class Dns
|
||||
if ($froxlorhostname) {
|
||||
// use all available IP's for the froxlor-hostname
|
||||
$result_ip_stmt = Database::prepare("
|
||||
SELECT `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip`
|
||||
");
|
||||
SELECT `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip`
|
||||
");
|
||||
Database::pexecute($result_ip_stmt);
|
||||
} else {
|
||||
$result_ip_stmt = Database::prepare("
|
||||
SELECT `p`.`ip` AS `ip`
|
||||
FROM `" . TABLE_PANEL_IPSANDPORTS . "` `p`, `" . TABLE_DOMAINTOIP . "` `di`
|
||||
WHERE `di`.`id_domain` = :domainid AND `p`.`id` = `di`.`id_ipandports`
|
||||
GROUP BY `p`.`ip`;
|
||||
");
|
||||
SELECT `p`.`ip` AS `ip`
|
||||
FROM `" . TABLE_PANEL_IPSANDPORTS . "` `p`, `" . TABLE_DOMAINTOIP . "` `di`
|
||||
WHERE `di`.`id_domain` = :domainid AND `p`.`id` = `di`.`id_ipandports`
|
||||
GROUP BY `p`.`ip`;
|
||||
");
|
||||
Database::pexecute($result_ip_stmt, array(
|
||||
'domainid' => $domain_id
|
||||
));
|
||||
@@ -303,12 +338,30 @@ class Dns
|
||||
foreach ($records as $record) {
|
||||
if ($record == '@CAA@') {
|
||||
$caa_entries = explode(PHP_EOL, Settings::Get('caa.caa_entry'));
|
||||
if ($domain['letsencrypt'] == 1) {
|
||||
$le_entry = $domain['iswildcarddomain'] == '1' ? '0 issuewild "letsencrypt.org"' : '0 issue "letsencrypt.org"';
|
||||
array_push($caa_entries, $le_entry);
|
||||
$caa_domain = "letsencrypt.org";
|
||||
if (Settings::Get('system.letsencryptca') == 'buypass' || Settings::Get('system.letsencryptca') == 'buypass_test') {
|
||||
$caa_domain = "buypass.com";
|
||||
}
|
||||
if ($domain['letsencrypt'] == 1) {
|
||||
if (Settings::Get('system.letsencryptca') == 'zerossl') {
|
||||
$caa_domains = [
|
||||
"sectigo.com",
|
||||
"trust-provider.com",
|
||||
"usertrust.com",
|
||||
"comodoca.com",
|
||||
"comodo.com"
|
||||
];
|
||||
foreach ($caa_domains as $caa_domain) {
|
||||
$le_entry = $domain['iswildcarddomain'] == '1' ? '0 issuewild "' . $caa_domain . '"' : '0 issue "' . $caa_domain . '"';
|
||||
array_push($caa_entries, $le_entry);
|
||||
}
|
||||
} else {
|
||||
$le_entry = $domain['iswildcarddomain'] == '1' ? '0 issuewild "' . $caa_domain . '"' : '0 issue "' . $caa_domain . '"';
|
||||
array_push($caa_entries, $le_entry);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($caa_entries as $entry) {
|
||||
if (empty($entry)) continue;
|
||||
$zonerecords[] = new DnsEntry('@', 'CAA', $entry);
|
||||
// additional required records by subdomain setting
|
||||
if ($domain['wwwserveralias'] == '1') {
|
||||
@@ -343,10 +396,14 @@ class Dns
|
||||
}
|
||||
|
||||
// PowerDNS does not like multi-line-format
|
||||
$soa_content = $primary_ns . " " . self::escapeSoaAdminMail(Settings::Get('panel.adminmail')) . " ";
|
||||
$soa_email = Settings::Get('system.soaemail');
|
||||
if ($soa_email == "") {
|
||||
$soa_email = Settings::Get('panel.adminmail');
|
||||
}
|
||||
$soa_content = $primary_ns . " " . self::escapeSoaAdminMail($soa_email) . " ";
|
||||
$soa_content .= $domain['bindserial'] . " ";
|
||||
// TODO for now, dummy time-periods
|
||||
$soa_content .= "3600 900 604800 " . (int) Settings::Get('system.defaultttl');
|
||||
$soa_content .= "3600 900 1209600 1200";
|
||||
|
||||
$soa_record = new DnsEntry('@', 'SOA', $soa_content);
|
||||
array_unshift($zonerecords, $soa_record);
|
||||
|
||||
@@ -62,6 +62,11 @@ class PowerDNS
|
||||
} else {
|
||||
$dbconf["dsn"]['host'] = $mysql_data['gmysql-host'];
|
||||
$dbconf["dsn"]['port'] = $mysql_data['gmysql-port'];
|
||||
|
||||
if (!empty($mysql_data['gmysql-ssl-ca-file'])) {
|
||||
$options[\PDO::MYSQL_ATTR_SSL_CA] = $mysql_data['gmysql-ssl-ca-file'];
|
||||
$options[\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = (bool) $mysql_data['gmysql-ssl-verify-server-certificate'];
|
||||
}
|
||||
}
|
||||
|
||||
// add options to dsn-string
|
||||
|
||||
@@ -340,7 +340,7 @@ class Domain
|
||||
// run remove command
|
||||
\Froxlor\FileDir::safe_exec($acmesh . $params);
|
||||
// remove certificates directory
|
||||
@unlink($certificate_folder);
|
||||
\Froxlor\FileDir::safe_exec('rm -rf ' . $certificate_folder);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -370,7 +370,7 @@ class FileDir
|
||||
* @param
|
||||
* integer uid The uid which must match the found directories
|
||||
* @param
|
||||
* integer gid The gid which must match the found direcotries
|
||||
* integer gid The gid which must match the found directories
|
||||
* @param
|
||||
* string value the value for the input-field
|
||||
*
|
||||
@@ -461,7 +461,7 @@ class FileDir
|
||||
* @param int $uid
|
||||
* the uid which must match the found directories
|
||||
* @param int $gid
|
||||
* the gid which must match the found direcotries
|
||||
* the gid which must match the found directories
|
||||
*
|
||||
* @return array Array of found valid paths
|
||||
*/
|
||||
|
||||
@@ -7,10 +7,10 @@ final class Froxlor
|
||||
{
|
||||
|
||||
// Main version variable
|
||||
const VERSION = '0.10.22';
|
||||
const VERSION = '0.10.29';
|
||||
|
||||
// Database version (YYYYMMDDC where C is a daily counter)
|
||||
const DBVERSION = '202009070';
|
||||
const DBVERSION = '202109040';
|
||||
|
||||
// Distribution branding-tag (used for Debian etc.)
|
||||
const BRANDING = '';
|
||||
@@ -63,7 +63,7 @@ final class Froxlor
|
||||
*
|
||||
* @param string $to_check
|
||||
* version to check, if empty current version is used
|
||||
*
|
||||
*
|
||||
* @return bool true if version to check does not match, else false
|
||||
*/
|
||||
public static function hasUpdates($to_check = null)
|
||||
@@ -84,7 +84,7 @@ final class Froxlor
|
||||
*
|
||||
* @param int $to_check
|
||||
* version to check, if empty current dbversion is used
|
||||
*
|
||||
*
|
||||
* @return bool true if version to check does not match, else false
|
||||
*/
|
||||
public static function hasDbUpdates($to_check = null)
|
||||
@@ -105,7 +105,7 @@ final class Froxlor
|
||||
*
|
||||
* @param int $to_check
|
||||
* version to check
|
||||
*
|
||||
*
|
||||
* @return bool true if version to check matches, else false
|
||||
*/
|
||||
public static function isDatabaseVersion($to_check = null)
|
||||
@@ -124,7 +124,7 @@ final class Froxlor
|
||||
*
|
||||
* @param string $new_version
|
||||
* new-version
|
||||
*
|
||||
*
|
||||
* @return bool true on success, else false
|
||||
*/
|
||||
public static function updateToDbVersion($new_version = null)
|
||||
@@ -150,7 +150,7 @@ final class Froxlor
|
||||
*
|
||||
* @param string $new_version
|
||||
* new-version
|
||||
*
|
||||
*
|
||||
* @return bool true on success, else false
|
||||
*/
|
||||
public static function updateToVersion($new_version = null)
|
||||
@@ -191,7 +191,7 @@ final class Froxlor
|
||||
*
|
||||
* @param string $to_check
|
||||
* version to check
|
||||
*
|
||||
*
|
||||
* @return bool true if version to check matches, else false
|
||||
*/
|
||||
public static function isFroxlorVersion($to_check = null)
|
||||
@@ -202,6 +202,30 @@ final class Froxlor
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* generate safe unique session id
|
||||
*
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
public static function genSessionId(int $length = 16)
|
||||
{
|
||||
if(!isset($length) || intval($length) <= 8 ){
|
||||
$length = 16;
|
||||
}
|
||||
if (function_exists('random_bytes')) {
|
||||
return bin2hex(random_bytes($length));
|
||||
}
|
||||
if (function_exists('mcrypt_create_iv')) {
|
||||
return bin2hex(mcrypt_create_iv($length, MCRYPT_DEV_URANDOM));
|
||||
}
|
||||
if (function_exists('openssl_random_pseudo_bytes')) {
|
||||
return bin2hex(openssl_random_pseudo_bytes($length));
|
||||
}
|
||||
// if everything else fails, use unsafe fallback
|
||||
return md5(uniqid(microtime(), 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* compare of froxlor versions
|
||||
*
|
||||
|
||||
@@ -157,7 +157,7 @@ class FroxlorLogger
|
||||
echo "[" . $this->getLogLevelDesc($type) . "] " . $text . PHP_EOL;
|
||||
}
|
||||
|
||||
// warnings, errors and critical mesages WILL be logged
|
||||
// warnings, errors and critical messages WILL be logged
|
||||
if (Settings::Get('logger.log_cron') == '0' && $action == \Froxlor\FroxlorLogger::CRON_ACTION && $type > LOG_WARNING) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ class PhpHelper
|
||||
*
|
||||
* @return void|boolean
|
||||
*/
|
||||
public static function phpErrHandler($errno, $errstr, $errfile, $errline, $errcontext)
|
||||
public static function phpErrHandler($errno, $errstr, $errfile, $errline, $errcontext = array())
|
||||
{
|
||||
if (! (error_reporting() & $errno)) {
|
||||
// This error code is not included in error_reporting
|
||||
@@ -241,10 +241,14 @@ class PhpHelper
|
||||
$ips = array();
|
||||
foreach ($dns as $record) {
|
||||
if ($record["type"] == "A") {
|
||||
$ips[] = $record["ip"];
|
||||
// always use compressed ipv6 format
|
||||
$ip = inet_ntop(inet_pton($record["ip"]));
|
||||
$ips[] = $ip;
|
||||
}
|
||||
if ($record["type"] == "AAAA") {
|
||||
$ips[] = $record["ipv6"];
|
||||
// always use compressed ipv6 format
|
||||
$ip = inet_ntop(inet_pton($record["ipv6"]));
|
||||
$ips[] = $ip;
|
||||
}
|
||||
}
|
||||
if (count($ips) < 1) {
|
||||
@@ -398,12 +402,24 @@ class PhpHelper
|
||||
* @param array $global
|
||||
* @param \voku\helper\AntiXSS $antiXss
|
||||
*/
|
||||
public static function cleanGlobal(&$global = [], &$antiXss)
|
||||
public static function cleanGlobal(&$global, &$antiXss)
|
||||
{
|
||||
$ignored_fields = [
|
||||
'system_default_vhostconf',
|
||||
'system_default_sslvhostconf',
|
||||
'system_apache_globaldiropt',
|
||||
'specialsettings',
|
||||
'ssl_specialsettings',
|
||||
'default_vhostconf_domain',
|
||||
'ssl_default_vhostconf_domain',
|
||||
'filecontent'
|
||||
];
|
||||
if (isset($global) && ! empty($global)) {
|
||||
$tmp = $global;
|
||||
foreach ($tmp as $index => $value) {
|
||||
$global[$index] = $antiXss->xss_clean($value);
|
||||
if (!in_array($index, $ignored_fields)) {
|
||||
$global[$index] = $antiXss->xss_clean($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ use Froxlor\Database\Database;
|
||||
* @author Froxlor team <team@froxlor.org> (2018-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Classes
|
||||
*
|
||||
*
|
||||
* @since 0.9.39
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -60,6 +60,13 @@ class SImExporter
|
||||
|
||||
public static function export()
|
||||
{
|
||||
$settings_definitions = [];
|
||||
foreach (\Froxlor\PhpHelper::loadConfigArrayDir('./actions/admin/settings/')['groups'] AS $group) {
|
||||
foreach ($group['fields'] AS $field) {
|
||||
$settings_definitions[$field['settinggroup']][$field['varname']] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
$result_stmt = Database::query("
|
||||
SELECT * FROM `" . TABLE_PANEL_SETTINGS . "` ORDER BY `settingid` ASC
|
||||
");
|
||||
@@ -69,13 +76,26 @@ class SImExporter
|
||||
if (! in_array($index, self::$no_export)) {
|
||||
$_data[$index] = $row['value'];
|
||||
}
|
||||
|
||||
if (array_key_exists($row['settinggroup'], $settings_definitions) && array_key_exists($row['varname'], $settings_definitions[$row['settinggroup']])) {
|
||||
// Export image file
|
||||
if ($settings_definitions[$row['settinggroup']][$row['varname']]['type'] === "image") {
|
||||
if ($row['value'] === "") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$_data[$index.'.image_data'] = base64_encode(file_get_contents(explode('?', $row['value'], 2)[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add checksum for validation
|
||||
$_data['_sha'] = sha1(var_export($_data, true));
|
||||
$_export = json_encode($_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
if (! $_export) {
|
||||
throw new \Exception("Error exporting settings: " . json_last_error_msg());
|
||||
}
|
||||
|
||||
return $_export;
|
||||
}
|
||||
|
||||
@@ -98,7 +118,7 @@ class SImExporter
|
||||
if ($_sha != sha1(var_export($_data, true))) {
|
||||
throw new \Exception("SHA check of import data failed. Unable to import.");
|
||||
}
|
||||
// do not import version info - but we need that to possibily update settings
|
||||
// do not import version info - but we need that to possibly update settings
|
||||
// when there were changes in the variable-name or similar
|
||||
unset($_data['panel.version']);
|
||||
unset($_data['panel.db_version']);
|
||||
@@ -120,6 +140,26 @@ class SImExporter
|
||||
}
|
||||
// store new data
|
||||
foreach ($_data as $index => $value) {
|
||||
$index_split = explode('.', $index, 3);
|
||||
|
||||
// Catch image_data and save it
|
||||
if (isset($index_split[2]) && $index_split[2] === 'image_data' && !empty($_data[$index_split[0].'.'.$index_split[1]])) {
|
||||
$path = \Froxlor\Froxlor::getInstallDir().'/img/';
|
||||
if (!is_dir($path) && !mkdir($path, '0775')) {
|
||||
throw new \Exception("img directory does not exist and cannot be created");
|
||||
}
|
||||
|
||||
// Make sure we can write to the upload directory
|
||||
if (!is_writable($path)) {
|
||||
if (!chmod($path, '0775')) {
|
||||
throw new \Exception("Cannot write to img directory");
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents(\Froxlor\Froxlor::getInstallDir() . '/' . explode('?', $_data[$index_split[0].'.'.$index_split[1]], 2)[0], base64_decode($value));
|
||||
continue;
|
||||
}
|
||||
|
||||
Settings::Set($index, $value);
|
||||
}
|
||||
// save to DB
|
||||
|
||||
@@ -176,7 +176,7 @@ class Store
|
||||
if ($returnvalue !== false) {
|
||||
\Froxlor\System\Cronjob::inserttask('4');
|
||||
}
|
||||
return false;
|
||||
return $returnvalue;
|
||||
}
|
||||
|
||||
public static function storeSettingHostname($fieldname, $fielddata, $newfieldvalue)
|
||||
@@ -367,4 +367,67 @@ class Store
|
||||
|
||||
return $returnvalue;
|
||||
}
|
||||
|
||||
public static function storeSettingImage($fieldname, $fielddata)
|
||||
{
|
||||
if (isset($fielddata['settinggroup'], $fielddata['varname']) && is_array($fielddata) && $fielddata['settinggroup'] !== '' && $fielddata['varname'] !== '') {
|
||||
$save_to = null;
|
||||
$path = \Froxlor\Froxlor::getInstallDir().'/img/';
|
||||
|
||||
// New file?
|
||||
if (isset($_FILES[$fieldname]) && $_FILES[$fieldname]['tmp_name']) {
|
||||
// Make sure upload directory exists
|
||||
if (!is_dir($path) && !mkdir($path, '0775')) {
|
||||
throw new \Exception("img directory does not exist and cannot be created");
|
||||
}
|
||||
|
||||
// Make sure we can write to the upload directory
|
||||
if (!is_writable($path)) {
|
||||
if (!chmod($path, '0775')) {
|
||||
throw new \Exception("Cannot write to img directory");
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure mime-type matches an image
|
||||
if (!in_array(mime_content_type($_FILES[$fieldname]['tmp_name']), ['image/jpeg','image/jpg','image/png','image/gif'])) {
|
||||
throw new \Exception("Uploaded file not a valid image");
|
||||
}
|
||||
|
||||
// Determine file extension
|
||||
$spl = explode('.', $_FILES[$fieldname]['name']);
|
||||
$file_extension = strtolower(array_pop($spl));
|
||||
unset($spl);
|
||||
|
||||
// Move file
|
||||
if (!move_uploaded_file($_FILES[$fieldname]['tmp_name'], $path.$fielddata['image_name'].'.'.$file_extension)) {
|
||||
throw new \Exception("Unable to save image to img folder");
|
||||
}
|
||||
|
||||
$save_to = 'img/'.$fielddata['image_name'].'.'.$file_extension.'?v='.time();
|
||||
}
|
||||
|
||||
// Delete file?
|
||||
if ($fielddata['value'] !== "" && array_key_exists($fieldname.'_delete', $_POST) && $_POST[$fieldname.'_delete']) {
|
||||
@unlink(\Froxlor\Froxlor::getInstallDir() . '/' . explode('?', $fielddata['value'], 2)[0]);
|
||||
$save_to = '';
|
||||
}
|
||||
|
||||
// Nothing changed
|
||||
if ($save_to === null) {
|
||||
return array(
|
||||
$fielddata['settinggroup'] . '.' . $fielddata['varname'] => $fielddata['value']
|
||||
);
|
||||
}
|
||||
|
||||
if (Settings::Set($fielddata['settinggroup'] . '.' . $fielddata['varname'], $save_to) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return array(
|
||||
$fielddata['settinggroup'] . '.' . $fielddata['varname'] => $save_to
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,20 +59,20 @@ class Crypt
|
||||
}
|
||||
|
||||
/**
|
||||
* Make crypted password from clear text password
|
||||
* Make encrypted password from clear text password
|
||||
*
|
||||
* @author Michal Wojcik <m.wojcik@sonet3.pl>
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
*
|
||||
* 0 - default crypt (depenend on system configuration)
|
||||
* 0 - default crypt (depends on system configuration)
|
||||
* 1 - MD5 $1$
|
||||
* 2 - BLOWFISH $2y$07$
|
||||
* 3 - SHA-256 $5$ (default)
|
||||
* 4 - SHA-512 $6$
|
||||
*
|
||||
* @param string $password
|
||||
* Password to be crypted
|
||||
* Password to be encrypted
|
||||
* @param bool $htpasswd
|
||||
* optional whether to generate a SHA1 password for directory protection
|
||||
*
|
||||
@@ -168,7 +168,7 @@ class Crypt
|
||||
$password = \Froxlor\Validate\Validate::validate($password, '/.*[0-9]+.*/', '/.*[0-9]+.*/', 'notrequiredpasswordcomplexity', array(), $json_response);
|
||||
}
|
||||
if (Settings::Get('panel.password_special_char_required')) {
|
||||
$password = \Froxlor\Validate\Validate::validate($password, '/.*[' . preg_quote(Settings::Get('panel.password_special_char')) . ']+.*/', '/.*[' . preg_quote(Settings::Get('panel.password_special_char')) . ']+.*/', 'notrequiredpasswordcomplexity', array(), $json_response);
|
||||
$password = \Froxlor\Validate\Validate::validate($password, '/.*[' . preg_quote(Settings::Get('panel.password_special_char'), '/') . ']+.*/', '/.*[' . preg_quote(Settings::Get('panel.password_special_char'), '/') . ']+.*/', 'notrequiredpasswordcomplexity', array(), $json_response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ class Mailer extends \PHPMailer\PHPMailer\PHPMailer
|
||||
{
|
||||
|
||||
/**
|
||||
* class construtor
|
||||
* class constructor
|
||||
*
|
||||
* @param string $exceptions
|
||||
* whether to throw exceptions or not
|
||||
@@ -32,6 +32,14 @@ class Mailer extends \PHPMailer\PHPMailer\PHPMailer
|
||||
$this->Port = Settings::Get('system.mail_smtp_port');
|
||||
}
|
||||
|
||||
/**
|
||||
* use froxlor's email-validation
|
||||
*/
|
||||
self::$validator = [
|
||||
'\Froxlor\\Validate\\Validate',
|
||||
'validateEmail'
|
||||
];
|
||||
|
||||
if (self::ValidateAddress(Settings::Get('panel.adminmail')) !== false) {
|
||||
// set return-to address and custom sender-name, see #76
|
||||
$this->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
|
||||
|
||||
@@ -52,6 +52,12 @@ class Data
|
||||
return $newfieldvalue;
|
||||
}
|
||||
|
||||
public static function getFormFieldDataImage($fieldname, $fielddata, $input)
|
||||
{
|
||||
// We always make the system think we have new data to trigger the save function where we actually check everything
|
||||
return time();
|
||||
}
|
||||
|
||||
public static function manipulateFormFieldDataDate($fieldname, $fielddata, $newfieldvalue)
|
||||
{
|
||||
if (isset($fielddata['date_timestamp']) && $fielddata['date_timestamp'] === true) {
|
||||
|
||||
@@ -89,6 +89,15 @@ class Fields
|
||||
return $returnvalue;
|
||||
}
|
||||
|
||||
public static function getFormFieldOutputImage($fieldname, $fielddata, $do_show = true)
|
||||
{
|
||||
global $lng;
|
||||
$label = $fielddata['label'];
|
||||
$value = htmlentities($fielddata['value']);
|
||||
eval("\$returnvalue = \"" . \Froxlor\UI\Template::getTemplate("formfields/image", true) . "\";");
|
||||
return $returnvalue;
|
||||
}
|
||||
|
||||
public static function getFormFieldOutputDate($fieldname, $fielddata, $do_show = true)
|
||||
{
|
||||
if (isset($fielddata['date_timestamp']) && $fielddata['date_timestamp'] === true) {
|
||||
|
||||
@@ -217,7 +217,7 @@ class Form
|
||||
if (! $only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) {
|
||||
$newfieldvalue = self::getFormFieldData($fieldname, $fielddetails, $input);
|
||||
if ($newfieldvalue != $fielddetails['value']) {
|
||||
if (($error = \Froxlor\Validate\Form::validateFormField($fieldname, $fielddetails, $newfieldvalue)) !== true) {
|
||||
if (($error = \Froxlor\Validate\Form::validateFormField($fieldname, $fielddetails, $newfieldvalue)) != true) {
|
||||
\Froxlor\UI\Response::standard_error($error, $fieldname);
|
||||
} else {
|
||||
$changed_fields[$fieldname] = $newfieldvalue;
|
||||
@@ -443,12 +443,12 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
// if ($do_show) {
|
||||
$returnvalue = call_user_func(array(
|
||||
'\\Froxlor\\UI\\Fields',
|
||||
'getFormFieldOutput' . ucfirst($fielddata['type'])
|
||||
), $fieldname, $fielddata, $do_show);
|
||||
// }
|
||||
if ($do_show || (!$do_show && Settings::Get('system.hide_incompatible_settings') == '0')) {
|
||||
$returnvalue = call_user_func(array(
|
||||
'\\Froxlor\\UI\\Fields',
|
||||
'getFormFieldOutput' . ucfirst($fielddata['type'])
|
||||
), $fieldname, $fielddata, $do_show);
|
||||
}
|
||||
}
|
||||
return $returnvalue;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class User
|
||||
}
|
||||
|
||||
/**
|
||||
* Function which updates all counters of used ressources in panel_admins and panel_customers
|
||||
* Function which updates all counters of used resources in panel_admins and panel_customers
|
||||
*
|
||||
* @param bool $returndebuginfo
|
||||
* Set to true to get an array with debug information
|
||||
@@ -237,7 +237,7 @@ class User
|
||||
$admin_domains = Database::pexecute_first($admin_domains_stmt, array(
|
||||
"aid" => $admin['adminid']
|
||||
));
|
||||
// substract the amount of domains that are std-subdomains later when we iterated through all customers and know for sure
|
||||
// subtract the amount of domains that are std-subdomains later when we iterated through all customers and know for sure
|
||||
$admin['domains_used_new'] = $admin_domains['number_domains'];
|
||||
// set current admin
|
||||
$cur_adm = $admin['adminid'];
|
||||
|
||||
@@ -74,7 +74,7 @@ class Check
|
||||
|
||||
public static function checkMysqlAccessHost($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
|
||||
{
|
||||
$mysql_access_host_array = array_map('trim', explode(',', $newfieldvalue));
|
||||
$mysql_access_host_array = array_unique(array_map('trim', explode(',', $newfieldvalue)));
|
||||
|
||||
foreach ($mysql_access_host_array as $host_entry) {
|
||||
if (Validate::validate_ip2($host_entry, true, 'invalidip', true, true, true, true, false) == false && Validate::validateDomain($host_entry) == false && Validate::validateLocalHostname($host_entry) == false && $host_entry != '%') {
|
||||
@@ -207,4 +207,30 @@ class Check
|
||||
}
|
||||
return $returnvalue;
|
||||
}
|
||||
|
||||
public static function checkLocalGroup($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
|
||||
{
|
||||
if (empty($newfieldvalue) || $fielddata == $newfieldvalue) {
|
||||
$returnvalue = [
|
||||
self::FORMFIELDS_PLAUSIBILITY_CHECK_OK
|
||||
];
|
||||
} elseif (function_exists('posix_getgrnam') && posix_getgrnam($newfieldvalue) == false) {
|
||||
if (Validate::validateUsername($newfieldvalue, Settings::Get('panel.unix_names'), 32)) {
|
||||
$returnvalue = [
|
||||
self::FORMFIELDS_PLAUSIBILITY_CHECK_OK
|
||||
];
|
||||
} else {
|
||||
$returnvalue = [
|
||||
self::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
|
||||
'local_group_invalid'
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$returnvalue = [
|
||||
self::FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
|
||||
'local_group_exists'
|
||||
];
|
||||
}
|
||||
return $returnvalue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class Data
|
||||
$newfieldvalue = str_replace("\t", " ", $newfieldvalue);
|
||||
|
||||
if (isset($fielddata['string_type']) && $fielddata['string_type'] == 'mail') {
|
||||
$returnvalue = (filter_var($newfieldvalue, FILTER_VALIDATE_EMAIL) == $newfieldvalue);
|
||||
$returnvalue = \Froxlor\Validate\Validate::validateEmail($newfieldvalue);
|
||||
} elseif (isset($fielddata['string_type']) && $fielddata['string_type'] == 'url') {
|
||||
$returnvalue = \Froxlor\Validate\Validate::validateUrl($newfieldvalue);
|
||||
} elseif (isset($fielddata['string_type']) && $fielddata['string_type'] == 'dir') {
|
||||
@@ -194,7 +194,7 @@ class Data
|
||||
$newfieldvalue = str_replace("\t", " ", $newfieldvalue);
|
||||
|
||||
if (isset($fielddata['string_type']) && $fielddata['string_type'] == 'mail') {
|
||||
$returnvalue = (filter_var($newfieldvalue, FILTER_VALIDATE_EMAIL) == $newfieldvalue);
|
||||
$returnvalue = \Froxlor\Validate\Validate::validateEmail($newfieldvalue);
|
||||
} elseif (isset($fielddata['string_type']) && $fielddata['string_type'] == 'url') {
|
||||
$returnvalue = \Froxlor\Validate\Validate::validateUrl($newfieldvalue);
|
||||
} elseif (isset($fielddata['string_type']) && $fielddata['string_type'] == 'dir') {
|
||||
|
||||
@@ -217,9 +217,9 @@ class Validate
|
||||
public static function validateDomain($domainname, $allow_underscore = false)
|
||||
{
|
||||
if (is_string($domainname)) {
|
||||
$char_validation = '([a-z\d](-*[a-z\d])*)(\.?([a-z\d](-*[a-z\d])*))*\.([a-z\d])+';
|
||||
$char_validation = '([a-z\d](-*[a-z\d])*)(\.?([a-z\d](-*[a-z\d])*))*\.(xn\-\-)?([a-z\d])+';
|
||||
if ($allow_underscore) {
|
||||
$char_validation = '([a-z\d\_](-*[a-z\d\_])*)(\.([a-z\d\_](-*[a-z\d])*))*(\.?([a-z\d](-*[a-z\d])*))+\.([a-z\d])+';
|
||||
$char_validation = '([a-z\d\_](-*[a-z\d\_])*)(\.([a-z\d\_](-*[a-z\d])*))*(\.?([a-z\d](-*[a-z\d])*))+\.(xn\-\-)?([a-z\d])+';
|
||||
}
|
||||
|
||||
// valid chars check && overall length check && length of each label
|
||||
@@ -256,6 +256,10 @@ class Validate
|
||||
public static function validateEmail($email)
|
||||
{
|
||||
$email = strtolower($email);
|
||||
// as of php-7.1
|
||||
if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
|
||||
return filter_var($email, FILTER_VALIDATE_EMAIL, FILTER_FLAG_EMAIL_UNICODE);
|
||||
}
|
||||
return filter_var($email, FILTER_VALIDATE_EMAIL);
|
||||
}
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ exit "$RETVAL"
|
||||
# allow-axfr-ips Allow zonetransfers only to these subnets
|
||||
#
|
||||
allow-axfr-ips=127.0.0.0/8,::1,<NAMESERVERS_IP>
|
||||
# add these entries to the list if any speficied: <AXFRSERVERS>
|
||||
# add these entries to the list if any specified: <AXFRSERVERS>
|
||||
|
||||
#################################
|
||||
# allow-dnsupdate-from A global setting to allow DNS updates from these IP ranges.
|
||||
@@ -917,6 +917,8 @@ gmysql-dbname=pdns
|
||||
gmysql-user=powerdns
|
||||
gmysql-group=client
|
||||
gmysql-password=
|
||||
#gmysql-ssl-ca-file=
|
||||
#gmysql-ssl-verify-server-certificate=0
|
||||
]]>
|
||||
</content>
|
||||
</file>
|
||||
@@ -931,7 +933,7 @@ gmysql-password=
|
||||
# allow-axfr-ips Allow zonetransfers only to these subnets
|
||||
#
|
||||
# allow-axfr-ips=127.0.0.0/8,::1,<NAMESERVERS_IP>
|
||||
# add these entries to the list if any speficied: <AXFRSERVERS>
|
||||
# add these entries to the list if any specified: <AXFRSERVERS>
|
||||
|
||||
#################################
|
||||
# allow-dnsupdate-from A global setting to allow DNS updates from these IP ranges.
|
||||
@@ -2228,7 +2230,7 @@ debugger_command =
|
||||
# >$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
|
||||
# To attach to the screen session, su root and run "screen -r
|
||||
# <id_string>" where <id_string> uniquely matches one of the detached
|
||||
# sessions (from "screen -list").
|
||||
#
|
||||
@@ -2642,7 +2644,7 @@ driver = mysql
|
||||
# settings, like: host=sql1.host.org host=sql2.host.org
|
||||
#
|
||||
# pgsql:
|
||||
# For available options, see the PostgreSQL documention for the
|
||||
# For available options, see the PostgreSQL documentation for the
|
||||
# PQconnectdb function of libpq.
|
||||
# Use maxconns=n (default 5) to change how many connections Dovecot can
|
||||
# create to pgsql.
|
||||
@@ -2745,7 +2747,7 @@ user_query = SELECT CONCAT(homedir, maildir) AS home, CONCAT('maildir:', homedir
|
||||
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('*:storage=', quota, 'M') as userdb_quota_rule FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3') OR ((postfix = 'Y' AND '%Ls' = 'smtp') OR (postfix = 'Y' AND '%Ls' = 'sieve')))
|
||||
|
||||
# Query to get a list of all usernames.
|
||||
#iterate_query = SELECT username AS user FROM users
|
||||
iterate_query = "SELECT username AS user FROM mail_users WHERE (imap = 1 OR pop3 = 1)"
|
||||
]]>
|
||||
</content>
|
||||
</file>
|
||||
@@ -3707,7 +3709,7 @@ protocol sieve {
|
||||
#
|
||||
# If you want UIDL compatibility with other POP3 servers, use:
|
||||
# UW's ipop3d : %08Xv%08Xu
|
||||
# Courier : %f or %v-%u (both might be used simultaneosly)
|
||||
# Courier : %f or %v-%u (both might be used simultaneously)
|
||||
# Cyrus (<= 2.1.3) : %u
|
||||
# Cyrus (>= 2.1.4) : %v.%u
|
||||
# Dovecot v0.99.x : %v.%u
|
||||
@@ -3965,7 +3967,7 @@ Port 21
|
||||
# PassivePorts 49152 65534
|
||||
|
||||
# If your host was NATted, this option is useful in order to
|
||||
# allow passive tranfers to work. You have to use your public
|
||||
# allow passive transfers to work. You have to use your public
|
||||
# address and opening the passive ports used on your firewall as well.
|
||||
# MasqueradeAddress 1.2.3.4
|
||||
|
||||
@@ -3990,7 +3992,7 @@ Group nogroup
|
||||
# Umask 022 is a good standard umask to prevent new files and dirs
|
||||
# (second parm) from being group and world writable.
|
||||
Umask 022 022
|
||||
# Normally, we want files to be overwriteable.
|
||||
# Normally, we want files to be overwritable.
|
||||
AllowOverwrite on
|
||||
|
||||
# Uncomment this if you are using NIS or LDAP via NSS to retrieve passwords:
|
||||
@@ -4237,7 +4239,7 @@ SQLBackend mysql
|
||||
SQLEngine on
|
||||
SQLAuthenticate on
|
||||
#
|
||||
# Use both a crypted or plaintext password
|
||||
# Use both an encrypted or plaintext password
|
||||
SQLAuthTypes Crypt
|
||||
|
||||
SQLAuthenticate users* groups*
|
||||
@@ -4295,7 +4297,7 @@ TLSVerifyClient off
|
||||
#TLSRequired on
|
||||
|
||||
# Allow SSL/TLS renegotiations when the client requests them, but
|
||||
# do not force the renegotations. Some clients do not support
|
||||
# do not force the renegotiations. Some clients do not support
|
||||
# SSL/TLS renegotiations; when mod_tls forces a renegotiation, these
|
||||
# clients will close the data connection, or there will be a timeout
|
||||
# on an idle data connection.
|
||||
@@ -4595,7 +4597,7 @@ aliases: files
|
||||
chmod="0644">
|
||||
<content><![CDATA[
|
||||
#
|
||||
# Froxlor logrotate snipet
|
||||
# Froxlor logrotate snippet
|
||||
#
|
||||
<CUSTOMER_LOGS>*.log {
|
||||
missingok
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user