7e493aeae4cd8d209de627536301fb3774587afc
coding/git.md
... | ... | @@ -0,0 +1,16 @@ |
1 | +[fork_and_branch_workflow](fork_and_branch_workflow) |
|
2 | + |
|
3 | +undo merge that hasn't been pushed |
|
4 | +```zsh |
|
5 | +git reset --merge HEAD~1 |
|
6 | +``` |
|
7 | + |
|
8 | +roll back hard |
|
9 | +``` |
|
10 | +git reset --hard <commit/tag> |
|
11 | +``` |
|
12 | + |
|
13 | + |
|
14 | +## ref |
|
15 | +- :1: https://www.atlassian.com/git/tutorials/making-a-pull-request |
|
16 | +- :2: https://git-scm.com/book/en/v2/Git-Branching-Rebasing |
coding/svn.md
... | ... | @@ -0,0 +1,14 @@ |
1 | +# svn |
|
2 | +[cheatsheet](https://www.cheatography.com/davechild/cheat-sheets/subversion/) |
|
3 | +[cheatsheet2](https://www.abbeyworkshop.com/howto/misc/svn01/) |
|
4 | + |
|
5 | +svn checkout --username=dudley.burrows http://code.ward.ie/svn/support-tools/trunk support-tools |
|
6 | + |
|
7 | +svn status |
|
8 | + |
|
9 | +svn update /path |
|
10 | + |
|
11 | +# only need add for new directories or files |
|
12 | +svn add /path|file |
|
13 | + |
|
14 | +svn commit -m "message" /path|file |
coding/vim.md
... | ... | @@ -0,0 +1,94 @@ |
1 | +# vim |
|
2 | + |
|
3 | +## toc |
|
4 | +1. [copy](#copy contents to/from files) |
|
5 | +2. [text wrap](#text wrap) |
|
6 | +3. [spell](#spell) |
|
7 | +4. [buffers](#buffers) |
|
8 | + |
|
9 | +## copy contents to/from files |
|
10 | +to copy the contents into a file |
|
11 | + ``` |
|
12 | + :r <filename> |
|
13 | + ``` |
|
14 | +or |
|
15 | + ``` |
|
16 | + :"qY # yank out of first file |
|
17 | + :"qP # put into second file |
|
18 | + ``` |
|
19 | +or read range of lines |
|
20 | + ``` |
|
21 | + :r! sed -n <n>,<m>p /path/to/file.md |
|
22 | + ``` |
|
23 | + |
|
24 | +to copy the contents to a new file |
|
25 | + ``` |
|
26 | + :<n>,<m> w <filename> |
|
27 | + ``` |
|
28 | + where `<n>` and `<m>` are numbers or symbols that designate range of lines |
|
29 | + |
|
30 | + |
|
31 | +## text wrap |
|
32 | +(wrap to column) |
|
33 | +wrap current line |
|
34 | +``` |
|
35 | +gqq |
|
36 | +``` |
|
37 | + |
|
38 | +wrap entire file |
|
39 | +``` |
|
40 | +gqG |
|
41 | +``` |
|
42 | + |
|
43 | +wrap paragraph using visual selection |
|
44 | +``` |
|
45 | +V}gq |
|
46 | +``` |
|
47 | + |
|
48 | +also use visual or visual block with `gq` |
|
49 | + |
|
50 | +## spell |
|
51 | +[ref_1](#ref#1) |
|
52 | +check spelling |
|
53 | +``` |
|
54 | +Spell |
|
55 | +``` |
|
56 | + |
|
57 | +move to word |
|
58 | +``` |
|
59 | +]s [s |
|
60 | +``` |
|
61 | + |
|
62 | +and see results |
|
63 | +``` |
|
64 | +z= |
|
65 | +``` |
|
66 | + |
|
67 | +turn off highlighting |
|
68 | +``` |
|
69 | +set nospell |
|
70 | +``` |
|
71 | + |
|
72 | +## buffers |
|
73 | +- buffer [faq](#ref#2) |
|
74 | +- using vanilla vim [answer](#ref#3) |
|
75 | +- buffers over tabs [answer](#ref#4) |
|
76 | +- open buffer |
|
77 | + ``` |
|
78 | + :e <filename> |
|
79 | + :new |
|
80 | + ``` |
|
81 | +- view buffers |
|
82 | + ``` |
|
83 | + :ls |
|
84 | + ``` |
|
85 | +- switch buffers |
|
86 | + ``` |
|
87 | + :buffer <num> |
|
88 | + ``` |
|
89 | + |
|
90 | +## ref |
|
91 | +- :1: https://www.linux.com/learn/using-spell-checking-vim |
|
92 | +- :2: http://vim.wikia.com/wiki/Vim_buffer_FAQ |
|
93 | +- :3: https://stackoverflow.com/questions/16082991/vim-switching-between-files-rapidly-using-vanilla-vim-no-plugins |
|
94 | +- :4: https://stackoverflow.com/questions/26708822/why-do-vim-experts-prefer-buffers-over-tabs |
documentation/pandoc.md
... | ... | @@ -0,0 +1,9 @@ |
1 | +# pandoc |
|
2 | + |
|
3 | +## curl webpages to man [ref 1](#ref#1) |
|
4 | +``` |
|
5 | +curl http://webpage.com | pandoc -s -f html -t man | man -l - |
|
6 | +``` |
|
7 | + |
|
8 | +## ref |
|
9 | +- :1: https://nixers.net/showthread.php?tid=1679&pid=15789&highlight=pandoc#pid15789 |
documentation/vimwiki.md
... | ... | @@ -0,0 +1,115 @@ |
1 | +# vimwiki |
|
2 | + |
|
3 | +1. [commands](#commands) |
|
4 | + |
|
5 | +## commands |
|
6 | +`=` increase header |
|
7 | +`-` decrease header |
|
8 | +`C-space` check todo box |
|
9 | +`glh` step down list |
|
10 | +`gll` step up list |
|
11 | +`\w\t` day diary in new tab |
|
12 | +`\w\i` on diary index generate new links |
|
13 | +`\wt` open wiki index in tab (only after mapping `nmap <Leader>wt <Plug>VimwikiTabnewLink`) |
|
14 | +`\wi` open diary index |
|
15 | + |
|
16 | +syntax highlighting |
|
17 | + |
|
18 | +```bash |
|
19 | +echo hello friend |
|
20 | +``` |
|
21 | + |
|
22 | +pandoc -s -f markdown -t html -o uofu/azure_ad_requirements.html uofu/azure_ad_requirements.md && firefox uofu/azure_ad_requirements |
|
23 | +.html |
|
24 | + |
|
25 | +anchors |
|
26 | + use [title] (#anchor#subanchor) |
|
27 | + i'm using :tags: under a #ref header to jump to links in page |
|
28 | + - switch to [pandoc markdown][] |
|
29 | + |
|
30 | +## gollum |
|
31 | +- install gollum |
|
32 | + ``` |
|
33 | + sudo gem install gollum |
|
34 | + ``` |
|
35 | + - requires 'icu' |
|
36 | + ``` |
|
37 | + sudo dnf install libicu-devel |
|
38 | + ``` |
|
39 | +- navigate to wiki dir and run gollum |
|
40 | + ``` |
|
41 | + gollum --css --h1-title |
|
42 | + ``` |
|
43 | + - using custom css file and setting first h1 header as page title |
|
44 | + - see [gollum config][] docs for options |
|
45 | +- look at [omnigollum][] for user auth |
|
46 | +- [gollum reverse proxy][] |
|
47 | + |
|
48 | +## installing gollum on jump-test |
|
49 | +https://github.com/gollum/gollum # use --bare |
|
50 | + |
|
51 | +- configure omnigollum https://github.com/arr2036/omnigollum |
|
52 | +- using azuread https://github.com/AzureAD/omniauth-azure-activedirectory |
|
53 | + |
|
54 | +### steps |
|
55 | +- to enable [git server][] |
|
56 | + - install git (duh!) |
|
57 | + - create 'git' user |
|
58 | + ``` |
|
59 | + adduser git |
|
60 | + mkdir ~git/.ssh |
|
61 | + chmod 700 ~git/.ssh |
|
62 | + touch ~git/.ssh/authorized_keys |
|
63 | + chmod 600 ~git/.ssh/authorized_keys |
|
64 | + ``` |
|
65 | +- mkdir 'wiki' dir |
|
66 | + ``` |
|
67 | + mkdir /wiki |
|
68 | + chown git. /wiki |
|
69 | + ``` |
|
70 | +- create git repo - [getting git on server][] |
|
71 | + ``` |
|
72 | + su - git |
|
73 | + cd /wiki |
|
74 | + git init --bare --shared |
|
75 | + ``` |
|
76 | +- clone repo and initial commit (on local machine) |
|
77 | + ``` |
|
78 | + git clone git@gitserver:/wiki wiki |
|
79 | + cd wiki/ |
|
80 | + echo "# wiki" > README.md |
|
81 | + git add README.md |
|
82 | + git commit -m "Initial commit" |
|
83 | + git push -u origin master |
|
84 | + ``` |
|
85 | +- install gollum |
|
86 | + ``` |
|
87 | + apt install ruby ruby-dev build-essential zlib1g-dev libicu-dev |
|
88 | + gem install gollum |
|
89 | + ``` |
|
90 | + |
|
91 | + ``` |
|
92 | + yum group install "Development Tools" |
|
93 | + yum install ruby ruby-devel libicu libicu-devel zlib zlib-devel |
|
94 | + gem install gollum |
|
95 | + ``` |
|
96 | +- enable gollum as a service |
|
97 | + ``` |
|
98 | + vi /etc/systemd/system/gollum.service |
|
99 | + |
|
100 | + [Service] |
|
101 | + ExecStart=/usr/local/bin/gollum --show-all "/wiki" |
|
102 | + ``` |
|
103 | +- allow traffic |
|
104 | + ``` |
|
105 | + iptables -I INPUT -p tcp --dport 4567 -j ACCEPT -m comment --comment "Allow access to wiki" |
|
106 | + ``` |
|
107 | + |
|
108 | + |
|
109 | +## ref |
|
110 | +[pandoc markdown]: http://pandoc.org/MANUAL.html#pandocs-markdown |
|
111 | +[gollum config]: https://github.com/gollum/gollum#configuration |
|
112 | +[omnigollum]: https://github.com/arr2036/omnigollum/blob/master/config.rb.example |
|
113 | +[gollum reverse proxy]: https://gist.github.com/spinpx/c46ea0b24157ca5f731f |
|
114 | +[git server]: https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server |
|
115 | +[getting git on server]: https://git-scm.com/book/en/v2/Git-on-the-Server-Getting-Git-on-a-Server |
index.md
... | ... | @@ -1,14 +1,75 @@ |
1 | 1 | # pyratewiki |
2 | 2 | |
3 | 3 | ## content |
4 | -1. [technology](#technology) |
|
5 | -2. [projects](#projects) |
|
4 | +1. [coding](#coding) |
|
5 | +2. [documentation](#documentation) |
|
6 | 6 | 3. [misc](#misc) |
7 | +4. [projects](#projects) |
|
8 | +5. [technology](#technology) |
|
9 | + 1. [authentication](#authentication) |
|
10 | + 2. [cloud](#cloud) |
|
11 | + 3. [communication](#communication) |
|
12 | + 4. [databases](#databases) |
|
13 | + 5. [encryption](#encryption) |
|
14 | + 6. [linux](#linux) |
|
15 | + 7. [monitoring](#monitoring) |
|
16 | + 8. [networking](#networking) |
|
17 | + 9. [virtualisation](#virtualisation) |
|
18 | +6. [wardwiki](wiki1:index) |
|
19 | + |
|
20 | +## coding |
|
21 | +- [git](coding/git) |
|
22 | +- [svn](coding/svn) |
|
23 | +- [vim](coding/vim) |
|
24 | + |
|
25 | +## documentation |
|
26 | +- [pandoc](documentation/pandoc) |
|
27 | +- [vimwiki](documentation/vimwiki) |
|
28 | + |
|
29 | +## misc |
|
30 | +- [music](misc/music) |
|
31 | +- [naming_schemes](misc/naming_schemes) |
|
32 | +- [unicode_characters](misc/unicode_characters) |
|
33 | +- |
|
34 | +## projects |
|
35 | +- [pyratenet](projects/pyratenet) |
|
36 | +- [startpage](projects/startpage) |
|
7 | 37 | |
8 | 38 | ## technology |
9 | 39 | |
40 | +### authentication |
|
41 | +- [ldap](technology/authentication/ldap) |
|
42 | + |
|
43 | +### cloud |
|
44 | +- [azure](technology/cloud/azure) |
|
45 | +- [docker](technology/cloud/docker) |
|
46 | +- [openshift](technology/cloud/openshift) |
|
47 | + |
|
48 | +### communication |
|
49 | +- [ftp](technology/communication/ftp) |
|
50 | +- [mutt](technology/communication/mutt) |
|
51 | + |
|
52 | +### databases |
|
53 | +- [mariadb](technology/databases/mariadb) |
|
54 | +- [oracle](technology/databases/oracle) |
|
55 | + |
|
56 | +### encryption |
|
57 | +- [gpg](technology/encryption/gpg) |
|
58 | + |
|
10 | 59 | ### linux |
60 | +- [archlinux](technology/linux/archlinux/index) |
|
61 | +- [audio_visual](technology/linux/audio_visual/index) |
|
62 | +- [debian](technology/linux/debian/index) |
|
63 | +- [general](technology/linux/general/index) |
|
64 | +- [redhat](technology/linux/redhat/index) |
|
11 | 65 | |
12 | -## projects |
|
66 | +### monitoring |
|
67 | +- [snmp](technology/monitoring/snmp) |
|
68 | + |
|
69 | +### networking |
|
70 | +- [subnet_cheatsheet](technology/networking/subnet_cheatsheet) |
|
71 | +- [wifi_connect](technology/networking/wifi_connect) |
|
72 | + |
|
73 | +### virtualisation |
|
74 | +- [esxi](technology/virtualisation/esxi) |
|
13 | 75 | |
14 | -## misc |
misc/music.md
... | ... | @@ -0,0 +1,15 @@ |
1 | +# music |
|
2 | + |
|
3 | +- twilight force "flight of the sapphire dragon" |
|
4 | +- old wolf "howl" |
|
5 | +- old wolf "trail of tears" |
|
6 | +- tarchon fist "metal detector" |
|
7 | +- vinide "another dimension" |
|
8 | +- odr "notte alcolica" |
|
9 | +- baphomets blood "command of the inverted cross" |
|
10 | +- twins crew "ghost of the seven seas" |
|
11 | +- dave esser "in ewigkeit amen" |
|
12 | +- when nothing remains "reunited in the grave" |
|
13 | +- demons & wizards "the whistler" |
|
14 | +- serenity "caught in a myth" |
|
15 | +- majesty "die like kings" |
misc/naming_schemes.md
... | ... | @@ -0,0 +1,36 @@ |
1 | +# naming schemes |
|
2 | + |
|
3 | +## hackers |
|
4 | +| name | media | device | |
|
5 | +|-----------|-------------------|--------| |
|
6 | +| grishenko | (boris) goldeneye | | |
|
7 | + |
|
8 | +- kaludis (frederick - die hard 4.0) |
|
9 | +- salander (lisbeth - tgwtdt) |
|
10 | +- nedry (dennis - jurassic park) |
|
11 | +- bishop (martin - sneakers) |
|
12 | +- flynn (kevin - tron) |
|
13 | +- simon j (one point o) |
|
14 | + |
|
15 | +## heren istarion (order of wizards) |
|
16 | + |
|
17 | +| middle-earth name | colour | maia name | |
|
18 | +|-------------------|---------------------|-----------| |
|
19 | +| saruman | white (many colors) | curumo | |
|
20 | +| gandalf | grey (white) | olórin | |
|
21 | +| radagast | brown | aiwendil | |
|
22 | +| morinehtar | blue | alatar | |
|
23 | +| rómestámo | blue | pallando | |
|
24 | + |
|
25 | +## pirate ships |
|
26 | +| name | device | |
|
27 | +|----------------------|--------| |
|
28 | +| black pearl | | |
|
29 | +| queen anne's revenge | | |
|
30 | +| ranger | | |
|
31 | +| walrus | | |
|
32 | +| flying dutchman | | |
|
33 | +| troubadour | | |
|
34 | +| venganza | | |
|
35 | +| wicked wench | | |
|
36 | +| jackdaw | | |
misc/unicode_characters.md
... | ... | @@ -0,0 +1,4 @@ |
1 | +# unicode characters |
|
2 | + |
|
3 | + * black skull and crossbones U+1f571 [link](https://unicode-table.com/en/1F571/) |
|
4 | + * alchemical symbol for night U+1f76f [link](https://unicode-table.com/en/1F76F/) |
projects/pyratenet.md
... | ... | @@ -0,0 +1,50 @@ |
1 | +# pyratenet |
|
2 | + |
|
3 | +- web |
|
4 | +- git |
|
5 | +- ftp |
|
6 | +- wiki |
|
7 | + |
|
8 | +## choices |
|
9 | +- one vps with docker |
|
10 | +- multi vps |
|
11 | + |
|
12 | +### one vps with docker |
|
13 | +look at using [jenkins ci/cd][] for auto deployment |
|
14 | + |
|
15 | +### multi vps |
|
16 | +use [git hooks][] for deployment - see refs |
|
17 | + |
|
18 | +#### wiki |
|
19 | +- using markdown files in git repo |
|
20 | +- following 'makefile' to build html files |
|
21 | + ```c |
|
22 | + MD_FILES=$(shell find . -name \*.md) |
|
23 | + HTML_FILES=$(MD_FILES:.md=.html) |
|
24 | + BUILD_HTML_FILES=$(HTML_FILES:%=build/%) |
|
25 | + |
|
26 | + all: $(BUILD_HTML_FILES) |
|
27 | + |
|
28 | + build/assets/%: assets/% |
|
29 | + @mkdir -p $$(dirname $@) |
|
30 | + cp $? $@ |
|
31 | + |
|
32 | + build/%.html: %.md |
|
33 | + @mkdir -p $$(dirname $@) |
|
34 | + pandoc -o $@ $< |
|
35 | + |
|
36 | + # run with `make deploy` |
|
37 | + deploy: |
|
38 | + rsync --recursive --human-readable --delete --info=progress2 \ |
|
39 | + build/* user@host:dir |
|
40 | + ``` |
|
41 | + - run with `make deploy` |
|
42 | + |
|
43 | +## ref |
|
44 | +[jenkins ci/cd]: https://blog.harveydelaney.com/jenkins-build-test-deploy-node-app/ |
|
45 | +http://joemaller.com/990/a-web-focused-git-workflow/ |
|
46 | +http://codesamplez.com/source-control/deployment-with-git-hook |
|
47 | +https://www.digitalocean.com/community/tutorials/how-to-use-git-hooks-to-automate-development-and-deployment-tasks |
|
48 | +[git hooks]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks |
|
49 | +https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps |
|
50 | +http://toroid.org/git-website-howto |
projects/startpage.md
... | ... | @@ -0,0 +1,7 @@ |
1 | +# startpage |
|
2 | + |
|
3 | +## appearance |
|
4 | +- comic |
|
5 | + |
|
6 | +## links to add |
|
7 | +- stashmycomics |
technology/authentication/ldap.md
... | ... | @@ -0,0 +1,4 @@ |
1 | +# ldap |
|
2 | + |
|
3 | +ldapsearch -v -x -LLL -h host -D "bind DN" -w password -b "OU=" |
|
4 | +ldapsearch -v -x -LLL -h tristan.ward.ie:389 -D "CN=apache_svn_ro,OU=Automated System Accounts,OU=Ward Users,DC=ward,DC=ie" -w [password] -b "OU=Ward Users,dc=ward,dc=ie" |
technology/cloud/azure.md
... | ... | @@ -0,0 +1,184 @@ |
1 | +# azure |
|
2 | +[aries](https://aries.ward.ie/x/YgFk) |
|
3 | + |
|
4 | +## toc |
|
5 | + |
|
6 | + |
|
7 | +## ward accounts (keepass) |
|
8 | + * dudley@wardazureward.onmicrosoft.com |
|
9 | + - non-prod (uat/dev) |
|
10 | + * dburrows@warddemo.onmicrosoft.com |
|
11 | + - prod |
|
12 | + |
|
13 | +## personal accounts |
|
14 | + * blahthing@icloud.com |
|
15 | + * dudleyburrows@ward.ie |
|
16 | + |
|
17 | +## az cli |
|
18 | +[docs](https://docs.microsoft.com/en-gb/cli/azure/get-started-with-azure-cli?view=azure-cli-latest) |
|
19 | + |
|
20 | +### useful cmds |
|
21 | + - show list of resource groups |
|
22 | + ``` |
|
23 | + az group list --output table |
|
24 | + ``` |
|
25 | + - list resources in a resource group |
|
26 | + ``` |
|
27 | + az resource list -g <group_name> --output table |
|
28 | + ``` |
|
29 | + |
|
30 | + |
|
31 | +### create an Ubuntu vm called PP-WRD-TEST01 in the group P-WRD-RGRP on the PP-WRD-VNET vnet with no additional network security group, using username dburrows and public key for ssh |
|
32 | +az vm create -g P-WRD-RGRP -n PP-WRD-TEST01 --vnet-name PP-WRG-VNET --nsg "" --image UbuntuLTS --ssh-key-value .ssh/dburrows.pub --admin-username dburrows |
|
33 | + |
|
34 | + |
|
35 | + |
|
36 | + |
|
37 | +install the azure cli command `{{az}}` by running the following |
|
38 | +``` |
|
39 | +curl -L https://aka.ms/InstallAzureCLI | bash |
|
40 | +``` |
|
41 | + |
|
42 | +once installed login in to your account with |
|
43 | +``` |
|
44 | +az login |
|
45 | +``` |
|
46 | + |
|
47 | +to switch to a different account run |
|
48 | +``` |
|
49 | +az logout |
|
50 | +``` |
|
51 | + |
|
52 | +then run the login command again. |
|
53 | + |
|
54 | +all the following steps _can_ be run from the portal cli as well as your local machine once you have installed {{az}}. |
|
55 | + |
|
56 | +### changing subscriptions |
|
57 | + |
|
58 | +check your subscriptions |
|
59 | +``` |
|
60 | +az account list --output table |
|
61 | +``` |
|
62 | + |
|
63 | +show which subscription you're currently using |
|
64 | +``` |
|
65 | +az account show |
|
66 | +``` |
|
67 | + |
|
68 | +then to change subscriptions run |
|
69 | +``` |
|
70 | +az account set --subscription "Ward MS Partner Account" |
|
71 | +``` |
|
72 | + |
|
73 | +### show vm images |
|
74 | +``` |
|
75 | +az image list |
|
76 | +``` |
|
77 | + |
|
78 | +### getting started |
|
79 | + |
|
80 | +here is a quick run through of spinning up a [centos](https://www.centos.org/) virtual machine |
|
81 | + |
|
82 | + - create resource group |
|
83 | + ``` |
|
84 | + az group create --name D-TST-RGRP --location northeurope |
|
85 | + ``` |
|
86 | + - create Network Security Group |
|
87 | + ``` |
|
88 | + az network nsg create --resource-group D-TST-RGRP --name D-TST-LAPP01 |
|
89 | + ``` |
|
90 | + - create a network rule in an existing security group |
|
91 | + ``` |
|
92 | + az network nsg rule create --resource-group D-TST-RGRP --nsg-name D-TST-NSGP --name allow-ward --description "Allow all traffic from Ward public range" --access Allow --protocol Tcp --direction Inbound --priority 102 --source-address-prefix "93.94.119.240/28" --source-port-range "*" --destination-address-prefix "*" --destination-port-range "*" |
|
93 | + ``` |
|
94 | + - create a virtual machine |
|
95 | + ``` |
|
96 | + az vm create -g D-TST-RGRP -n D-TST-LAPP01 --image CentOS --generate-ssh-keys |
|
97 | + ``` |
|
98 | + |
|
99 | +once the VM is successfully created it will output some json. make note of the "publicIpAddress" value, and use this to {{ssh}} to the server. |
|
100 | + |
|
101 | +## advanced tools |
|
102 | + |
|
103 | +the following are a collection of tools which have been played around with. some of these tools may require escalated privileges which your account may not have. if you are unable to action anything and really desperately need to then speak to one of the azure admins. |
|
104 | + |
|
105 | +you can check your current role with the cli. first you need to make a note of the username for the subscription you're using |
|
106 | +``` |
|
107 | +az account show |
|
108 | +{ |
|
109 | + "environmentName": "AzureCloud", |
|
110 | + "id": "b1447c5c-db40-4a01-9fc3-d56a740047b5", |
|
111 | + "isDefault": true, |
|
112 | + "name": "Ward MS Partner Account", |
|
113 | + "state": "Enabled", |
|
114 | + "tenantId": "89252e5d-2862-422f-8279-7d0a49e32e6a", |
|
115 | + "user": { |
|
116 | + "name": "dudley@wardazureward.onmicrosoft.com", |
|
117 | + "type": "user" |
|
118 | + } |
|
119 | +} |
|
120 | +``` |
|
121 | +copy the value from {{"user": "name":}}, then run the following replacing {{<value>}} with the username (usually an email address) |
|
122 | +``` |
|
123 | +az role assignment list --assignee <value> |
|
124 | +[ |
|
125 | + { |
|
126 | + "id": "/subscriptions/b1447c5c-db40-4a01-9fc3-d56a740047b5/providers/Microsoft.Authorization/roleAssignments/85f38488-d3f3-423b-afb7-77d8cadddd32", |
|
127 | + "name": "85f38488-d3f3-423b-afb7-77d8cadddd32", |
|
128 | + "properties": { |
|
129 | + "principalId": "5ad99088-9605-4a83-843c-71bc51bf53f6", |
|
130 | + "principalName": "dudley@wardazureward.onmicrosoft.com", |
|
131 | + "roleDefinitionId": "/subscriptions/b1447c5c-db40-4a01-9fc3-d56a740047b5/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c", |
|
132 | + "roleDefinitionName": "Contributor", |
|
133 | + "scope": "/subscriptions/b1447c5c-db40-4a01-9fc3-d56a740047b5" |
|
134 | + }, |
|
135 | + "type": "Microsoft.Authorization/roleAssignments" |
|
136 | + } |
|
137 | +] |
|
138 | +``` |
|
139 | +your current role is under {{"properties": "roleDefinitionName":}} |
|
140 | + |
|
141 | +## show all resources in your subscription |
|
142 | +``` |
|
143 | +az group list --output table |
|
144 | +``` |
|
145 | + |
|
146 | +## deploy a kubernetes cluster |
|
147 | + |
|
148 | +we add the {{aks}} option to manage azure kubernetes services. Currently aks is only available in west europe |
|
149 | +``` |
|
150 | +az group create --name D-K8S-RGRP --location westeurope |
|
151 | +az aks create --name D-K8S-KCLU --resource-group D-K8S-RGRP --generate-ssh-keys |
|
152 | +az aks get-credentials --name D-K8S-KCLU --resource-group D-K8S-RGRP |
|
153 | +az aks browse --name D-K8S-KCLU --resource-group D-K8S-RGRP |
|
154 | +az aks show --resource-group dudley-container-demo-rg --name dudley-container-demo-clu --query "servicePrincipalProfile.clientId" --output tsv |
|
155 | +``` |
|
156 | + |
|
157 | +## deploy webapp and enable for webhooks |
|
158 | +``` |
|
159 | +az group create --name webapp-rg -l northeurope |
|
160 | +az appservice plan create -g webapp-rg -n webapp-srvplan --is-linux |
|
161 | +az webapp create -g webapp-rg -p webapp-srvplan -n webapp -i pyratebeard/container-webhook-demo |
|
162 | +az webapp deployment container config -n webapp -g webapp-rg --enable-cd true |
|
163 | +az webapp deployment container show-cd-url -n D-TST-APP-SRV -g D-TST-APP-RG |
|
164 | +``` |
|
165 | + |
|
166 | +run script tool on VMs (under 'Operation') |
|
167 | + |
|
168 | +## create vpn - [ref1][] |
|
169 | +* virtual network |
|
170 | +* virtual network gateway |
|
171 | +* local network gateway |
|
172 | +* public ip |
|
173 | +* connection (under virtual network gateway) |
|
174 | +* vpn not coming up in fortigate |
|
175 | + * running network watcher troubleshooting |
|
176 | + * need to add address space to connection |
|
177 | +* connect through gateway to website (using peering?) |
|
178 | + |
|
179 | + |
|
180 | +[auto tagging][] |
|
181 | + |
|
182 | +## ref |
|
183 | +[ref1]: https://cookbook.fortinet.com/ipsec-vpn-microsoft-azure-54/ |
|
184 | +[auto tagging]: https://gallery.technet.microsoft.com/scriptcenter/Automatically-Azure-fc5f1443 |
technology/cloud/docker.md
... | ... | @@ -0,0 +1,10 @@ |
1 | +# docker |
|
2 | + |
|
3 | +## pull files from inside container |
|
4 | +``` |
|
5 | +docker cp <container_id>:/path/to/file /path/to/save |
|
6 | +``` |
|
7 | + |
|
8 | +## ref |
|
9 | +- :1: https://stackoverflow.com/questions/44027873/how-to-create-a-new-docker-image-from-a-running-container-on-amazon |
|
10 | +- :2: https://stackoverflow.com/questions/43699368/configure-docker-daemon-port-to-enable-docker-apis/43713435#43713435 |
technology/cloud/openshift.md
... | ... | @@ -0,0 +1,3 @@ |
1 | +# openshift |
|
2 | + |
|
3 | +- 20180913: [red_hat_container_event](red_hat_container_event) |
technology/cloud/red_hat_container_event.md
... | ... | @@ -0,0 +1,619 @@ |
1 | +# rh container event (cloud-native roadshow) |
|
2 | + |
|
3 | +## ops |
|
4 | + |
|
5 | +- wifi: |
|
6 | + - Ballsridge Hotel |
|
7 | + - beourguest2018 |
|
8 | +- https://redhat.qwiklab.com/focuses/191 |
|
9 | +- lab details |
|
10 | + - host master.674462327352.aws.testdrive.openshift.com |
|
11 | + - user cloud-user |
|
12 | + - pass qwikLABS-L64-23179 |
|
13 | + - docs http://support.674462327352.aws.testdrive.openshift.com/ |
|
14 | +- [feedback](http://bit.ly/CNRSFeedback) |
|
15 | +- additional credits: testdrivetokens <at> redhat <dot> com |
|
16 | + |
|
17 | +- run cloudforms/oshift web console on oshift (app nodes) - reverse proxy for bastion |
|
18 | + |
|
19 | +## lab |
|
20 | +- navigate to `https://redhat.qwiklab.com/focuses/191` and login |
|
21 | + - user: dudley.burrows@ward.ie |
|
22 | + - pass: reachfortheclouds |
|
23 | +- select 'My Learning' then 'OpenShift for Ops Test Drive' |
|
24 | +- Click 'Start Lab' in the top right. Once the lab has been spun up the connection details will appear in the left pane. |
|
25 | +- The lab guide URL will also be shown. |
|
26 | + |
|
27 | + |
|
28 | +## presentation |
|
29 | + |
|
30 | +### oshift overview |
|
31 | +- hybrid scaling |
|
32 | + - from on-prem to cloud in mins |
|
33 | +- jenkins pipeline |
|
34 | + - servicenow rest api to 'tick box' before continuing |
|
35 | +- kubernetes |
|
36 | +- oci compatible container runtime (docker) |
|
37 | +- internal container repo in oshift (certified by rh) |
|
38 | +- 10x workload density than vms --?? |
|
39 | +- ownership boundaries |
|
40 | + - dev |
|
41 | + - container |
|
42 | + - app |
|
43 | + - os dependencies |
|
44 | + - ops |
|
45 | + - container host |
|
46 | + - infra |
|
47 | +- container image layers |
|
48 | + - immutable images (kill and redeploy) |
|
49 | +- base image patching |
|
50 | + - oshift rebuilds all containers using image stream |
|
51 | + - source to image build |
|
52 | +- lightweight, oci-compliant container runtime (cri-o --??) |
|
53 | + - rhel on node (host) and container |
|
54 | + - pod = collection of containers |
|
55 | + - smallest unit of management in oshift |
|
56 | + - only oci-compliant are supported |
|
57 | +- masters (3x) |
|
58 | + - can lose all w/out effecting live traffic |
|
59 | + - rest api (servicenow to do oshift activites) |
|
60 | + - datastore |
|
61 | + - desired / current state |
|
62 | + - etcd db |
|
63 | + - one per master |
|
64 | + - sync'd across masters |
|
65 | + - ansible playbook bundles instead of bakup (infra as code) |
|
66 | + - orchestration and scheduling |
|
67 | + - placement by policy |
|
68 | + - health/scaling - autoscaling pods |
|
69 | + - endpoints put in by devs |
|
70 | + - readiness probe |
|
71 | + - liveness probe |
|
72 | +- infra nodes |
|
73 | + - integrated container registry |
|
74 | +- persistent storage |
|
75 | + - glusterfs |
|
76 | +- service layer |
|
77 | +- routing layer |
|
78 | + - expose services externally |
|
79 | + |
|
80 | +### container storage |
|
81 | +- oshift persistent storage framework |
|
82 | + - PersistentVolumeClaim |
|
83 | + - submitted by dev |
|
84 | + - StorageClass |
|
85 | + - set up by ops |
|
86 | + - Storage Backend |
|
87 | + - PersistentVolmue |
|
88 | + - mounted by pod |
|
89 | + - bound to PersistentVolumeClaim |
|
90 | +- glusterfs |
|
91 | + - (app) node labelled as container native storage |
|
92 | + - underlying storage: das, jbod |
|
93 | + - scale-out linearly |
|
94 | + - replicate sync and async |
|
95 | + - [heketi](#ref#1) - restful glusterfs management |
|
96 | + |
|
97 | +- subscription licensing |
|
98 | + - not required for master/infra |
|
99 | + - only for 'worker' nodes (app nodes) |
|
100 | + - based on number of vms or socket pairs |
|
101 | + - spotfleets?? |
|
102 | + - cloudforms to manage subscriptions? |
|
103 | + |
|
104 | +### lab |
|
105 | +- environment |
|
106 | + - master x1 |
|
107 | + - infra x1 |
|
108 | + - app x6 |
|
109 | + - idm x1 (ldap auth) |
|
110 | +- ssh into master node |
|
111 | +- using ansible playbooks for installing oshift |
|
112 | + - part of the `openshift-ansible` pkg |
|
113 | +- installers config `/etc/ansible/hosts` [docs](#ref#2) |
|
114 | + - general settings under `[OSEv3:vars]` |
|
115 | +- top level runbook triggers install of cluster |
|
116 | + - `/usr/share/ansible/openshift-ansible/playbooks/deploy_cluster.yml` |
|
117 | +- requires 'super admin' account |
|
118 | +- [cmds](#oc commands) |
|
119 | +- [web_console](https://openshift.674462327352.aws.testdrive.openshift.com/console) |
|
120 | +- [prometheus](#ref#3) |
|
121 | + - cluster infra monitoring and alerting |
|
122 | +- verify storage cluster |
|
123 | + ``` |
|
124 | + export HEKETI_CLI_SERVER=http://heketi-storage-storage.apps.674462327352.aws.testdrive.openshift.com |
|
125 | + export HEKETI_CLI_USER=admin |
|
126 | + export HEKETI_CLI_KEY=myS3cr3tpassw0rd |
|
127 | + heketi-cli cluster list #shows internal uuid of cns cluster |
|
128 | + heketi-cli topology info |
|
129 | + ``` |
|
130 | +- application management |
|
131 | + - create new project (bucket) |
|
132 | + - deploy new app (automatically created [service](#ref#6)) |
|
133 | + - view service yaml |
|
134 | + - scale app |
|
135 | + - delete pod |
|
136 | + - oshift redeploys in less than 10secs! |
|
137 | + - create route (expose service) |
|
138 | +- [application probes](#ref#7) |
|
139 | + - liveness probe |
|
140 | + - readiness probe |
|
141 | + - check endpoint health |
|
142 | + ``` |
|
143 | + curl mapit-app-management.apps.674462327352.aws.testdrive.openshift.com/health |
|
144 | + ``` |
|
145 | + - probe endpoint for liveness (set probe) |
|
146 | + ``` |
|
147 | + oc set probe dc/mapit --liveness --get-url=http://:8080/health --initial-delay-seconds=30 |
|
148 | + ``` |
|
149 | + - probe endpoint for readiness (set probe) |
|
150 | + ``` |
|
151 | + oc set probe dc/mapit --readiness --get-url=http://:8080/health --initial-delay-seconds=30 |
|
152 | + ``` |
|
153 | + - confirm |
|
154 | + ``` |
|
155 | + oc describe dc mapit |
|
156 | + ``` |
|
157 | + - 'Containers' section |
|
158 | +- add storage to app |
|
159 | + ``` |
|
160 | + oc volume dc/mapit --add --name=mapit-storage -t pvc --claim-mode=ReadWriteMany --claim-size=1Gi --claim-name=mapit-storage --mount-path=/app-storage |
|
161 | + ``` |
|
162 | + - storage now available at `/app-storage` inside node (rsh log on) |
|
163 | +- project request template, quota, limits |
|
164 | + - view default template |
|
165 | + - modify template |
|
166 | + ``` |
|
167 | + cat /opt/lab/support/project_request_template.yaml |
|
168 | + ``` |
|
169 | + - new sections: |
|
170 | + - [ResourceQuota](#ref#8) |
|
171 | + - [LimitRange](#ref#9) |
|
172 | + - install new template |
|
173 | + - modify 'master-config.yaml' section 'projectRequestTemplate' |
|
174 | + ``` |
|
175 | + sudo vim /etc/origin/master/master-config.yaml |
|
176 | + ``` |
|
177 | + - restart master |
|
178 | + ``` |
|
179 | + sudo systemctl restart atomic-openshift-master-api atomic-openshift-master-controllers |
|
180 | + ``` |
|
181 | +- groups |
|
182 | + - [external auth providers](#ref#10) |
|
183 | + - [role based access control](#ref#11) |
|
184 | + - login as normal user |
|
185 | + - no projects |
|
186 | + - login as 'fancyuser' |
|
187 | + - projects are shown |
|
188 | + - create 3x new projects (lifecycle) |
|
189 | + - ose-teamed-app edit dev and test, view prod |
|
190 | + - ose-fancy-dev edit prod |
|
191 | + - login is as teamed user to see 3x projects |
|
192 | + - create app in prod - fails! |
|
193 | + - prometheus |
|
194 | + - login as fancyuser1 |
|
195 | +- infrastructure management, metrics and logging |
|
196 | + - extending cluster |
|
197 | + - view app nodes |
|
198 | + - uncomment '#scaleup_' in '/etc/ansible/hosts' |
|
199 | + - use ansible to verify nodes are online |
|
200 | + ``` |
|
201 | + ansible new_nodes -m ping |
|
202 | + ``` |
|
203 | + - run playbook to extend cluster |
|
204 | + ``` |
|
205 | + ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/openshift-node/scaleup.yml |
|
206 | + ``` |
|
207 | + - multi master ha setup [docs](#ref#12) |
|
208 | + - container-native storage for infra |
|
209 | + - required by registry, logging, metrics |
|
210 | + - configure installer |
|
211 | + ``` |
|
212 | + sudo sed -i 's/#cnsinfra_//g' /etc/ansible/hosts |
|
213 | + ``` |
|
214 | + - install cns cluster for infra |
|
215 | + ``` |
|
216 | + ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/openshift-glusterfs/config.yml |
|
217 | + ``` |
|
218 | + - regular file storage service (glusterfs) not supported for logging/metrics |
|
219 | + - must use block storage (glusterblock) |
|
220 | + - metrics |
|
221 | + - based on [hawkular](#ref#13) in a cassandra db |
|
222 | + - configure installer |
|
223 | + ``` |
|
224 | + sudo sed -i 's/#metrics_//g' /etc/ansible/hosts |
|
225 | + sudo sed -i '/openshift_metrics_install_metrics=false/d' /etc/ansible/hosts |
|
226 | + ``` |
|
227 | + - run playbook to install metrics |
|
228 | + ``` |
|
229 | + ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/openshift-metrics/config.yml |
|
230 | + ``` |
|
231 | + - logging |
|
232 | + - using efk |
|
233 | + - elasticsearch (centralplace) |
|
234 | + - fluentd (consolidated) |
|
235 | + - kibana (ui) |
|
236 | + - configure installer |
|
237 | + ``` |
|
238 | + sudo sed -i 's/#logging_//g' /etc/ansible/hosts |
|
239 | + sudo sed -i '/openshift_logging_install_logging=false/d' /etc/ansible/hosts |
|
240 | + ``` |
|
241 | + - run playbook to install logging |
|
242 | + ``` |
|
243 | + ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/openshift-logging/config.yml |
|
244 | + ``` |
|
245 | + - multitenant networking |
|
246 | + - [sdn](#ref#14) based on open vswitch |
|
247 | + - execute creation script |
|
248 | + ``` |
|
249 | + bash /opt/lab/support/net-proj.sh |
|
250 | + ``` |
|
251 | + - get ip of pod b |
|
252 | + ``` |
|
253 | + bash /opt/lab/support/podbip.sh |
|
254 | + ``` |
|
255 | + - export pod b ip |
|
256 | + ``` |
|
257 | + export POD_B_IP=$(bash /opt/lab/support/podbip.sh) |
|
258 | + ``` |
|
259 | + - get name of pod in netproj-a project and export as var |
|
260 | + ``` |
|
261 | + oc get pods -n netproj-a |
|
262 | + export POD_A_NAME=ose-1-zccsx |
|
263 | + ``` |
|
264 | + - execute `ping` in pod a try to reach pod b |
|
265 | + ``` |
|
266 | + oc exec -n netproj-a $POD_A_NAME -- ping -c1 -W1 $POD_B_IP |
|
267 | + ``` |
|
268 | + - fails because networks aren't connected |
|
269 | + - join networks |
|
270 | + ``` |
|
271 | + oc get netnamespace |
|
272 | + oc adm pod-network join-projects netproj-a --to=netproj-b |
|
273 | + oc get netnamespace |
|
274 | + ``` |
|
275 | + - network ids of two projs now the same |
|
276 | + - retest connectivity |
|
277 | + ``` |
|
278 | + oc exec -n netproj-a $POD_A_NAME -- ping -c1 -W1 $POD_B_IP |
|
279 | + ``` |
|
280 | + - isolate (unjoin) projects |
|
281 | + ``` |
|
282 | + oc adm pod-network isolate-projects netproj-a |
|
283 | + ``` |
|
284 | + - use ['NetworkPolicy'](#ref#15) for finer grain |
|
285 | + - node maintenance |
|
286 | + - mark node as 'non-schedulable' then drain all pods on node |
|
287 | + - mark node02 as 'non-schedulable' |
|
288 | + ``` |
|
289 | + oc adm manage-node node02.internal.aws.testdrive.openshift.com --schedulable=false |
|
290 | + ``` |
|
291 | + - does not impact running pods |
|
292 | + - drain pods on node02 (dryrun first) |
|
293 | + - node now ready for maintenance (reboot etc) |
|
294 | + - add node back into oshift |
|
295 | + ``` |
|
296 | + oc adm manage-node node02.internal.aws.testdrive.openshift.com --schedulable=true |
|
297 | + ``` |
|
298 | + - oshift registry with cns |
|
299 | + - uses ephemeral storage in its pod |
|
300 | + - restarts or redeployments cause container images lost |
|
301 | + - add cns to registry |
|
302 | + - add volume |
|
303 | + ``` |
|
304 | + oc volume dc/docker-registry --add --name=registry-storage -t pvc \ |
|
305 | + --claim-mode=ReadWriteMany --claim-size=5Gi \ |
|
306 | + --claim-name=registry-storage --claim-class=glusterfs-registry --overwrite |
|
307 | + ``` |
|
308 | + - verify deploymentconfig |
|
309 | + ``` |
|
310 | + oc get dc/docker-registry |
|
311 | + ``` |
|
312 | + - scale registry |
|
313 | + ``` |
|
314 | + oc scale dc/docker-registry --replicas=3 |
|
315 | + ``` |
|
316 | +- container-native storage concepts |
|
317 | + - login as super admin in 'storage' |
|
318 | + ``` |
|
319 | + oc login -u system:admin -n storage |
|
320 | + ``` |
|
321 | + - view pods |
|
322 | + ``` |
|
323 | + oc get pods -n storage -o wide |
|
324 | + ``` |
|
325 | + - check service and route |
|
326 | + ``` |
|
327 | + oc get service,route |
|
328 | + ``` |
|
329 | + - perform health check on endpoint |
|
330 | + ``` |
|
331 | + curl -w "\n" http://heketi-storage-storage.apps.674462327352.aws.testdrive.openshift.com/hello |
|
332 | + ``` |
|
333 | + - login as 'fancyuser1' |
|
334 | + ``` |
|
335 | + oc login -u fancyuser1 -p openshift |
|
336 | + ``` |
|
337 | + - create new app |
|
338 | + ``` |
|
339 | + oc new-project my-database-app |
|
340 | + ``` |
|
341 | + - view template |
|
342 | + ``` |
|
343 | + oc get template/rails-pgsql-persistent -n openshift |
|
344 | + ``` |
|
345 | + - view pvc in template |
|
346 | + ``` |
|
347 | + oc get template/rails-pgsql-persistent -n openshift -o yaml | grep PersistentVolumeClaim -A8 |
|
348 | + ``` |
|
349 | + - specify storage size |
|
350 | + ``` |
|
351 | + oc new-app rails-pgsql-persistent -p VOLUME_CAPACITY=5Gi |
|
352 | + ``` |
|
353 | + - get route |
|
354 | + ``` |
|
355 | + oc get route |
|
356 | + ``` |
|
357 | + - explore underlying cns |
|
358 | + - login as system admin |
|
359 | + - select 'my-database-app' proj |
|
360 | + ``` |
|
361 | + oc project my-database-app |
|
362 | + ``` |
|
363 | + - view pvc |
|
364 | + - export pvc name as var |
|
365 | + ``` |
|
366 | + export PGSQL_PV_NAME=$(oc get pvc/postgresql -o jsonpath="{.spec.volumeName}" -n my-database-app) |
|
367 | + ``` |
|
368 | + - describe pvc |
|
369 | + ``` |
|
370 | + oc describe pv $PGSQL_PV_NAME |
|
371 | + ``` |
|
372 | + - export glusterfs volume name |
|
373 | + ``` |
|
374 | + export PGSQL_GLUSTER_VOLUME=$(oc get pv $PGSQL_PV_NAME -o jsonpath='{.spec.glusterfs.path}') |
|
375 | + ``` |
|
376 | + - switch to storage project |
|
377 | + ``` |
|
378 | + oc project storage |
|
379 | + ``` |
|
380 | + - view glusterfs pods |
|
381 | + ``` |
|
382 | + oc get pods -o wide -l glusterfs=storage-pod |
|
383 | + ``` |
|
384 | + - store first glusterfs pod name and ip as vars |
|
385 | + ``` |
|
386 | + export FIRST_GLUSTER_POD=$(oc get pods -o jsonpath='{.items[0].metadata.name}' -l glusterfs=storage-pod) |
|
387 | + export FIRST_GLUSTER_IP=$(oc get pods -o jsonpath='{.items[0].status.podIP}' -l glusterfs=storage-pod) |
|
388 | + echo $FIRST_GLUSTER_POD |
|
389 | + echo $FIRST_GLUSTER_IP |
|
390 | + ``` |
|
391 | + - query gluster pod for volumes (rsh) |
|
392 | + ``` |
|
393 | + oc rsh $FIRST_GLUSTER_POD gluster volume list |
|
394 | + ``` |
|
395 | + - query for topology |
|
396 | + ``` |
|
397 | + oc rsh $FIRST_GLUSTER_POD gluster volume info $PGSQL_GLUSTER_VOLUME |
|
398 | + ``` |
|
399 | + - export brick dir path |
|
400 | + ``` |
|
401 | + export PGSQL_GLUSTER_BRICK=$(echo -n $(oc rsh $FIRST_GLUSTER_POD gluster vol info $PGSQL_GLUSTER_VOLUME | grep $FIRST_GLUSTER_IP) | cut -d ':' -f 3 | tr -d $'\r' ) |
|
402 | + echo $PGSQL_GLUSTER_BRICK |
|
403 | + ``` |
|
404 | + - look at brick dir |
|
405 | + ``` |
|
406 | + oc rsh $FIRST_GLUSTER_POD ls -ahl $PGSQL_GLUSTER_BRICK |
|
407 | + ``` |
|
408 | + - provide scalable, shared storage w/ cns |
|
409 | + - deploy file uploader app |
|
410 | + ``` |
|
411 | + oc login -u fancyuser1 -p openshift |
|
412 | + oc new-project my-shared-storage |
|
413 | + oc new-app openshift/php:7.0~https://github.com/christianh814/openshift-php-upload-demo --name=file-uploader |
|
414 | + ``` |
|
415 | + - view logs to wait for app to be deployed |
|
416 | + ``` |
|
417 | + oc logs -f bc/file-uploader |
|
418 | + ``` |
|
419 | + - expose app via route |
|
420 | + ``` |
|
421 | + oc expose svc/file-uploader |
|
422 | + ``` |
|
423 | + - scale up for ha |
|
424 | + ``` |
|
425 | + oc scale --replicas=3 dc/file-uploader |
|
426 | + ``` |
|
427 | + - upload file to app |
|
428 | + - view pods to find where file is located |
|
429 | + ``` |
|
430 | + oc rsh file-uploader-1-k2v0d ls -hl uploaded |
|
431 | + oc rsh file-uploader-1-sz49r ls -hl uploaded |
|
432 | + oc rsh file-uploader-1-xjg9f ls -hl uploaded |
|
433 | + ``` |
|
434 | + - create pvc |
|
435 | + ``` |
|
436 | + oc volume dc/file-uploader --add --name=my-shared-storage \ |
|
437 | + -t pvc --claim-mode=ReadWriteMany --claim-size=1Gi \ |
|
438 | + --claim-name=my-shared-storage --mount-path=/opt/app-root/src/uploaded |
|
439 | + ``` |
|
440 | + - refresh app (new nodes) |
|
441 | + - upload new file |
|
442 | + - view file across all nodes |
|
443 | + - increase vol capacity |
|
444 | + - fill up current cap |
|
445 | + ``` |
|
446 | + oc rsh file-uploader-2-jd22b dd if=/dev/zero of=uploaded/bigfile bs=1M count=1000 |
|
447 | + oc rsh file-uploader-2-jd22b df -h /opt/app-root/src/uploaded |
|
448 | + ``` |
|
449 | + - edit pvc |
|
450 | + ``` |
|
451 | + oc edit pvc my-shared-storage |
|
452 | + ``` |
|
453 | + - edit storage size |
|
454 | + - oshift updates on exit from vi |
|
455 | + - confirm cap |
|
456 | + ``` |
|
457 | + oc rsh file-uploader-2-jd22b df -h /opt/app-root/src/uploaded |
|
458 | + ``` |
|
459 | + - providing block storage with cns |
|
460 | + - block storage = iscsi lun |
|
461 | + - view host running elasticsearch |
|
462 | + ``` |
|
463 | + oc get pod -l component=es -n logging -o wide |
|
464 | + ``` |
|
465 | + - view running iscsi session over ssh |
|
466 | + ``` |
|
467 | + ssh node05.internal.aws.testdrive.openshift.com sudo iscsiadm -m session |
|
468 | + ``` |
|
469 | +- exposed services |
|
470 | + - look at [3scale](#ref#16) for protection |
|
471 | + |
|
472 | + |
|
473 | + |
|
474 | +### oc commands |
|
475 | +| command | description | |
|
476 | +|--------------------------------------------------|-------------------------------------------------| |
|
477 | +| `oc login -u system:admin` | login to oshift | |
|
478 | +| `oc get nodes` | list of nodes | |
|
479 | +| `oc project <proj-name>` | change projects | |
|
480 | +| `oc describe statefulset prometheus | describe 'StatefulSet'* | |
|
481 | +| `oc describe daemonset prometheus-node-exporter` | ['node-exporter'](#ref#4) ['daemonset'](#ref#5) | |
|
482 | +| `oc get routes` | show routes | |
|
483 | +| `oc new-project <proj-name>` | create project | |
|
484 | +| `oc new-app docker.io/repo/image` | deploy app | |
|
485 | + |
|
486 | + |
|
487 | +*'StatefulSet' is a special kubernetes resource |
|
488 | + - deals with containers that have various startup and other dependencies |
|
489 | + - a daemonset is another special kubernetes resource. |
|
490 | + - it makes sure that specified containers are running on certain nodes |
|
491 | + |
|
492 | +- show pods |
|
493 | + ``` |
|
494 | + oc get pods |
|
495 | + ``` |
|
496 | +- pod information |
|
497 | + ``` |
|
498 | + oc describe pod <pod-name> |
|
499 | + ``` |
|
500 | +- show yaml output for pod |
|
501 | + ``` |
|
502 | + oc get pod <pod-name> -o yaml |
|
503 | + ``` |
|
504 | +- view pods on node |
|
505 | + ``` |
|
506 | + oc adm manage-node <node-name> --list-pods |
|
507 | + ``` |
|
508 | +- show services |
|
509 | + ``` |
|
510 | + oc get services |
|
511 | + ``` |
|
512 | +- service information |
|
513 | + ``` |
|
514 | + oc describe service <service-name> |
|
515 | + ``` |
|
516 | +- show yaml output for service |
|
517 | + ``` |
|
518 | + oc get service <service-name> -o yaml |
|
519 | + ``` |
|
520 | +- show deploymentconfig |
|
521 | + ``` |
|
522 | + oc get dc |
|
523 | + ``` |
|
524 | +- show replicationcontroller |
|
525 | + ``` |
|
526 | + oc get rc |
|
527 | + ``` |
|
528 | +- scale pods |
|
529 | + ``` |
|
530 | + oc scale --replicas=2 dc/<label> |
|
531 | + ``` |
|
532 | +- show endpoints for label |
|
533 | + ``` |
|
534 | + oc get endpoints <label> |
|
535 | + ``` |
|
536 | +- show router |
|
537 | + ``` |
|
538 | + oc describe dc router -n default |
|
539 | + ``` |
|
540 | +- set liveness probe |
|
541 | + ``` |
|
542 | + oc set probe dc/<label> --liveness --get-url=http://:8080/health --initial-delay-seconds=30 |
|
543 | + ``` |
|
544 | +- set readiness probe |
|
545 | + ``` |
|
546 | + oc set probe dc/<label> --readiness --get-url=http://:8080/health --initial-delay-seconds=30 |
|
547 | + ``` |
|
548 | +- log on to pod (remote shell) |
|
549 | + ``` |
|
550 | + oc rsh <pod-name> |
|
551 | + ``` |
|
552 | +- view default project request template |
|
553 | + ``` |
|
554 | + oc adm create-bootstrap-project-template |
|
555 | + ``` |
|
556 | +- create new default template |
|
557 | + ``` |
|
558 | + oc create -f /file/path/to/template.yaml -n default |
|
559 | + ``` |
|
560 | +- show quota for project |
|
561 | + ``` |
|
562 | + oc get quote -n <proj-name> |
|
563 | + ``` |
|
564 | +- show limitrange for project |
|
565 | + ``` |
|
566 | + oc get limitrange -n <proj-name> |
|
567 | + ``` |
|
568 | +- show groups (auth) |
|
569 | + ``` |
|
570 | + oc get groups |
|
571 | + ``` |
|
572 | +- execute `groupsync` |
|
573 | + ``` |
|
574 | + sudo oc adm groups sync --sync-config=/path/to/config.yaml --confirm |
|
575 | + ``` |
|
576 | +- show users |
|
577 | + ``` |
|
578 | + oc get user |
|
579 | + ``` |
|
580 | + - users created when first logged in |
|
581 | +- show nodes |
|
582 | + ``` |
|
583 | + oc get nodes |
|
584 | + ``` |
|
585 | +- view nodes by label (i.e. app nodes) |
|
586 | + ``` |
|
587 | + oc get nodes -l region=apps |
|
588 | + ``` |
|
589 | +- show storageclass |
|
590 | + ``` |
|
591 | + oc get sc |
|
592 | + ``` |
|
593 | +- show persistentvolumeclaim |
|
594 | + ``` |
|
595 | + oc get pvc |
|
596 | + ``` |
|
597 | +- show network namespaces |
|
598 | + ``` |
|
599 | + oc get netnamespaces |
|
600 | + ``` |
|
601 | +- |
|
602 | + |
|
603 | +## ref |
|
604 | +- :1: https://github.com/heketi/heketi |
|
605 | +- :2: https://docs.openshift.com/container-platform/3.9/install_config/install/advanced_install.html#configuring-ansible |
|
606 | +- :3: https://docs.openshift.com/container-platform/3.9/install_config/cluster_metrics.html#openshift-prometheus |
|
607 | +- :4: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/ |
|
608 | +- :5: https://docs.openshift.com/container-platform/3.9/dev_guide/daemonsets.html |
|
609 | +- :6: https://docs.openshift.com/container-platform/3.9/architecture/core_concepts/pods_and_services.html#services |
|
610 | +- :7: https://docs.openshift.com/container-platform/latest/dev_guide/application_health.html |
|
611 | +- :8: https://docs.openshift.com/container-platform/3.9/admin_guide/quota.html |
|
612 | +- :9: https://docs.openshift.com/container-platform/3.9/admin_guide/limits.html |
|
613 | +- :10: https://docs.openshift.com/container-platform/3.9/install_config/configuring_authentication.html#LDAPPasswordIdentityProvider |
|
614 | +- :11: https://docs.openshift.com/container-platform/3.9/admin_guide/manage_rbac.html#admin-guide-manage-rbac |
|
615 | +- :12: https://docs.openshift.com/container-platform/3.9/architecture/infrastructure_components/kubernetes_infrastructure.html#high-availability-masters |
|
616 | +- :13: http://www.hawkular.org/ |
|
617 | +- :14: https://docs.openshift.com/container-platform/3.9/architecture/networking/sdn.html |
|
618 | +- :15: https://docs.openshift.com/container-platform/3.9/admin_guide/managing_networking.html#admin-guide-networking-networkpolicy |
|
619 | +- :16: https://www.3scale.net/ |
technology/communication/ftp.md
... | ... | @@ -0,0 +1,12 @@ |
1 | +# ftp |
|
2 | + |
|
3 | +``` |
|
4 | +ftp ftp.pyratebeard.net |
|
5 | +ftp> ls |
|
6 | +ftp> cd funny/ |
|
7 | +ftp> get funny_image_01.png |
|
8 | +``` |
|
9 | + |
|
10 | +## guest login |
|
11 | +- username: anonymous |
|
12 | +- password: email |
technology/communication/mutt.md
... | ... | @@ -0,0 +1,8 @@ |
1 | +# mutt |
|
2 | + |
|
3 | +## regex |
|
4 | +[site{34}-]wug[@uat] |
|
5 | +[bB]ackup[bot, Report] |
|
6 | +wug@|@noreply |
|
7 | + |
|
8 | +[wWuUgG]@|@noreply|winbk01|ROS Health|Logwatch|[bB]ackup[bot, Report] |
technology/databases/mariadb.md
... | ... | @@ -0,0 +1,23 @@ |
1 | +# mariadb |
|
2 | +[knowledgebase](https://mariadb.com/kb/en/) |
|
3 | + |
|
4 | +```bash |
|
5 | +dnf install mariadb mariadb-server |
|
6 | +systemctl start mariadb.service |
|
7 | +/usr/bin/mysql_secure_installation |
|
8 | +mysql -u root -p |
|
9 | +``` |
|
10 | + |
|
11 | +```sql |
|
12 | +show databases; |
|
13 | +show tables; |
|
14 | +show columns from table; |
|
15 | +show columns from database.table; |
|
16 | +``` |
|
17 | + |
|
18 | +## user |
|
19 | +```sql |
|
20 | +select user from USER; |
|
21 | +create USER username; |
|
22 | +drop USER if exists username; |
|
23 | +``` |
technology/databases/oracle.md
... | ... | @@ -0,0 +1,11 @@ |
1 | +# oracle |
|
2 | + |
|
3 | +- show max number of connections allowed |
|
4 | +```sql |
|
5 | +select name,value from v$parameter where name = 'sessions'; |
|
6 | +``` |
|
7 | + |
|
8 | +- show current active connections |
|
9 | +```sql |
|
10 | +select count(*) from v$session; |
|
11 | +``` |
technology/encryption/gpg.md
... | ... | @@ -0,0 +1,22 @@ |
1 | +# gpg |
|
2 | + |
|
3 | +## encrypt file |
|
4 | +``` |
|
5 | +gpg -c <filename> |
|
6 | +``` |
|
7 | + |
|
8 | +## decrypt file |
|
9 | +``` |
|
10 | +gpg <filename>.gpg |
|
11 | +``` |
|
12 | + |
|
13 | +## clearsign message |
|
14 | +``` |
|
15 | +gpg --default-key <key_id> -o <output_file> --clearsign <input_file> |
|
16 | + |
|
17 | +## ref |
|
18 | +https://www.linuxbabe.com/security/verify-pgp-signature-software-downloads-linux |
|
19 | +https://unix.stackexchange.com/questions/288933/unable-to-verify-the-kernel-signature-gpg-cant-check-signature-public-key-no |
|
20 | + |
|
21 | +## red hat verify |
|
22 | +https://access.redhat.com/articles/3530471 |
technology/linux/archlinux/index.md
technology/linux/archlinux/pacman.md
... | ... | @@ -0,0 +1,7 @@ |
1 | +# pacman |
|
2 | + |
|
3 | +## find package which contains $filename |
|
4 | +``` |
|
5 | +pacman -Fy |
|
6 | +pacman -Fs $filename |
|
7 | +``` |
technology/linux/audio_visual/index.md
... | ... | @@ -0,0 +1,4 @@ |
1 | +# audio_visual |
|
2 | + |
|
3 | +- [mpd](mpd) |
|
4 | +- [mpv](mpv) |
technology/linux/audio_visual/mpd.md
... | ... | @@ -0,0 +1,5 @@ |
1 | +# mpd |
|
2 | + |
|
3 | +## radio playlist sites |
|
4 | +https://www.radionomy.com/ |
|
5 | +http://www.radiosure.com/stations/ |
technology/linux/audio_visual/mpv.md
... | ... | @@ -0,0 +1,5 @@ |
1 | +# mpv |
|
2 | + |
|
3 | +```zsh |
|
4 | +mpv --video-unscaled=no --geometry=579x326+98%+2% --ontop |
|
5 | +``` |
technology/linux/debian/apt_dpkg.md
... | ... | @@ -0,0 +1,9 @@ |
1 | +# apt / dpkg |
|
2 | + |
|
3 | +- if error code (1) on `apt-get upgrade` [ref_1](#ref#1) |
|
4 | + ``` |
|
5 | + sudo dpkg --configure -a |
|
6 | + ``` |
|
7 | + |
|
8 | +## ref |
|
9 | +- :1: https://itsfoss.com/dpkg-returned-an-error-code-1/ |
technology/linux/debian/index.md
technology/linux/general/bash.md
... | ... | @@ -0,0 +1,27 @@ |
1 | +# bash |
|
2 | + |
|
3 | +use parameter of previous command ([ref 1](#ref#1)) |
|
4 | +``` |
|
5 | +mkdir test |
|
6 | +cd $_ |
|
7 | +``` |
|
8 | +or |
|
9 | +``` |
|
10 | +mkdir test |
|
11 | +cd !$ |
|
12 | +``` |
|
13 | + |
|
14 | +## `find` examples |
|
15 | +``` |
|
16 | +find . -type f -iname "*regex*" -exec rm -f {} \; |
|
17 | +``` |
|
18 | + |
|
19 | +## when was user created [ref_2](#ref#2) |
|
20 | +- if user has never logged in after account creation |
|
21 | + ``` |
|
22 | + ls -l /home/<user>/.bash_logout |
|
23 | + ``` |
|
24 | + |
|
25 | +## ref |
|
26 | +- :1: https://unix.stackexchange.com/questions/125385/combined-mkdir-and-cd |
|
27 | +- :2: https://it.toolbox.com/question/how-to-find-out-when-a-user-is-created-in-linux-030612 |
technology/linux/general/bin.md
... | ... | @@ -0,0 +1,14 @@ |
1 | + |
|
2 | + |
|
3 | + /bin (and /sbin) were intended for programs that needed to be on a small / partition before the larger /usr, etc. partitions were mounted. These days, it mostly serves as a standard location for key programs like /bin/sh, although the original intent may still be relevant for e.g. installations on small embedded devices. |
|
4 | + |
|
5 | + /sbin, as distinct from /bin, is for system management programs (not normally used by ordinary users) needed before /usr is mounted. |
|
6 | + |
|
7 | + /usr/bin is for distribution-managed normal user programs. |
|
8 | + |
|
9 | + There is a /usr/sbin with the same relationship to /usr/bin as /sbin has to /bin. |
|
10 | + |
|
11 | + /usr/local/bin is for normal user programs not managed by the distribution package manager, e.g. locally compiled packages. You should not install them into /usr/bin because future distribution upgrades may modify or delete them without warning. |
|
12 | + |
|
13 | + /usr/local/sbin, as you can probably guess at this point, is to /usr/local/bin as /usr/sbin to /usr/bin. |
|
14 | + |
technology/linux/general/dmidecode.md
... | ... | @@ -0,0 +1,9 @@ |
1 | +# dmidecode |
|
2 | + |
|
3 | +## how many pci slots (ref_1)[#ref#1] |
|
4 | +``` |
|
5 | +dmidecode -t 9 | grep "System Slot Information" | wc -l |
|
6 | +``` |
|
7 | + |
|
8 | +## ref |
|
9 | +- :1: https://unix.stackexchange.com/questions/191314/can-i-see-the-number-of-pci-slots-with-a-command |
technology/linux/general/i3lock.md
... | ... | @@ -0,0 +1,9 @@ |
1 | +# i3lock |
|
2 | + |
|
3 | +lockscreen commands (https://www.reddit.com/r/unixporn/comments/8z15f9/i3lock_with_pixeleffect/) |
|
4 | + |
|
5 | +```zsh |
|
6 | +ICON="/home/pyratebeard/tmp/stop2.png" ; TMPBG="/tmp/lockscreen.jpg" ; RES=$(xrandr | grep 'current' | sed -E 's/.*current\s([0-9]+)\sx\s([0-9]+).*/\1x\2/') ; ffmpeg -f x11grab-video_size $RES -y -i $DISPLAY -vf frei0r=pixeliz0r=0.02:0.02 -vframes 1 $TMPBG -loglevel quiet |
|
7 | +ICON="/home/pyratebeard/tmp/stop2.png" ; TMPBG="/tmp/lockscreen.jpg" ; RES=$(xrandr | grep 'current' | sed -E 's/.*current\s([0-9]+)\sx\s([0-9]+).*/\1x\2/') ; ffmpeg -f x11grab -video_size $RES -y -i $DISPLAY -i $ICON -filter_complex "boxblur=5:1,overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -vframes 1 $TMPBG -loglevel quiet |
|
8 | +/home/pyratebeard/src/warez/i3lock-fancy-multimonitor/lock -p |
|
9 | +``` |
technology/linux/general/index.md
... | ... | @@ -0,0 +1,15 @@ |
1 | +# linux general |
|
2 | + |
|
3 | +- [bash](bash) |
|
4 | +- [bin](bin) |
|
5 | +- [dmidecode](dmidecode) |
|
6 | +- [i3lock](i3lock) |
|
7 | +- [journalctl](journalctl) |
|
8 | +- [man_pages](man_pages) |
|
9 | +- [mpd](mpd) |
|
10 | +- [mpv](mpv) |
|
11 | +- [rtv](rtv) |
|
12 | +- [ssh](ssh) |
|
13 | +- [systemctl](systemctl) |
|
14 | +- [xclip](xclip) |
|
15 | +- [xdotool](xdotool) |
technology/linux/general/journalctl.md
... | ... | @@ -0,0 +1,19 @@ |
1 | +# journalctl |
|
2 | + |
|
3 | +https://www.loggly.com/ultimate-guide/using-journalctl/ |
|
4 | +https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs |
|
5 | + |
|
6 | +search by user |
|
7 | +``` |
|
8 | +journalctl _UID=<uid> |
|
9 | +``` |
|
10 | + |
|
11 | +search by command |
|
12 | +``` |
|
13 | +journalctl /usr/bin/sudo |
|
14 | +journalctl $(which sudo) |
|
15 | +journalctl -t sudo |
|
16 | +``` |
|
17 | + `-t` show syslog identifier |
|
18 | + |
|
19 | + [systemctl](systemctl) |
technology/linux/general/man_pages.md
... | ... | @@ -0,0 +1,31 @@ |
1 | +# man pages |
|
2 | + |
|
3 | +## sections |
|
4 | + |
|
5 | +taken from `man man`: |
|
6 | +``` |
|
7 | +MANUAL SECTIONS |
|
8 | + The standard sections of the manual include: |
|
9 | + |
|
10 | + 1 User Commands |
|
11 | + 2 System Calls |
|
12 | + 3 C Library Functions |
|
13 | + 4 Devices and Special Files |
|
14 | + 5 File Formats and Conventions |
|
15 | + 6 Games et. al. |
|
16 | + 7 Miscellanea |
|
17 | + 8 System Administration tools and Daemons |
|
18 | +``` |
|
19 | +[unix stackexchange](https://unix.stackexchange.com/questions/3586/what-do-the-numbers-in-a-man-page-mean) |
|
20 | + |
|
21 | +## searching |
|
22 | +[cyberciti.biz](https://www.cyberciti.biz/faq/howto-search-all-the-linux-unix-man-pages/) |
|
23 | + |
|
24 | +`apropos` command |
|
25 | + |
|
26 | +```bash |
|
27 | +apropos "term" |
|
28 | +apropos -s 1 "term" |
|
29 | +``` |
|
30 | + |
|
31 | +`-s` indicates search only specific section |
technology/linux/general/rtv.md
... | ... | @@ -0,0 +1,4 @@ |
1 | +# rtv |
|
2 | + |
|
3 | +rtv --enable-media (to use mailcap, although it seems to default) |
|
4 | +export RTV_BROWSER=qutebrowser |
technology/linux/general/ssh.md
... | ... | @@ -0,0 +1,20 @@ |
1 | +# ssh |
|
2 | + |
|
3 | +- tunnel through jump server [ref_2](#ref#2) |
|
4 | + ``` |
|
5 | + ssh -t L7070:localhost:7071 user@jumphost ssh -t -D7071 user@furtherhost |
|
6 | + ``` |
|
7 | + ``` |
|
8 | + ssh -A -t -l user jump-host \ |
|
9 | + -L 8080:localhost:8080 \ |
|
10 | + ssh -A -t -l user webserver.dmz \ |
|
11 | + -L 8080:localhost:8080 |
|
12 | + ``` |
|
13 | +- mordhaus tunnel command |
|
14 | + ``` |
|
15 | + ssh -4 -A -t -ldburrows -D7070 kali ssh -4 -A -t -lpyratebeard -p22666 -D7070 powerzonemetal.uk |
|
16 | + ``` |
|
17 | + |
|
18 | +## ref |
|
19 | +- :1: http://lackof.org/taggart/hacking/ssh/ |
|
20 | +- :2: http://digitalcrunch.com/linux/how-to-use-an-ssh-tunnel-through-a-jump-host/ |
technology/linux/general/systemctl.md
... | ... | @@ -0,0 +1,21 @@ |
1 | +# systemctl |
|
2 | + |
|
3 | +```bash |
|
4 | +systemctl list-units [ --all | --type=service ] |
|
5 | +``` |
|
6 | + |
|
7 | +- show all enabled and disabled services |
|
8 | +```bash |
|
9 | +systemctl list-unit-files |
|
10 | +``` |
|
11 | + |
|
12 | +## create service file |
|
13 | +``` |
|
14 | +vi /etc/systemd/system/<name>.service |
|
15 | +``` |
|
16 | + |
|
17 | +[journalctl](journalctl) |
|
18 | + |
|
19 | +## ref |
|
20 | +- :1: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units |
|
21 | +- https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units |
technology/linux/general/xclip.md
... | ... | @@ -0,0 +1,7 @@ |
1 | +# xclip |
|
2 | + |
|
3 | +## copy image to clipboard |
|
4 | +```bash |
|
5 | +xclip -selection clipboard -t image/png -i <image>.png |
|
6 | +``` |
|
7 | +use `image/jpeg` or `image/jpg` for jpeg |
technology/linux/general/xdotool.md
... | ... | @@ -0,0 +1,6 @@ |
1 | +# xdotool |
|
2 | + |
|
3 | +## turn of capslock |
|
4 | +``` |
|
5 | +xdotool key Caps_Lock |
|
6 | +``` |
technology/linux/redhat/index.md
technology/linux/redhat/rpm.md
... | ... | @@ -0,0 +1,76 @@ |
1 | +# rpm |
|
2 | + |
|
3 | +## how to build rpm videos |
|
4 | +- [urban pengiun](#ref#3) |
|
5 | + - distributing new repo file |
|
6 | + - create new 'build' account |
|
7 | + - run `rpmdev-setuptree` |
|
8 | + - creates 'rpmbuild' dir structure |
|
9 | + - create SOURCES dir structure |
|
10 | + ``` |
|
11 | + cd ~/rpmbuild/SOURCES/ |
|
12 | + mkdir tuprepo-1/etc/yum.repos.d |
|
13 | + ``` |
|
14 | + *'tuprepo-1' is name and version number* |
|
15 | + - copy across repo file |
|
16 | + ``` |
|
17 | + cp /tmp/CentOS-Tup.repo !$ |
|
18 | + ``` |
|
19 | + *use '!$' for last arg* |
|
20 | + - tar zip dir |
|
21 | + ``` |
|
22 | + tar -cvzf tuprepo-1.tar.gz tuprepo-1/ |
|
23 | + ``` |
|
24 | + - create spec file |
|
25 | + ``` |
|
26 | + cd ../SPECS/ |
|
27 | + rpmdev-newspec tuprepo.spec |
|
28 | + vi tuprepo.spec |
|
29 | + ``` |
|
30 | + - spec file details |
|
31 | + ``` |
|
32 | + Name: qradar_bak |
|
33 | + Version: 1 |
|
34 | + Release: 1%{?dist} |
|
35 | + Summary: Pull backup data and configuration files for QRadar |
|
36 | + |
|
37 | + License: GPL |
|
38 | + URL: https://www.ward.ie |
|
39 | + Source0: qradar_bak-1.tgz |
|
40 | + |
|
41 | + BuildRoot: %{_tmppath}/%{name}-buildroot |
|
42 | + |
|
43 | + %description |
|
44 | + Pull nightly data backups and weekly configuration files from QRadar master. |
|
45 | + Clean up is carried out weekly |
|
46 | + |
|
47 | + |
|
48 | + %prep |
|
49 | + %autosetup |
|
50 | + |
|
51 | + %install |
|
52 | + mkdir -p "$RPM_BUILD_ROOT" |
|
53 | + cp -R * "$RPM_BUILD_ROOT" |
|
54 | + |
|
55 | + %clean |
|
56 | + rm -rf "$RPM_BUILD_ROOT" |
|
57 | + |
|
58 | + %files |
|
59 | + %defattr(-,root,root,-) |
|
60 | + /usr/local/bin/backup_pull |
|
61 | + /usr/local/bin/cleanup |
|
62 | + /usr/local/etc/config |
|
63 | + |
|
64 | + %changelog |
|
65 | + * Mon Oct 22 2018 rpmbuild |
|
66 | + ``` |
|
67 | + - build rpm |
|
68 | + ``` |
|
69 | + cd $HOME |
|
70 | + rpmbuild -v -bb rpmbuild/SPECS/tuprepo.spec |
|
71 | + ``` |
|
72 | + |
|
73 | +## ref |
|
74 | +- :1: https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/index.html |
|
75 | +- :2: https://rpm-packaging-guide.github.io/ |
|
76 | +- :3: https://www.youtube.com/watch?v=364Plv6zuBU |
technology/monitoring/snmpwalk.md
... | ... | @@ -0,0 +1,5 @@ |
1 | +# snmpwalk |
|
2 | + |
|
3 | +``` |
|
4 | +snmpwalk -Os -c public -v 1 localhost system |
|
5 | +``` |
technology/networking/index.md
... | ... | @@ -0,0 +1,3 @@ |
1 | +# networks |
|
2 | + |
|
3 | +- [subnet_cheatsheet](subnet_cheatsheet) |
technology/networking/subnet_cheatsheet.md
... | ... | @@ -0,0 +1,247 @@ |
1 | +# subnet cheatsheet |
|
2 | + |
|
3 | +https://oav.net/mirrors/cidr.html |
|
4 | + |
|
5 | +Netmask Netmask (binary) CIDR Notes |
|
6 | +_____________________________________________________________________________ |
|
7 | +255.255.255.255 11111111.11111111.11111111.11111111 /32 Host (single addr) |
|
8 | +255.255.255.254 11111111.11111111.11111111.11111110 /31 Unuseable |
|
9 | +255.255.255.252 11111111.11111111.11111111.11111100 /30 2 useable |
|
10 | +255.255.255.248 11111111.11111111.11111111.11111000 /29 6 useable |
|
11 | +255.255.255.240 11111111.11111111.11111111.11110000 /28 14 useable |
|
12 | +255.255.255.224 11111111.11111111.11111111.11100000 /27 30 useable |
|
13 | +255.255.255.192 11111111.11111111.11111111.11000000 /26 62 useable |
|
14 | +255.255.255.128 11111111.11111111.11111111.10000000 /25 126 useable |
|
15 | +255.255.255.0 11111111.11111111.11111111.00000000 /24 "Class C" 254 useable |
|
16 | + |
|
17 | +255.255.254.0 11111111.11111111.11111110.00000000 /23 2 Class C's |
|
18 | +255.255.252.0 11111111.11111111.11111100.00000000 /22 4 Class C's |
|
19 | +255.255.248.0 11111111.11111111.11111000.00000000 /21 8 Class C's |
|
20 | +255.255.240.0 11111111.11111111.11110000.00000000 /20 16 Class C's |
|
21 | +255.255.224.0 11111111.11111111.11100000.00000000 /19 32 Class C's |
|
22 | +255.255.192.0 11111111.11111111.11000000.00000000 /18 64 Class C's |
|
23 | +255.255.128.0 11111111.11111111.10000000.00000000 /17 128 Class C's |
|
24 | +255.255.0.0 11111111.11111111.00000000.00000000 /16 "Class B" |
|
25 | + |
|
26 | +255.254.0.0 11111111.11111110.00000000.00000000 /15 2 Class B's |
|
27 | +255.252.0.0 11111111.11111100.00000000.00000000 /14 4 Class B's |
|
28 | +255.248.0.0 11111111.11111000.00000000.00000000 /13 8 Class B's |
|
29 | +255.240.0.0 11111111.11110000.00000000.00000000 /12 16 Class B's |
|
30 | +255.224.0.0 11111111.11100000.00000000.00000000 /11 32 Class B's |
|
31 | +255.192.0.0 11111111.11000000.00000000.00000000 /10 64 Class B's |
|
32 | +255.128.0.0 11111111.10000000.00000000.00000000 /9 128 Class B's |
|
33 | +255.0.0.0 11111111.00000000.00000000.00000000 /8 "Class A" |
|
34 | + |
|
35 | +254.0.0.0 11111110.00000000.00000000.00000000 /7 |
|
36 | +252.0.0.0 11111100.00000000.00000000.00000000 /6 |
|
37 | +248.0.0.0 11111000.00000000.00000000.00000000 /5 |
|
38 | +240.0.0.0 11110000.00000000.00000000.00000000 /4 |
|
39 | +224.0.0.0 11100000.00000000.00000000.00000000 /3 |
|
40 | +192.0.0.0 11000000.00000000.00000000.00000000 /2 |
|
41 | +128.0.0.0 10000000.00000000.00000000.00000000 /1 |
|
42 | +0.0.0.0 00000000.00000000.00000000.00000000 /0 IP space |
|
43 | + |
|
44 | + Net Host Total |
|
45 | +Net Addr Addr Addr Number |
|
46 | +Class Range NetMask Bits Bits of hosts |
|
47 | +---------------------------------------------------------- |
|
48 | +A 0-127 255.0.0.0 8 24 16777216 (i.e. 114.0.0.0) |
|
49 | +B 128-191 255.255.0.0 16 16 65536 (i.e. 150.0.0.0) |
|
50 | +C 192-254 255.255.255.0 24 8 256 (i.e. 199.0.0.0) |
|
51 | +D 224-239 (multicast) |
|
52 | +E 240-255 (reserved) |
|
53 | +F 208-215 255.255.255.240 28 4 16 |
|
54 | +G 216/8 ARIN - North America |
|
55 | +G 217/8 RIPE NCC - Europe |
|
56 | +G 218-219/8 APNIC |
|
57 | +H 220-221 255.255.255.248 29 3 8 (reserved) |
|
58 | +K 222-223 255.255.255.254 31 1 2 (reserved) |
|
59 | +(ref: RFC1375 & http://www.iana.org/assignments/ipv4-address-space ) |
|
60 | +( http://www.iana.org/numbers.htm ) |
|
61 | +---------------------------------------------------------- |
|
62 | + |
|
63 | +The current list of special use prefixes: |
|
64 | + 0.0.0.0/8 |
|
65 | + 127.0.0.0/8 |
|
66 | + 192.0.2.0/24 |
|
67 | + 10.0.0.0/8 |
|
68 | + 172.16.0.0/12 |
|
69 | + 192.168.0.0/16 |
|
70 | + 169.254.0.0/16 |
|
71 | + all D/E space |
|
72 | +(ref: RFC1918 http://www.rfc-editor.org/rfc/rfc1918.txt ) |
|
73 | +( or ftp://ftp.isi.edu/in-notes/rfc1918.txt ) |
|
74 | +(rfc search: http://www.rfc-editor.org/rfcsearch.html ) |
|
75 | +( http://www.ietf.org/ietf/1id-abstracts.txt ) |
|
76 | +( http://www.ietf.org/shadow.html ) |
|
77 | + |
|
78 | + |
|
79 | +Martians: (updates at: www.iana.org/assignments/ipv4-address-space ) |
|
80 | + no ip source-route |
|
81 | + access-list 100 deny ip host 0.0.0.0 any |
|
82 | + deny ip 0.0.0.0 0.255.255.255 any log ! antispoof |
|
83 | + deny ip 0.0.0.0 0.255.255.255 0.0.0.0 255.255.255.255 ! antispoof |
|
84 | + deny ip any 255.255.255.128 0.0.0.127 ! antispoof |
|
85 | + deny ip host 0.0.0.0 any log ! antispoof |
|
86 | + deny ip host [router intf] [router intf] ! antispoof |
|
87 | + deny ip xxx.xxx.xxx.0 0.0.0.255 any log ! lan area |
|
88 | + deny ip 0/8 0.255.255.255 any log ! IANA - Reserved |
|
89 | + deny ip 1/8 0.255.255.255 any log ! IANA - Reserved |
|
90 | + deny ip 2/8 0.255.255.255 any log ! IANA - Reserved |
|
91 | + deny ip 5/8 0.255.255.255 any log ! IANA - Reserved |
|
92 | + deny ip 7/8 0.255.255.255 any log ! IANA - Reserved |
|
93 | + deny ip 10.0.0.0 0.255.255.255 any log ! IANA - Private Use |
|
94 | + deny ip 23/8 0.255.255.255 any log ! IANA - Reserved |
|
95 | + deny ip 27/8 0.255.255.255 any log ! IANA - Reserved |
|
96 | + deny ip 31/8 0.255.255.255 any log ! IANA - Reserved |
|
97 | + deny ip 36-37/8 0.255.255.255 any log ! IANA - Reserved |
|
98 | + deny ip 39/8 0.255.255.255 any log ! IANA - Reserved |
|
99 | + deny ip 41-42/8 0.255.255.255 any log ! IANA - Reserved |
|
100 | + deny ip 50/8 0.255.255.255 any log ! IANA - Reserved |
|
101 | + deny ip 58-60/8 0.255.255.255 any log ! IANA - Reserved |
|
102 | + deny ip 69-79/8 0.255.255.255 any log ! IANA - Reserved |
|
103 | + deny ip 82-95/8 0.255.255.255 any log ! IANA - Reserved |
|
104 | + deny ip 96-126/8 0.255.255.255 any log ! IANA - Reserved |
|
105 | + deny ip 127/8 0.255.255.255 any log ! IANA - Reserved |
|
106 | + deny ip 169.254.0.0 0.0.255.255 any log ! link-local network |
|
107 | + deny ip 172.16.0.0 0.15.255.255 any log ! reserved |
|
108 | + deny ip 192.168.0.0 0.0.255.255 any log ! reserved |
|
109 | + deny ip 192.0.2.0 0.0.0.255 any log ! test network |
|
110 | + deny ip 197/8 0.255.255.255 any log ! IANA - Reserved |
|
111 | + deny ip 220/8 0.255.255.255 any log ! IANA - Reserved |
|
112 | + deny ip 222-223/8 0.255.255.255 any log ! IANA - Reserved |
|
113 | + deny ip 224.0.0.0 31.255.255.255 any log ! multicast |
|
114 | + deny ip 224.0.0.0 15.255.255.255 any log ! unless MBGP-learned routes |
|
115 | + deny ip 224-239/8 0.255.255.255 any log ! IANA - Multicast |
|
116 | + deny ip 240-255/8 0.255.255.255 any log ! IANA - Reserved |
|
117 | + |
|
118 | +filtered source addresses |
|
119 | + 0/8 ! broadcast |
|
120 | + 10/8 ! RFC 1918 private |
|
121 | + 127/8 ! loopback |
|
122 | + 169.254.0/16 ! link local |
|
123 | + 172.16.0.0/12 ! RFC 1918 private |
|
124 | + 192.0.2.0/24 ! TEST-NET |
|
125 | + 192.168.0/16 ! RFC 1918 private |
|
126 | + 224.0.0.0/4 ! class D multicast |
|
127 | + 240.0.0.0/5 ! class E reserved |
|
128 | + 248.0.0.0/5 ! reserved |
|
129 | + 255.255.255.255/32 ! broadcast |
|
130 | + |
|
131 | +ARIN administrated blocks: (http://www.arin.net/regserv/IPStats.html) |
|
132 | + 24.0.0.0/8 (portions of) |
|
133 | + 63.0.0.0/8 |
|
134 | + 64.0.0.0/8 |
|
135 | + 65.0.0.0/8 |
|
136 | + 66.0.0.0/8 |
|
137 | + 196.0.0.0/8 |
|
138 | + 198.0.0.0/8 |
|
139 | + 199.0.0.0/8 |
|
140 | + 200.0.0.0/8 |
|
141 | + 204.0.0.0/8 |
|
142 | + 205.0.0.0/8 |
|
143 | + 206.0.0.0/8 |
|
144 | + 207.0.0.0/8 |
|
145 | + 208.0.0.0/8 |
|
146 | + 209.0.0.0/8 |
|
147 | + 216.0.0.0/8 |
|
148 | +---------------------------------------------------------- |
|
149 | + |
|
150 | +well known ports: (rfc1700.txt) |
|
151 | + www.iana.org/assignments/port-numbers |
|
152 | + |
|
153 | +protocol numbers: |
|
154 | + www.iana.org/assignments/protocol-numbers |
|
155 | + www.iana.org/numbers.htm |
|
156 | + |
|
157 | +ICMP(Types/Codes) |
|
158 | + Testing Destination Reachability & Status |
|
159 | + (0/0) Echo-Reply |
|
160 | + (8/0) Echo |
|
161 | + Unreachable Destinations |
|
162 | + (3/0) Network Unreachable |
|
163 | + (3/1) Host Unreachable |
|
164 | + (3/2) Protocol Unreachable |
|
165 | + (3/3) Port Unreachable |
|
166 | + (3/4) Fragmentaion Needed and DF set (Pkt too big) |
|
167 | + (3/5) Source Route Failed |
|
168 | + (3/6) Network Unknown |
|
169 | + (3/7) Host Unknown |
|
170 | + (3/9) DOD Net Prohibited |
|
171 | + (3/10) DOD Host Prohibited |
|
172 | + (3/11) Net TOS Unreachable |
|
173 | + (3/12) Host TOS Unreachable |
|
174 | + (3/13) Administratively Prohibited |
|
175 | + (3/14) Host Precedence Unreachable |
|
176 | + (3/15) Precedence Unreachable |
|
177 | + Flow Control |
|
178 | + (4/0) Source-Quench [RFC 1016] |
|
179 | + Route Change Requests from Gateways |
|
180 | + (5/0) Redirect Datagrams for the Net |
|
181 | + (5/1) Redirect Datagrams for the Host |
|
182 | + (5/2) Redirect Datagrams for the TOS and Net |
|
183 | + (5/3) Redirect Datagrams for the TOS and Host |
|
184 | + Router |
|
185 | + (6/-) Alternate-Address |
|
186 | + (9/0) Router-Advertisement |
|
187 | + (10/0) Router-Solicitation |
|
188 | + Detecting Circular or Excessively Long Routes |
|
189 | + (11/0) Time to Live Count Exceeded |
|
190 | + (11/1) Fragment Reassembly Time Exceeded |
|
191 | + Reporting Incorrect Datagram Headers |
|
192 | + (12/0) Parameter-Problem |
|
193 | + (12/1) Option Missing |
|
194 | + (12/2) No Room for Option |
|
195 | + Clock Synchronization and Transit Time Estimation |
|
196 | + (13/0) Timestamp-Request |
|
197 | + (14/0) Timestamp-Reply |
|
198 | + Obtaining a Network Address (RARP Alternative) |
|
199 | + (15/0) Information-Request |
|
200 | + (16/0) Information-Reply |
|
201 | + Obtaining a Subnet Mask [RFC 950] |
|
202 | + (17/0) Address Mask-Request |
|
203 | + (18/0) Address Mask-Reply |
|
204 | + Other |
|
205 | + (30/0) Traceroute |
|
206 | + (31/0) Conversion-Error |
|
207 | + (32/0) Mobile-Redirect |
|
208 | + |
|
209 | +Ref: [RFC 792] [RFC 896] [RFC 950] [RFC 1016] |
|
210 | + www.cisco.com/univercd/cc/td/doc/product/lan/cat6000/sw_5_3/cofigide/qos.htm#19774 |
|
211 | + |
|
212 | + |
|
213 | + |
|
214 | +Decimal system Prefix's |
|
215 | + Factor Exponent Prefix |
|
216 | +--------------------------------------------------- |
|
217 | + 1 000 000 000 000 000 000 000 000...10^24....yotta |
|
218 | + 1 000 000 000 000 000 000 000...10^21....zetta |
|
219 | + 1 000 000 000 000 000 000...10^18....exa |
|
220 | + 1 000 000 000 000 000...10^15....peta |
|
221 | + 1 000 000 000 000...10^12....tera |
|
222 | + 1 000 000 000...10^9.....giga |
|
223 | + 1 000 000...10^6.....mega |
|
224 | + 1 000...10^3.....kilo |
|
225 | + 100...10^2.....hecto |
|
226 | + 10...10^1.....deka |
|
227 | + 0.1...10^-1....deci |
|
228 | + 0.01...10^-2....centi |
|
229 | + 0.001...10^-3....milli |
|
230 | + 0.000 001...10^-6....micro |
|
231 | + 0.000 000 001...10^-9....nano |
|
232 | + 0.000 000 000 001...10^-12...pico |
|
233 | + 0.000 000 000 000 001...10^-15...femto |
|
234 | + 0.000 000 000 000 000 001...10^-18...atto |
|
235 | + 0.000 000 000 000 000 000 001...10^-21...zepto |
|
236 | + 0.000 000 000 000 000 000 000 001...10^-24...yocto |
|
237 | +--------------------------------------------------- |
|
238 | + |
|
239 | +Convert Fahrenheit <> Celsius: |
|
240 | + Celsius = (Fahrenheit - 32) / 1.8 |
|
241 | + Fahrenheit = (Celsius * 1.8) + 32 |
|
242 | + |
|
243 | + |
|
244 | +last updated: 4jul02 |
|
245 | + |
|
246 | + |
|
247 | + |
technology/networking/wifi_connect.md
... | ... | @@ -0,0 +1,10 @@ |
1 | + |
|
2 | +``` |
|
3 | +ip link show wlp2s0 |
|
4 | +ip link set wlp2s0 up |
|
5 | +iw wlp2s0 link |
|
6 | +sudo iw wlp2s0 scan | grep -i ssid |
|
7 | +ps -ef | grep wpa_supplicant |
|
8 | +sudo kill -9 <pid> |
|
9 | +connect lib/doc/wifi/home ; sudo dhclient wlp2s0 |
|
10 | +``` |
technology/virtualisation/esxi.md
... | ... | @@ -0,0 +1,61 @@ |
1 | +# esxi |
|
2 | + |
|
3 | +## list vms |
|
4 | +``` |
|
5 | +esxcli vm process list |
|
6 | +``` |
|
7 | + |
|
8 | +``` |
|
9 | +vim-cmd vmsvc/getallvms |
|
10 | +``` |
|
11 | + |
|
12 | +## create vm |
|
13 | +[steps taken from here](#ref#2) |
|
14 | + |
|
15 | +1. create vm folder |
|
16 | + ``` |
|
17 | + mkdir /vmfs/volumes/datastore1/hostname/ |
|
18 | + ``` |
|
19 | + |
|
20 | +2. create hard disk |
|
21 | + ``` |
|
22 | + vmkfstools -c 32G -a lsilogic hostname.vmdk |
|
23 | + ``` |
|
24 | + * `-c` - createvirtualdisk |
|
25 | + * `-a` - adaptertype [buslogic|lsilogic|ide|lsisas|pvscsi] |
|
26 | + * `-d` - diskformat [zeroedthick|thin|eagerzeroedthick] |
|
27 | + |
|
28 | +3. create hostname.vmx file with following ([ref 3](#ref#3) for info on vmx files) |
|
29 | + ``` |
|
30 | + config.version = "8" |
|
31 | + virtualHW.version= "7" |
|
32 | + guestOS = "winnetenterprise-64" |
|
33 | + memsize = "1024" |
|
34 | + displayname = "VirtualCenter" |
|
35 | + scsi0.present = "TRUE" |
|
36 | + scsi0.virtualDev = "lsilogic" |
|
37 | + scsi0:0.present = "TRUE" |
|
38 | + scsi0:0.fileName = "VirtualCenter.vmdk" |
|
39 | + ide1:0.present = "true" |
|
40 | + ide1:0.deviceType = "cdrom-image" |
|
41 | + ide1:0.filename = "/vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/win2k3_x64.iso" |
|
42 | + ide1:0.startConnected = "TRUE" |
|
43 | + ethernet0.present= "true" |
|
44 | + ethernet0.startConnected = "true" |
|
45 | + ethernet0.virtualDev = "e1000" |
|
46 | + ``` |
|
47 | + |
|
48 | +4. change permissions on vmx file |
|
49 | + ``` |
|
50 | + chmod 744 hostname.vmx |
|
51 | + ``` |
|
52 | + |
|
53 | +5. add vm to inventory |
|
54 | + ``` |
|
55 | + vim-cmd solo/registervm /vmfs/volumes/datastore/hostname/hostname.vmx hostname |
|
56 | + ``` |
|
57 | + |
|
58 | +## ref |
|
59 | +- :1: https://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.vsphere.solutions.doc%2FGUID-0A264828-3933-4F4F-82D7-B5006A90CDBA.html |
|
60 | +- :2: http://vm-help.com/esx40i/manage_without_VI_client_1.php |
|
61 | +- :3: http://sanbarrow.com/vmx.html |