diff --git a/README.md b/README.md index 3d6ab4f9d54a0ef5392d41dd18090f33d74c8972..b02046d6d1a1490f865238d04208ebeb094b86b3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Tags: DevOps, Debug, tools, linux, ops, deploy, interface, testing [TOC] # TLDR; Install all this interfaces debug tools -``` +```shell dnf install -y net-tools \ bind-utils \ openldap-clients \ @@ -52,14 +52,14 @@ telnet my.hostname.tld 443 # example ## (s)FTP parameters -``` +```shell FTP_USER=remote_username FTP_HOST=hostname ``` ## sFTP Testing -``` +```shell sftp $FTP_USER@$FTP_HOST ``` @@ -69,7 +69,7 @@ sftp $FTP_USER@$FTP_HOST ## HTTP(s) Parameter -``` +```shell HTTP_PROTOCOL=http # default http; https if secured. HTTP_HOST=www.mydomain.com # ex: www.domain.tld HTTP_PORT=80 # default 80 not secure; 443 @@ -79,7 +79,7 @@ HTTP_ROOT_URL=$HTTP_PROTOCOL://$HTTP_HOST:$HTTP_PORT ## HTTP Testing with Curl -``` +```shell # dnf install -y curl # yum install -y curl # apt install -y curl curl -v $HTTP_ROOT_URL @@ -108,7 +108,7 @@ curl -kv https://httpbin.org/get # example DNS variables are : -``` +```shell DNS_DOMAIN=mydomain.com # ex: mydomain.com HOST=sub.mydomain.com # ex: mydomain.com or subdomain.mydomain.tld (=FQDN) @@ -118,7 +118,7 @@ HOST=sub.mydomain.com # ex: mydomain.com or subdomain.mydomain.tld (=FQ Retrieve DNS serveur : -``` +```shell dnf install -y bind-utils # yum install -y bind-utils host -t ns $DNS_DOMAIN @@ -135,7 +135,7 @@ host -t ns domain.com # example To get ip address from an host or FQDN : -``` +```shell # With Host command @@ -165,7 +165,7 @@ dig sub.domain.com +short # example LDAP variables are : -``` +```shell LDAP_PROTOCOL=ldap # or ldaps LDAP_HOST= # ex: ldap.domain.tld LDAP_PORT=389 # default : 389 (LDAP), 636 (LDAPS) @@ -184,7 +184,7 @@ LDAP_ATTR=* # * for "For all attributs", ex: givenName, sn, ``` -``` +```shell Base: "dc=example,dc=com", Host: "ldap.example.com", @@ -226,7 +226,7 @@ ldapsearch -x -h $LDAP_HOST \ SMTP variables are : -``` +```shell SMTP_HOST= # default SMTP_PORT= # default port 25 not secure, and 587 for encrypted (secure)serveur # SMTP_USERNAME= # optional @@ -244,7 +244,7 @@ Test without SMTP Authentication : > Troubleshooting : mail command sometimes use /tmp folder, if you don't have permission to write inside it, mail command could fail. -``` +```shell dnf install -y mailx # yum install -y mailx # RHEL installation of mail command echo $SMTP_BODY | mail -S smtp=$SMTP_HOST -s $SMTP_SUBJECT $SMTP_RECIPIENT @@ -253,12 +253,12 @@ echo "body" | mail -S smtp=hostname -s "suject" "dest@domain.org" ``` or -``` +```shell echo $SMTP_BODY | mail -S smtp=$SMTP_HOST -s $SMTP_SUBJECT $SMTP_RECIPIENT ``` or -``` +```shell echo $SMTP_BODY | mail -S smtp=$SMTP_HOST -s $SMTP_SUBJECT -r $SMTP_FROM $SMTP_RECIPIENT ``` @@ -266,7 +266,7 @@ echo $SMTP_BODY | mail -S smtp=$SMTP_HOST -s $SMTP_SUBJECT -r $SMTP_FROM $SMTP_R With authentication : -``` +```shell # Get base64 Login perl -MMIME::Base64 -e 'print encode_base64("LOGIN_HERE");' # => Z2NpcaxaaWx4ZZzzV2 @@ -298,20 +298,20 @@ $SMTP_BODY ## Git Parameter -``` +```shell GIT_URL=https://git.domain.com/repository # ``` ## Git Testing -``` +```shell git clone $GIT_URL ``` # Show Listened ports -``` +```shell dnf install -y net-tools # yum install -y net-tools netstat -planteu ``` @@ -332,7 +332,7 @@ URL=https://httpbin.org/get # Example ## Set proxy globaly on linux -``` +```shell vi /etc/profile.d/http_proxy.sh export http_proxy=$PROXY_HOST:$PROXY_PORT @@ -342,7 +342,7 @@ export https_proxy=$PROXY_HOST:$PROXY_PORT Example : -``` +```shell vi /etc/profile.d/http_proxy.sh export http_proxy=proxy.domain.com:443 @@ -351,14 +351,14 @@ export https_proxy=proxy.domain.com:443 ``` You can check if this variables are loaded : -``` +```shell env | grep -i "proxy" ``` ## Curl behind a proxy -``` +```shell curl -v --proxy $PROXY_HOST:$PROXY_PORT $URL # Exemple @@ -369,7 +369,7 @@ curl -kv --proxy http://myproxy.domain.tld:8080 https://httpbin.org/get ## Git behind a proxy Globaly : -``` +```shell git config --global http.proxy http://$PROXY_HOST:$PROXY_HOST git config --global https.proxy http://$PROXY_HOST:$PROXY_HOST @@ -379,13 +379,13 @@ git config --global https.proxy http://$PROXY_HOST:$PROXY_HOST ``` Specific for a repository : -``` +```shell git config --global http.https://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port ``` or edit the ~/.gitconfig : -``` +```shell [http] [http "https://domain.com"] proxy = http://proxyUsername:proxyPassword@proxy.server.com:port @@ -395,7 +395,7 @@ or edit the ~/.gitconfig : ### Docker daemon add proxy settings -``` +```shell cat /etc/systemd/system/docker.service.d/http-proxy.conf [Service] Environment="HTTP_PROXY=http://$PROXY_HOST:$PROXY_PORT" @@ -411,7 +411,7 @@ sudo systemctl restart docker ### Docker build behind Proxy -``` +```shell docker build --build-arg http_proxy=http://$PROXY_HOST:$PROXY_PORT --build-arg https_proxy=http://$PROXY_HOST:$PROXY_PORT . # Example for MAVEN inside a container @@ -423,20 +423,20 @@ docker build --build-arg MAVEN_OPTS="-Dhttp.proxyHost=$PROXY_HOST -Dhttp.proxyPo ## NPM behind a Proxy -``` +```shell npm config set proxy http://$PROXY_HOST:$PROXY_PORT npm config set https-proxy http://$PROXY_HOST:$PROXY_PORT ``` ## PIP behind a Proxy -``` +```shell pip install --proxy=http://$PROXY_HOST:$PROXY_PORT -r requirements.txt ``` ## Gitlab Runner behind a proxy -``` +```shell mkdir /etc/systemd/system/gitlab-runner.service.d vi /etc/systemd/system/gitlab-runner.service.d/http-proxy.conf