#user nobody; | |
worker_processes 4; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; |
time-format %T | |
date-format %d/%b/%Y | |
log_format "%d:%t +%^" client=%h method=%m request="%r" request_length=%^ status=%s bytes_sent=%b body_bytes_sent=%^ referer=%R user_agent="%^" upstream_addr=%^ upstream_status=%^ request_time=%T upstream_response_time=%^ upstream_connect_time=%^ upstream_header_time=%^ |
import requests | |
LOGIN_URL = "http://mydjangosite.com/accounts/login/" | |
ENDPOINT_URL = 'http://mydjangosite.com/myendpoint/' | |
''' | |
Create a session. | |
A session will automatically store the cookies that Django | |
sends back to you, like the csrf token and a the session id. You | |
could do it without the session, but then you'd have to save off the |
<?php | |
namespace C3\Utility; | |
use Monolog\Logger; | |
/** | |
* Class DuplicateDatabase | |
* | |
* @package C3\Utility |
In case you want to run ansible
(or ansible-playbook
) command against a set of hosts that makes sense only for one run,
you can don't bother to create one-time inventory file, but simply define a comma-separated list of hosts as argument of --invertory
option (or its short form that's simply -i
) as follows:
ansible --inventory=myhost1,myhost2,myhost3 all -m setup -a 'filter=*name*'
(note that all
in this command line stands for the target hostname)
If you have only one host to run your playbook against, your inventory string must ends with ,
version: "2" | |
services: | |
postgres: | |
image: postgres:9.4 | |
container_name: kong-database | |
ports: | |
- "5432:5432" | |
environment: | |
- POSTGRES_USER=kong |
n98-magerun.phar config:dump | xmlstarlet sel -t -m '/config/global/events/*/observers/*' -v ./class -o ' ' -v ./method -o ' ' -v ./type -n |
If you're not familiar: What is fail2ban? fail2ban is an awesome linux service/monitor that scans log files (e.g. auth.log for SSH) for potentially malicious behavior. Once fail2ban is tripped it will ban users for a specified duration by adding rules to Iptables. If you're unfamiliar with fail2ban Chris Fidao has a wonderful (& free!) series about security including setting up fail2ban here.
Recently Laravel released a new feature in 5.1 to throttle authentication attempts by simply adding a trait to your authentication controller. The Laravel throttle trait uses the inputted username, and IP address to throttle attempts. I love seeing this added to a framework out of the box, but what about some of our other apps not built on Laravel? Like a WordPress login? Or even an open API etc.? Ultimately,