Send mails with php mail() and ssmpt

apt-get install ssmtp

vim /etc/ssmtp/ssmtp.conf

root=test@test.exor
mailhub=mail00.domain:25
hostname=test.tld
UseSTARTTLS=YES
AuthUser=USER
AuthPass=PASS
FromLineOverride=YES

grep -n sendmail_path /etc/php/7.0/cli/php.ini

sendmail_path = /usr/sbin/ssmtp -t
<?php
$empfaenger = "rcpt@example.com";
$betreff = "Die Mail-Funktion";
$from = "From: Sender <sender@seo.exor>";
$text = "Data";

mail($empfaenger, $betreff, $text, $from);
?>

Ansible – deploy ssh key

- name: deploy ssh key
  hosts: server
  remote_user: root
  gather_facts: no
  tasks:
  - name: deploy my key
    authorized_key: user=root key="{{ lookup('file', '~/.ssh/id_rsa.pub') }}"

Mac OS-X – install apache2 php56

install xcode

Einstellungen -> AppStore -> Suche -> XCode
xcode-select --install
brew update; brew doctor
brew install -v git
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
brew tap homebrew/dupes
brew tap homebrew/apache
brew -v install homebrew/apache/httpd24 --with-brewed-openssl
brew -v install homebrew/php/php56 --with-apache

vim $(brew –prefix)/etc/apache2/2.4/httpd.conf

<IfModule php5_module>
  <IfModule dir_module>
    DirectoryIndex index.php index.html
  </IfModule>

  <FilesMatch "\.php$">
    SetHandler application/x-httpd-php
  </FilesMatch>
  <FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
  </FilesMatch>
</IfModule>

vim $(brew –prefix)/etc/apache2/2.4/httpd.conf

Listen 80
LoadModule php5_module "/usr/local/php5/libphp5.so" 
sudo brew -v services start homebrew/apache/httpd24
sudo brew -v services stop homebrew/apache/httpd24
sudo cp /System/Library/LaunchDaemons/org.apache.httpd.plist /Library/LaunchDaemons/my.apache.httpd.plist

vim /Library/LaunchDaemons/my.apache.httpd.plist

   <?xml version="1.0" encoding="UTF-8"?>
   <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
   <plist version="1.0">
   <dict>
     <key>Label</key>
     <string>httpd24</string>
     <key>ProgramArguments</key>
     <array>
       <string>/usr/local/opt/httpd24/bin/httpd</string>
       <string>-D</string>
       <string>FOREGROUND</string>
     </array>
     <key>RunAtLoad</key>
     <true/>
   </dict>
   </plist>
sudo launchctl load -w /Library/LaunchDaemons/my.apache.httpd.plist
apachectl start http24

Links:

  • mac-os-x-apache-setup
  • installing-php56-mac-osx/a>
  • Local_Web_Server_on_Mac_OS_X
  • apache-php-and-mysql-homebrew
  • http://php.net: install.unix.apache2
  • wp-cli – wordpress install

    wp core download
    
    wp core config --dbname=wpdb --dbuser=wpdb --dbpass=geheim
    
    chmod 644 wp-config.php
    
    wp core install --url=mywebsite.com --title="My Site" --admin_name=wpadmin --admin_password='4Long&Strong1' --admin_email=admin@mysite.de
    
    chmod 777 uploads
    

    Check user passwords

    LOGINUSERS="$(cut -d: -f 1 /etc/passwd)"; for u in $LOGINUSERS; do passwd -S $u | awk '/P|L|NP/ {print $2,$1}'; done | sort
    
    cat /etc/shadow
    

    compare two files (diff)

    Lines only in list 01

    comm -23 01.list 02.list
    

    Lines only in list 02

    comm -13 01.list 02.list
    

    Lines in list 01 and list 02

    comm -12 01.list 02.list
    

    curl – htpasswd login

    curl -u "user:pass" example.com
    

    WordPress – wp-cli: change site name

    wp search-replace 'www.stage.example.dev' 'www.example.com' --dry-run
    
    wp option update home 'http://example.com'
    wp option update siteurl 'http://example.com'
    

    SSL/TLS – check certificate chain

    openssl verify -verbose -CAfile <(cat intermediate.crt rootca.crt) site.crt
    

    Bash – random integer

    jot -r 3 1 20
    
    Return top