rss
Affichage des articles dont le libellé est fiche. Afficher tous les articles
Affichage des articles dont le libellé est fiche. Afficher tous les articles

Microsoft Windows: minimal howto

This post is a kind of minimal 'how to' for Micro$oft Windows.

Windows : basic command (to execute from [WINDOWS + R])

cmd             : classic console
powershell      : power shell command console
msinfo32        : host info
devmgmt.msc     : devices management (fr: Gestionnaire de périphériques)
certmgr.msc     : certificates managers
services.msc    : windows OS services
javaws -viewer  : windows java services
eventvwr.exe    : Event viewer
shell:Startup   : show startup programs (if any)
procmon.exe     : (download) show process actiity (really useful)
compmgmt.msc    : Computer Management
NB: for ssl cf ssl howto

god mode (Windows 10)

  • create a folder on windows 10 desktop and name it 
GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

network related commands

  • list all LISTENING ports
netstat -ano
netstat -ano | find "LIST"
  • find an application from portsrc
netstat -ano | find "LIST"
==> Pick the wanted process id from the last column. Example pid "8112"
tasklist  | find "8112"
tasklist /svc | find "8112"
  • DNS lookup
nslookup www.google.fr
nslookup
server 8.8.8.8
www.google.fr

other usefull common tools

  • FileZilla (secure FTP)
  • Notepad++ (light editor)
  • Cygwin (unix like shell)
  • Process Hacker 2 (improved task list manager)

ssl certificates and truststore: minimal howto

This post is a kind of minimal 'how to' for SSL, certificates and truststore :


Tomcat HTTPS application : how to use a valid and trusted self-signed certificate for localhost

Context

As WebDevelopper, I use Tomcat and I need to work with localhost with a secure web application. The issue with the latest browser update (ex. ggchrome) is that an invalid or untrusted self signed certificate could block the navigation or AJAX exchanges.
For example, you could get the folloowing error :

NET::ERR_CERT_AUTHORITY_INVALID
:: certificate validation chain is not trusted
ERR_INSECURE_RESPONSE
:: unable to trust a server answer

to workaround this issue, you could follow these steps:
  • generate a self-signed certificate for localhost
  • tell to tomcat to use this certificate
  • append this certificate to your workstation certificates manager

Generate a self signed certificate

$ keytool -genkey -keyalg RSA -alias tomcat \
  -keystore $HOME/.keystore -storepass changeit -validity 360 -keysize 2048
Warning: answer "localhost" to the first question

more documentation: tomcat8 ssl howto - sslshopper create self signed cert

Tomcat ssl configuration

Connector's attributes example from server.xml:
SSLEnabled="true" clientAuth="false" keystoreFile="${user.home}/.keystore" keystorePass="changeit" maxThreads="150" port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" secure="true" sslProtocol="TLS"

Append this certificate to your workstation certificates manager

  • navigate to your tomcat application ; example : https://localhost:8443
  • (example using google chrome), right click on address bar lock / click on "certificate informations (...)" link / "details" tab
  • Choose "copy certificate into file" - keep default format X509 DER.
  • right click on the just created file to "Install certificate"
  • Select the following target : "Trusted root certification authorities"("Autorités de certification racines de confiance")
  • You could verify the certificate installation : Windows Start / Execute / certmgr.msc ; this will open Windows certificates manager
  • Restart your browser (use CTRL + ALT + Q for Google Chrome instead of closing the window).
  • navigate to your tomcat application ; example : https://localhost:8443 : your certificate should be trusted now

SSL Client : "PKIX path building failed" error

Java error

javax.net.ssl.SSLHandshakeException: 
sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Java workarounds

  • (bad and quick way) Disable all ssl check by configuration cf. UnsafeSSLHelper (from javabox github project)
  • (right way) Update the ssl verification chain. For example by importing new valid certificate(s) to your truststore.

Windows

  • Windows / List certificates:

    Start / Execute / certmgr.msc
  • Google Chrome / List certificates:

    go to Parameters, the search "ssl" (chrome://settings/search#ssl)


  • Import a certificate in a truststore file:

    Make a backup :
    cp %JAVA_HOME%/jre/lib/security/cacerts %JAVA_HOME%/jre/lib/security/cacerts.orig 
    
    Import a certificate :
    keytool -import -alias MyCert -keystore %JAVA_HOME%/jre/lib/security/cacerts \
         -trustcacerts -file MyCert.cer
    
    (cf. commandes+keytool ...)
  • Implort a certificate in JDK truststore:
    create a little batch like this one :
    set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
    set PATH=%JAVA_HOME%\bin;%PATH%
    REM set JRE_CACERTS=%JAVA_HOME%\lib\security\cacerts
    set JDK_CACERTS=%JAVA_HOME%\jre\lib\security\cacerts
    set PASSWORD=changeit
    set DIR=certsdir
    
    for %%f in (%DIR%\*.cer) do keytool -keystore "%JRE_CACERTS%" -storepass %PASSWORD% -noprompt -importcert -alias "%%~nf" -file %%f
    for %%f in (%DIR%\*.cer) do keytool -keystore "%JDK_CACERTS%" -storepass %PASSWORD% -noprompt -importcert -alias "%%~nf" -file %%f
    

    This script install all certificates under certsdir to the JDK (or JRE).

shared libraries "lib.so and lib.dll" file: minimal how to

This post is a kind of minimal 'how to' for the shared libraries : ex. under linux mylib.so or under windows my.dll

Windows





Linux

  • List library exported symbols (then functions)
readelf -s /usr/lib/libspreadsheet.so |grep workbook_sheet
nm -D /usr/lib/libspreadsheet.so |grep workbook_sheet
objdump -T /usr/lib/libspreadsheet.so |grep workbook_sheet



  • List library dependencies

readelf -d /usr/lib/libspreadsheet.so|grep NEEDED

prosyst OSGi: minimal how to

This post is a kind of minimal 'how to' for Prosyst OSGi.

console (or telnet) commands

  • (telnet only) toggle command to get stdout / stderr on the telnet output
dump
  • Bundle installation
install mybundle.jar
  • Bundle start
start mybundle.jar
  • Bundle installation and start alias
i -S mybundle.jar
  • Bundle restart alias
rs mybundle.jar
rs 42
  • Bundle update := uninstall, install, start
update mybundle.jar
update 42
  • whole prosyst OSGi framework restart (you will loose the telnet connection)
rs 0


npm et bower: fiche pratique

Cet article est une fiche pratique (commandes de base) pour npm et Bower package managers.
  • Commandes utiles pour configurer NPM:
npm config set proxy http://proxy:8080
npm config set https-proxy http://proxy:8080
npm config set strict-ssl false
  • Installation
npm install -g bower
  • Bower derrière un proxy : utiliser les variables d'environnement http_proxy et https_proxy ou le fichier .bowerrc
  • Installation d'une dépendance
bower install jquery
  • Mise à jour d'une dépendance
bower update jquery
  • Info et version d'une dépendance
bower info jquery
bower search angular%bootstrap%
  • Bower repose sur un fichier de configuration bower.json dont voici un exemple:
{
  "name": "myproject-webgui",
  "version": "0.0.0",
  "dependencies": {
    "angular": "1.3.1",
    "json3": "~3.2.6",
    "es5-shim": "~2.1.0",
    "jquery": "~1.11.0",
    "bootstrap": "~3.0.3",
    "angular-resource": "1.3.1",
    "angular-cookies": "1.3.1",
    "angular-sanitize": "1.3.1",
    "angular-route": "1.3.1",
    "ng-table": "0.3.3"
  },
  "devDependencies": {
    "angular-mocks": "1.3.1",
    "angular-scenario": "1.3.1"
  }
}

git : fiche pratique

Cet article est une fiche pratique (commandes de base) pour Git.
  • Client Windows : perso j'utilise Msysgit. Il y en a plein évidemment...
  • Git derrière un proxy ? 2 solutions :
 export http_proxy=http://user:pass@host:port
 git config --global http.proxy http://user:pass@host:port
  • Un problème de certificats SSL ?
 git config --global http.sslVerify false
  • Visualiser l'historique d'un dépôt (avec msysgit)
 gitk --all &
  • récupérer un dépôt distant
 git clone https://domain.com/repo.git
  • connaître l'état du dépot
 git status
  • indexer l'ensemble des modifications : supprimer les fichiers, ajouter les fichiers manquants ou modifiés
 git add --all .
  • annuler des modifications locales non commitées
 git reset --hard
  • résoudre un conflit (lors d'un merge ou cherry-pick..)
 git mergetool
  • creer un tag
 git tag -a monTag -m 'monTag Il est beau'
 git push --tags 
  • déplacer un tag sur la version actuelle
 git tag -f -a monTag 
 git push origin :refs/tags/monTag 
 git push --tags 
  • positionner des alias de commandes git : dans le fichier de config global (~/.gitconfig)
 [alias]
        #Basic
        co = checkout
        st = status -s
        ci = commit
        br = branch
        df = diff
        cp = cherry-pick
        cl = clone
        diff = diff --word-diff
        dc = diff --cached
        who = shortlog -s --
        r  = !git ls-files -z --deleted | xargs -0 git rm
        #revert last commit
        rollback = reset --soft HEAD~1
        #Commit using previous message
        reapply = commit -c ORIG_HEAD
        #Logs
        lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %an - %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
        #Les logs du user
        mylg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %an - %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative --author="Vincent\\ Bostoen"
        ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
        lol = log --graph --decorate --pretty=oneline --abbrev-commit
        lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
        #Lister les commits pas encore pushés
        ctp = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %an - %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative origin/master..master
        #Mettre un fichier en argument pour avoir ses modifications
        fl = log -u
        #Avoir le contenu du dernier commit
        dl = "!git ll -1"
        #Avoir le diff avec un commit
        diffr = "!f() { git diff "$1"^.."$1"; }; f"
        #Lister tous les chemins pour un nom de fichier
        f = "!git ls-files | grep -i"
        #Chercher tous les fichiers contenant une chaine de caractère
        gr = grep -Ii
        #Lister les alias
        la = "!git config -l | grep alias | cut -c 7-"
        #Remove all locally deleted file (git rm on all 'D' files)
        rma = "!git diff -z --name-only --diff-filter=D | xargs -0 git rm"
        #Stash
        sl = stash list
        sa = stash apply
        ss = stash save
        amend = !git log -n 1 --pretty=tformat:%s%n%n%b | git commit -F - --amend
        ignore=!([ ! -e .gitignore ] && touch .gitignore) | echo $1 >>.gitignore
        up = !sh -c 'git pull --rebase --prune && git log --pretty=format:\"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)\" HEAD@{1}..'
        bt = for-each-ref --format='%(refname:short) <- heads="" pre="" refs="" upstream:short="">

gradle: fiche pratique

Cet article est une fiche pratique pour Gradle.

Depuis Windows

  • Derrière un proxy : éditer gradlew.bat et modifier la ligne suivante pour positionner votre proxy
set DEFAULT_JVM_OPTS=-Dhttp.proxyHost=myproxy.com -Dhttp.proxyPort=8080
  • liste des tâches
./gradlew.bat tasks
  • build
./gradlew.bat build
  • build sans test (traduire: exécuter la tâche 'build' sans exécuter la tâche 'test')
./gradlew.bat build -x test
  • build sans test ni javadoc
./gradlew.bat build -x test -x javadoc

heroku : fiche pratique

Cet article est une fiche pratique pour Heroku.

Depuis Windows

  • Pour les commandes herokudownload, je conseille d'installer et d'utiliser une console msysgit

Connexion

  • Positionner un proxy (windows) 
set http_proxy=http://myproxy:8080
set https_proxy=http://myproxy:8080
  • Positionner un proxy (nux) 
export http_proxy=http://myproxy:8080
export https_proxy=http://myproxy:8080
  • Pour utiliser une clé SSH : démarrer ssh-agent.exe puis utiliser ssh-add.exe
  • Pour se connecter doc
heroku login

gem : fiche pratique

Cet article est une fiche pratique pour gem (alias RubyGems).

Commandes de base

  • Afficher l'environnement 
gem environment

  • Lister les gem installés 
gem list
gem q --L
gem query --local

  • installer le gem "json en version 1.4.6
gem install json -v '1.4.6'

  • Désinstaller le gem json
gem uninstall json

  • Lister les gems disponibles
gem list --remote

  • Rechercher un gem comportant "sdk"
gem search "*sdk" --remote


  • Ressources utiles : ruby-toolbox.com : recherche de gem et stats consolidées sur les gems (à partir des dépôts public et github)

  • Créer une gem : un squelette avec un ensemble de fichier par defaut
 gem install bundle
 bundle gem mongemmaison
 cat  mongemmaison/mongemmaison.gemspec
 cat  mongemmaison/bin/mongemmaison.rb

find : fiche pratique

Cet article est une fiche pratique pour find.

Commandes de base

  • Lister les fichiers comportant la chaîne "Tutu" 
find . -type f -exec grep -l Tutu {} \;
  • Lister les fichiers modifiés dans les 15 dernières minutes
find . -type f -mmin -15
  • Lister les fichiers modifiés il y a moins de 1 jour (dans les dernières 24heures)
find . -mtime -1
  • Lister à partir de /usr les dossiers comportant 'maven' sans remonter les erreurs liées aux permissions refusées
find /usr -type d -name maven 2>&1 | grep -v 'Permission non accordée'

Yum : fiche pratique

Cet article est une fiche pratique pour Yum (alias Yellow dog Updater Modified), le gestionnaire de paquets de Fedora et Red Hat.

Commandes de base

  • Lister les paquets installés
yum list installed | more
  • Lister les paquets disponibles
yum list
yum list kernel\*
  • Rechercher un paquet (ie. svn)
yum search svn
  • Installer un paquet (ie. svn)
yum install subversion
  • connaître les repositories déclarés / actifs
yum repolist all

Commandes avancées

  • Connaître le contenu d'un paquet (ie. subversion) [ src ]
 rpm -qil subversion
ou 
 yum install yum-utils
 repoquery -lq subversion| more

Mots clés du blog

10.1 4G acceptancetest adb androï Android androïd Android7 api appender appengine application applications archive array assistantematernelle astuce auth0 authentication authority automation Axis bash bearer blog boot bootloader bower build bundle c calendrier camille combal cdi certificate cf client cloudfoundry collaboratif command commandes connexion console css cyanogen decrypt démasquées démasquer développement dll dump easter eggs écologie écrit employeur EMUI EMUI5.0 encrypt enfant évènement export-package ExtJS fab fastboot fiche find firefox gadget galaxytab gelf gem git gmail gnupg gooelappengine google gparted gpg gpg2 gps graylog grenoble Grid gui harddrive heroku hover howto HTML http https IE ihm immobilier imprimante innovation insolite instance integration Java JavaScript jenkins jeu jobs json json-schema-validator key keystore labs linux livre log log4j logger logs lombok masquées masquer maven maven-gae-plugin Mémoire microsoft mobile mockito mondialisation monitor MUSE musique en ligne myopera nodejs npm NT NTEventLogger onglet openstack osgi paas package parameters parent php politique prosyst prototype proxies proxy quartz radio rappel recherche regex repository resize RIA ridge rock ROM route ruby rubygems s8500 samsung scheduler scm secret secure sel selenium Serializer server shared shell sign signature slf4j smartphone so société song spy ssh ssl struct swagger swig tâches téléphone téléréalité test thunderbird timeout token Tomcat tooltip tooltips truststore TWRP ubuntu unit test validator verify virgin virtualbox wave waze web WebApp wiki wikimedia wikipédia wikipen wiko windows windows10 yahoo youtube yum