Send mail with Debian 9 Stretch and PHP 7
apt-get install sendmail sendmailconfig
nano /etc/mail/sendmail.mc
define(`SMART_HOST', `relay.mydomain.com')dnl
cd /etc/mail make
apt-get install sendmail sendmailconfig
nano /etc/mail/sendmail.mc
define(`SMART_HOST', `relay.mydomain.com')dnl
cd /etc/mail make
$myfile=@file_get_contents(“http://myserver/myfile.xml”);
$xml=simplexml_load_string($myfile) or die(“Error: Cannot create object”);
$xml->{“node1”}->{“node2”}[1]->{‘variablename’}[0]
This Powershell script executed with the correct rights:
Invoke-Command -ComputerName-ScriptBlock{Get-Service -Name MapsBroker | Set-Service -StartupType Disabled}
Script must be into the Alert Script folder path. Default value is:
/etc/zabbix/alert.d
Let’s create our test.php file with execution permissions:
chmod a+x test.php
File must start with these lines:
#!/usr/bin/php
In Zabbix web interface make sure you set these values:
Get-ADUser -Filter * -SearchBase "DC=domain,DC=local" -Properties whenCreated | export-csv -Path c:\path\to\file.csv
https://www.tecmint.com/extend-and-reduce-lvms-in-linux/
File must start with declaration code and PHP start tag:
#!/usr/bin/php <?php
File must end with PHP end tag:
?>
In the middle you can put all PHP code you want and remember that parameters are passed via the variable:
$argv[]
insert
allow_writeable_chroot=YES
into:
/etc/vsftpd/vsftpd.conf
This is a secure solution for having a web server for many sites. With this you can specify which server user will be used for which site so apache will execute the code (mainly php) with that user preventing file system access to bad code.
On a fresh Debian 9 installation (with just SSH Server installed) let’s do:
apt-get install libapache2-mpm-itk libapache2-mod-php7.0
We’ll now enable that modules that could be useful and the one necessary:
a2enmod mpm_itk a2enmod rewrite
Now let’s configure a virtualhost:
cd /etc/apache2/sites-available touch my_website.conf nano my_website.conf
and put this inside the file (obviously you can change settings as you need):
<VirtualHost *:80>
ServerName my_website
ServerAdmin paolo@my_website
DocumentRoot /home/www/my_website/home/
<IfModule mpm_itk_module>
AssignUserId my_username my_usergroup
</IfModule>
<Directory /home/www/my_website/home/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Let’s activate my_website:
a2ensite my_website
At this point we need to create the user and the group we indicate into the file:
useradd -d /home/www/my_website -s /usr/sbin/nologin my_username
and the folders onto the path:
mkdir /home/www mkdir /home/www/my_website mkdir /home/www/my_website/home cd /home/www/my_website chown -R my_username:my_username home/
At this point we have a virtualhost that points to a folder path where apache will run scripts as my_username user.
Therefore it’s possibile to configure mysql o any other service to make this webserver richer of functions.