Stateless auth for rest api
Query Authentication
All REST queries must be authenticated by signing the query parameters sorted in lower-case, alphabetical order using the private credential as the signing token. Signing should occur before URL encoding the query string.
In other words, you don't pass the shared secret component of the API key as part of the query, but instead use it to sign the query. Your queries end up looking like this:
GET /object?timestamp=1261496500&apiKey=Qwerty2010&signature=abcdef0123456789
The string being signed is "/object?apikey=Qwerty2010×tamp=1261496500" and the signature is the HMAC-SHA256 hash of that string using the private component of the API key.
The main objection to this approach is that the private API key devolves into a kind of password for static calls. For example, if the query were instead:
GET /object?apiKey=Qwerty2010
The signature would be the same every time you made that specific query. However, you are using SSL, right? Furthermore, adding in a timestamp makes each query differ. For extra security, you can make the timestamp a more formal date-time value with time zone information and disallow queries outside of the query range.
The real controversy is whether signing should occur before or after URL encoding values. There is no "right" answer. I lean towards signing before encoding because most programming tools make it easier on the server side to get the unencoded values versus the encoded values. I'm sure good arguments can be made the other way. What I really care about is this: let's pick one and stick with it.
Je ne connaissais pas du tout ce projet qui est bien interessant..
Surtout le module bank qui a l'air très actif
Je garde ça sous le coude, ça pourrait m'être utile dans mon application de gestion de compte
interesting to run selenium
Contexte :
Derniere version de rpaf et apache 2.4 (jessie)
La variable %h qui est utilisée dans les LogFormat de base n'est pas substituée par rpaf... il faut la remplacer par %a qui elle, est bien modifiée par rpaf
La commande eb d'amazon retourne toujours 0 même quand elle foire.. pas pratique pour repérer une erreur dans les script de CI..
Mes scripts bash commencent tous avec "set -e" pour sortir en erreur des qu'il y a un probleme
La commande eb me pose donc problème, j'ai fixé ça de cette mainère en attendant de trouver mieux :
eb blablabla 2>&1 | ( ! grep ERROR)
De cette manière, si dans le stdout ou dans le stderr on trouve 'ERROR', le grep va matcher et renvoyer 1 (dans une utilisation normale, grep retourne 0 si il match, mais avec le point d'exclamation, on inverse ce retour)
Ce qui aura pour effet de passer mon script en erreur !
TIL :
What is this date format? 2011-08-12T20:17:46.384
The T is just a literal to separate the date from the time, and the Z means "zero hour offset" also known as "Zulu time" (UTC). If your strings always have a "Z" you can use
echo -n "Today : "
curl -s "http://api.fixer.io/latest?symbols=EUR,CHF&base=CHF" | jq '.rates|.EUR'
for i in {1..10}; do
dc=$(date --date="$i day ago" +%Y-%m-%d)
echo -n "$dc : "
curl -s "http://api.fixer.io/${dc}?symbols=EUR,CHF&base=CHF" | jq '.rates|.EUR'
done
echo "http://www.xe.com/currencycharts/?from=CHF&to=EUR&view=1M"
To run this inside a container, you have to docker run --privileged
You can run this on host, then map /dev/random from host inside container
/!\ In test environment ONLY :
Don't install anything, just map /dev/urandom from host into /dev/random container
docker run -v /dev/urandom:/dev/random
Test entropy : (rng-tools)
cat /dev/random | rngtest -c 1000
What will happen if I use git pull --rebase ?
git pull --rebase is roughly equivalent to
git fetch
git rebase origin/master
i.e. your remote changes (C) will be applied before the local changes (D), resulting in the following tree
A -- B -- C -- D
What will happen if I use git pull --ff-only ?
It will fail.
git pull --ff-only corresponds to
git fetch
git merge --ff-only origin/master
--ff-only applies the remote changes only if they can be fast-forwarded. From the man:
Refuse to merge and exit with a non-zero status unless the current HEAD is already up-to-date or the merge can be resolved as a fast-forward
Since your local and remote branches have diverged, they cannot be resolved by a fast-forward and git pull --ff-only would fail.
{
"Id": "S3PolicyId1",
"Statement": [
{
"Sid": "IPDeny",
"Effect": "Deny",
"Principal": {
"AWS": ""
},
"Action": "s3:",
"Resource": "arn:aws:s3:::my-wicked-awesome-bucket/*",
"Condition": {
"NotIpAddress": {
"aws:SourceIp": "72.309.38.2/32"
}
}
}
]
}
Use ` instead of ' in the database name, and escape the _
GRANT ALL PRIVILEGES ON xian\_%.* TO xian@'192.168.1.%';
Une policy IAM est constituée de statement, ce sont des règles (des blocs de codes)
{
"Statement":[{
"Effect":"effect",
"Action":"action",
"Resource":"arn",
"Condition":{
"condition":{
"key":"value"
}
}
}
]
}
Chaque règle dans sa forme la plus simple est composée de 3 choses :
Effect : allow ou deny
Action : quelle action concerne la règle
Resource : la resource concernée
Chaque service Amazon (EC2, ECR, etc...) expose une liste d'action, on peut trouver cette liste dans la doc (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#Action)
Et chaque resource peut être identifiée par un arn (une manière simple de retrouver un ARN est d'afficher la resources dans l'interface web AWS, il y a souvent l'arn)
J'avais eu les RFC sur ce sujet à commenter pendant le Master, souvenir ahah
I've edited my .vimrc to add fugitive plugin and commited it by using fugitive
On peut avoir besoin de faire tourner un ou plusieurs cron dans un environnement Beanstalk composé de X instances
Etant donné que toute les instances sont configurées de la meme manière, si on rajoute le cron dans la config, il sera éxecuté sur toutes les instances
Une solution serait de determiner si on est le "runnner" ou non avant de lancer le cron
Pour que toutes les instances sachent qui est le runner, on peut imaginer un système comme celui ci :
- on interroge l'ELB avec les API pour avoir ses backends
- on trie cette liste de backend
- le runner est le premier de cette liste
- si notre ip est égale à celle du runner, on lance le cron
ça a l'avantage de fonctionner quel que soit le nombre d'instances et ne pas stocker un état (on utilise les infos de l'ELB)
Et si on ne veut pas faire tourner tous les crons sur le runner, on pourrait déterminer runnner1 runnner2 runner3 etc suivant l'ordre et faire tourner certains crons si on est runner1 ou bien runner2
Souvent mes journées au taf ressemblent à ça : je veux changer une ampoule, je finis sous la voiture
Une méthode pour ne pas rsync des fichiers qui ont été déplacés dans la source
Et en commentaire une extension à la solution qui m'a l'air pas mal du tout
I use a derivative of this method, by creating a separate hard-links directory with md5-filenames. This gets rid of any duplicate files as well. Any files in this hard links directory with link count 1 are removed. Any files in the albums tree without the same inode to be found in the hard links tree are hard-linked into the hard links tree by using an MD5 of the file. Before I rsync I update the hard links dir, so when my wife decides to make a beautiful photobook and copies and moves lots of photos around, my ADSL doesn't get swamped when backing up my local photo store.
The same script also generates JPG files from Nikon image files (NEF).
This works both on FreeBSD/Linux/UNIX/etc as well as NTFS. Which is nice.
Bientôt 3 mois que j'ai commencé avec AWS
En vert ce avec quoi j'ai pu bien jouer
En orange survolé
Et tout le reste
Ce qui me plait le plus : tout est automatisable soit avec des appels à l'api (SDK dans beaucoup de langage) donc en mode séquentiel, soit avec CloudFormation, une sorte de Configuration Management donc en mode declaratif
rdv dans 3 mois ;)
online resources to prepare aws certifications
wow une cli pour editer les dashboards grafana.. ça peut servir par exemple pour dupliquer des variables de template d'un dashboard à X autres