Skip to content

Instantly share code, notes, and snippets.

@yangou
yangou / Requirements
Last active November 1, 2018 21:06
Enterprise API Authentication Design
### Browser based
1. Always use https
2. Account has multiple users and groups.
3. Groups are used to management permission over various resources.
4. Login with username and password, and a access token is granted to client.
5. Access token is valid with a reasonable amount of time, e.g. 24hrs.
6. Access token is carried over cross multiple browser sessions.
7. Have a way to revoke the granted token.
8. Avoid Cross Origin API's
@yangou
yangou / gist:267efea631d9016b4b75
Last active August 29, 2015 14:16
iptables for prod machines
#! /bin/bash
iptables -F
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
iptables -A INPUT -i eth1 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
@yangou
yangou / es.sh
Last active August 29, 2015 14:13 — forked from rajraj/es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share