├── README.md ├── Shell_Script_Guide ├── exercises │ ├── output.txt │ ├── exercise_no1.sh │ ├── exercise_no3.sh │ └── exercise_no2.sh ├── examples │ ├── Eg3.sh │ ├── Eg9.sh │ ├── Eg8.sh │ ├── Output.txt │ ├── Eg11.sh │ ├── Eg4.sh │ ├── Eg6.sh │ ├── Eg21.sh │ ├── Eg5.sh │ ├── Eg7.sh │ ├── Eg16.sh │ ├── Eg22.sh │ ├── Eg23.sh │ ├── Eg15.sh │ ├── Eg24.sh │ ├── Eg1.sh │ ├── Eg19.sh │ ├── Eg2.sh │ ├── Eg10.sh │ ├── Eg18.sh │ ├── Eg12.sh │ ├── output_Eg24.txt │ ├── Eg13.sh │ ├── Eg20.sh │ ├── Eg25.sh │ ├── Eg14.sh │ └── Eg17.sh ├── .2id.sh.swp ├── LinuxFlavours.txt ├── continents.txt ├── UserStat.txt ├── EmailStat.csv ├── UserSalary.txt ├── shellwhile.sh ├── FileName.txt └── Scripting_Guide.md ├── OpenLDAP ├── Config_Files │ ├── ldapmodify │ │ ├── delete.ldif │ │ ├── add.ldif │ │ └── modify.ldif │ ├── DIT_Strcture_1 │ │ ├── ROOT_dc │ │ ├── Directory_Strcture │ │ ├── OU_System_Members │ │ ├── Users │ │ └── Users_1 │ ├── DIT_Strcture_2 │ │ ├── ROOT_dc │ │ ├── Directory_Strcture │ │ └── Users │ ├── acl │ ├── ldap.conf │ ├── slapd.conf │ └── LDAP_Commands └── Install │ ├── .How_to_install.txt.swp │ └── How_to_install.txt ├── .gitignore ├── issue_template.md ├── pull_request_template.md └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # Linux-training 2 | Host Linux Training public documents 3 | -------------------------------------------------------------------------------- /Shell_Script_Guide/exercises/output.txt: -------------------------------------------------------------------------------- 1 | sam 2 | Jeff 3 | Tom 4 | Simon 5 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat ../FileName.txt 3 | 4 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg9.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | wc -l < ../FileName.txt 3 | 4 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg8.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ls -ltr > Directory_list.txt 3 | 4 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Output.txt: -------------------------------------------------------------------------------- 1 | print first sentence 2 | print second sentence 3 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg11.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat ../FileName.txt | grep -v "GPL" 3 | 4 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat ../FileName.txt | grep "Ubuntu" 3 | 4 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg6.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat ../FileName.txt | grep -v "GPL" 3 | 4 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg21.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat ../UserStat.txt | awk '{ print $1 }' 3 | 4 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg5.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat ../FileName.txt | grep -i "Ubuntu" 3 | 4 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg7.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat ../FileName.txt | grep Ubuntu > Output.txt 3 | 4 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/ldapmodify/delete.ldif: -------------------------------------------------------------------------------- 1 | dn: uid=tom,ou=finance,dc=example,dc=com 2 | delete: givenName 3 | 4 | -------------------------------------------------------------------------------- /Shell_Script_Guide/.2id.sh.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/Linux-training/HEAD/Shell_Script_Guide/.2id.sh.swp -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg16.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for i in {1..500} 3 | do 4 | echo " $i " 5 | done 6 | 7 | 8 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg22.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat ../UserStat.txt | awk '{ print $1" "$3 }' 3 | 4 | 5 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg23.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat ../EmailStat.csv | awk -F ',' '{ print $2 }' 3 | 4 | 5 | -------------------------------------------------------------------------------- /Shell_Script_Guide/LinuxFlavours.txt: -------------------------------------------------------------------------------- 1 | Ubuntu 2 | Centos 3 | RedHat 4 | Debian 5 | Fedora 6 | SUSE 7 | Arch 8 | Windows 9 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg15.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | for i in 1 2 3 4 5 6 7 8 9 10 3 | do 4 | echo "$i" 5 | done 6 | 7 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg24.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat ../EmailStat.csv | awk -F ',' '{ print $1" "$3 }' > output_Eg24.txt 3 | 4 | -------------------------------------------------------------------------------- /OpenLDAP/Install/.How_to_install.txt.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/Linux-training/HEAD/OpenLDAP/Install/.How_to_install.txt.swp -------------------------------------------------------------------------------- /Shell_Script_Guide/continents.txt: -------------------------------------------------------------------------------- 1 | Europe 2 | Asia 3 | Africa 4 | NorthAmerica 5 | SouthAmerica 6 | Oceania 7 | Antarctica 8 | Colombo 9 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Printing First Line" 3 | echo "Printing Second Line" 4 | echo "Printing Third Line" 5 | 6 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg19.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | while read line 3 | 4 | do 5 | echo $line 6 | 7 | done < ../continents.txt 8 | 9 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Type the keyboard input:" 3 | read input 4 | echo "Command line input is : $input" 5 | 6 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/ldapmodify/add.ldif: -------------------------------------------------------------------------------- 1 | dn: uid=tom,ou=finance,dc=example,dc=com 2 | changetype: modify 3 | add: givenName 4 | givenName: Tom Solaman 5 | 6 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg10.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "print first sentence" >> Output_Eg10.txt 3 | echo "print second sentence" >> Output_Eg10.txt 4 | 5 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/DIT_Strcture_1/ROOT_dc: -------------------------------------------------------------------------------- 1 | dn: dc=example, dc=com 2 | dc: example 3 | o: example 4 | objectclass: organization 5 | objectclass: dcObject 6 | 7 | 8 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/DIT_Strcture_2/ROOT_dc: -------------------------------------------------------------------------------- 1 | dn:dc=example,dc=com 2 | objectClass: dcObject 3 | objectClass: organization 4 | dc:example 5 | o:example 6 | 7 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/ldapmodify/modify.ldif: -------------------------------------------------------------------------------- 1 | dn: uid=tom,ou=finance,dc=example,dc=com 2 | changetype: modify 3 | replace: givenName 4 | givenName: Tom NewSurName 5 | 6 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg18.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | num=1 3 | 4 | while [ $num -le 10 ] 5 | do 6 | echo $num 7 | num=`expr $num + 1` 8 | done 9 | 10 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg12.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | A=5 3 | B=50 4 | 5 | if [ $A == $B ] 6 | then 7 | echo "A is equal to B" 8 | else 9 | echo "A is not equal to B" 10 | fi 11 | 12 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/output_Eg24.txt: -------------------------------------------------------------------------------- 1 | rachel@yourcompany.com Rachel 2 | laura@yourcompany.com Laura 3 | craig@yourcompany.com Craig 4 | mary@yourcompany.com Mary 5 | jamie@yourcompany.com Jamie 6 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg13.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #!/bin/bash 3 | A=5 4 | B=50 5 | 6 | if [ $A -le $B ] 7 | then 8 | echo "A is less than B" 9 | else 10 | echo "A is greater than B" 11 | fi 12 | 13 | -------------------------------------------------------------------------------- /Shell_Script_Guide/UserStat.txt: -------------------------------------------------------------------------------- 1 | sam 192.168.1.2 https://google.com/mail 200 2 | Jeff 192.168.4.4 https://facebook.com/profile 301 3 | Tom 10.10.1.1 https://google.com/gsuite 301 4 | Simon 172.1.2.1 https://wso2.com/jobs 200 5 | -------------------------------------------------------------------------------- /Shell_Script_Guide/EmailStat.csv: -------------------------------------------------------------------------------- 1 | rachel@yourcompany.com,9012,Rachel,Booker 2 | laura@yourcompany.com,2070,Laura,Grey 3 | craig@yourcompany.com,4081,Craig,Johnson 4 | mary@yourcompany.com,9346,Mary,Jenkins 5 | jamie@yourcompany.com,5079,Jamie,Smith 6 | -------------------------------------------------------------------------------- /Shell_Script_Guide/exercises/exercise_no1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in {1..20} 4 | do 5 | 6 | if [ $i -le 5 ] 7 | then 8 | echo "SMALL" 9 | elif [ $i -ge 15 ] 10 | then 11 | echo "HIGH" 12 | else 13 | echo $i 14 | fi 15 | 16 | done 17 | -------------------------------------------------------------------------------- /Shell_Script_Guide/exercises/exercise_no3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while read line 4 | do 5 | 6 | Salary=`echo $line | awk -F ',' '{print $5}'` 7 | 8 | if [ $Salary -gt 2500 ] 9 | then 10 | echo $Salary 11 | fi 12 | 13 | done < ../UserSalary.txt 14 | -------------------------------------------------------------------------------- /Shell_Script_Guide/UserSalary.txt: -------------------------------------------------------------------------------- 1 | rachel@yourcompany.com,9012,Rachel,Booker,7000 2 | laura@yourcompany.com,2070,Laura,Grey,4000 3 | craig@yourcompany.com,4081,Craig,Johnson,4000 4 | mary@yourcompany.com,9346,Mary,Jenkins,2000 5 | jamie@yourcompany.com,5079,Jamie,Smith,2500 6 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/acl: -------------------------------------------------------------------------------- 1 | access to attrs=mobile 2 | by * none 3 | 4 | access to attrs=userPassword 5 | by * auth 6 | 7 | 8 | access to dn.subtree="dc=example,dc=com" 9 | by dn="uid=tom,ou=finance,dc=example,dc=com" read 10 | by * none 11 | 12 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg20.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while read line 4 | 5 | do 6 | if [ $line = "Colombo" ] 7 | then 8 | echo "Not a continent" 9 | else 10 | echo $line 11 | fi 12 | done < ../continents.txt 13 | 14 | -------------------------------------------------------------------------------- /Shell_Script_Guide/exercises/exercise_no2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat ../UserStat.txt | awk '{print $1}' > output.txt 3 | 4 | while read line 5 | do 6 | if [ $line == "Tom" ] 7 | then 8 | echo WSO2-USER 9 | else 10 | echo $line 11 | fi 12 | 13 | done < output.txt 14 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/DIT_Strcture_1/Directory_Strcture: -------------------------------------------------------------------------------- 1 | dn: ou=sales,dc=example,dc=com 2 | objectclass: organizationalunit 3 | ou: sales 4 | description: Sales Team 5 | 6 | dn: ou=finance,dc=example,dc=com 7 | objectclass: organizationalunit 8 | ou: finance 9 | description: Finance Team 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Shell_Script_Guide/shellwhile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | A=70 4 | B=90 5 | 6 | val=`expr $A + $B` 7 | echo "A + B : $val" 8 | 9 | val=`expr $A - $B` 10 | echo "A - B : $val" 11 | 12 | val=`expr $A \* $B` 13 | echo "a * b : $val" 14 | 15 | val=`expr $B / $A` 16 | echo "B / A : $val" 17 | 18 | val=`expr $B % $A` 19 | echo "B % A : $val" 20 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg25.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | A=70 4 | B=90 5 | 6 | val=`expr $A + $B` 7 | echo "A + B : $val" 8 | 9 | val=`expr $A - $B` 10 | echo "A - B : $val" 11 | 12 | val=`expr $A \* $B` 13 | echo "a * b : $val" 14 | 15 | val=`expr $B / $A` 16 | echo "B / A : $val" 17 | 18 | val=`expr $B % $A` 19 | echo "B % A : $val" 20 | 21 | -------------------------------------------------------------------------------- /OpenLDAP/Install/How_to_install.txt: -------------------------------------------------------------------------------- 1 | 1. apt-get update 2 | 2. apt-get install slapd 3 | 3. mv slapd.d slapd.d-backup #Lets disable the directory based configuration 4 | 4. cp slapd.conf /etc/ldap/slapd.conf #Copy the LDAP configuration file 5 | 5. cp ldap.conf /etc/ldap/ldap.conf #Copy the LDAP client configuration file 6 | 6. /etc/init.d/slapd start 7 | 8 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg14.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Change the value of number variable and see how if ,elif works 4 | number=50 5 | 6 | if [ $number -eq 100 ] 7 | then 8 | echo "number is equal to 100" 9 | 10 | elif [ $number -lt 100 ] 11 | then 12 | echo "number is less than 100" 13 | 14 | else 15 | echo "number is greater than 100" 16 | fi 17 | 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/ldap.conf: -------------------------------------------------------------------------------- 1 | # 2 | # LDAP Defaults 3 | # 4 | 5 | # See ldap.conf(5) for details 6 | # This file should be world readable but not world writable. 7 | 8 | BASE dc=example,dc=com 9 | URI ldap://localhost ldap://ldap.example.com 10 | 11 | #SIZELIMIT 12 12 | #TIMELIMIT 15 13 | #DEREF never 14 | 15 | # TLS certificates (needed for GnuTLS) 16 | #TLS_CACERT /etc/ssl/certs/ca-certificates.crt 17 | 18 | -------------------------------------------------------------------------------- /Shell_Script_Guide/examples/Eg17.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | words="Deliver enhanced digital experiences and grow your business at speed and scale with WSO2’s industry-leading products for API management and integration and customer identity and access management." 4 | 5 | for value in $words 6 | do 7 | 8 | if [ $value == "API" ] 9 | then 10 | echo "WSO2" 11 | else 12 | echo $value 13 | fi 14 | 15 | done 16 | 17 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/DIT_Strcture_2/Directory_Strcture: -------------------------------------------------------------------------------- 1 | dn: ou=staff,dc=example,dc=com 2 | objectclass: organizationalunit 3 | ou: staff 4 | description: Company Staff 5 | 6 | dn: ou=contractors,ou=staff,dc=example,dc=com 7 | objectclass: organizationalunit 8 | ou: contractors 9 | description: Company contractors 10 | 11 | dn: ou=permanent,ou=staff,dc=example,dc=com 12 | objectclass: organizationalunit 13 | ou: permanent 14 | description: Company permanent employees 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Shell_Script_Guide/FileName.txt: -------------------------------------------------------------------------------- 1 | Ubuntu Advantage is Canonical’s service package for Ubuntu. 2 | It offers tiered levels of support for desktop, server and cloud deployments. 3 | In this section, you can see our service description,GPL 4 | but don’t forget that there will still be some details in your customer agreement that are specific to your deployment. 5 | If you’re interested in support for an Ubuntu deployment or you’re a reseller and you want to offer it to your customers, 6 | you can learn more about UBUNTU Advantage here. GPL 7 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/DIT_Strcture_1/OU_System_Members: -------------------------------------------------------------------------------- 1 | 2 | dn: ou=system,dc=example,dc=com 3 | objectClass: organizationalUnit 4 | ou: system 5 | description: System Team 6 | 7 | dn: uid=registerapp,ou=system,dc=example,dc=com 8 | objectClass: account 9 | objectClass: simpleSecurityObject 10 | objectClass: top 11 | uid: registerapp 12 | userPassword:: cmVnaXN0ZXJhcHA= 13 | 14 | dn: uid=financeapp,ou=system,dc=example,dc=com 15 | objectClass: account 16 | objectClass: simpleSecurityObject 17 | objectClass: top 18 | uid: financeapp 19 | userPassword:: ZmluYW5jZWFwcA== 20 | 21 | dn: uid=salesapp,ou=system,dc=example,dc=com 22 | objectClass: account 23 | objectClass: simpleSecurityObject 24 | objectClass: top 25 | uid: salesapp 26 | userPassword:: c2FsZXNhcHA= 27 | 28 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/DIT_Strcture_1/Users: -------------------------------------------------------------------------------- 1 | 2 | dn: uid=tom,ou=finance,dc=example,dc=com 3 | objectClass: inetOrgPerson 4 | objectClass: top 5 | cn: tom 6 | sn: Carter 7 | employeeNumber: 113 8 | mail: tom@gmail.com 9 | mobile: 0772222222 10 | street: Colombo 11 | uid: tom 12 | userPassword:: dG9t 13 | 14 | 15 | dn: uid=sam,ou=sales,dc=example,dc=com 16 | objectClass: inetOrgPerson 17 | objectClass: top 18 | cn: Sam 19 | sn: Cooper 20 | employeeNumber: 112 21 | mail: sam@gmail.com 22 | mobile: 0771111111 23 | street: Colombo 24 | uid: sam 25 | userPassword:: c2Ft 26 | 27 | 28 | dn: uid=jeff,ou=sales,dc=example,dc=com 29 | objectClass: inetOrgPerson 30 | objectClass: top 31 | cn: jeffry 32 | sn: Cooper 33 | employeeNumber: 114 34 | mail: jeff@gmail.com 35 | mobile: 0773333333 36 | street: Colombo 37 | uid: jeff 38 | userPassword:: amVmZg== 39 | 40 | -------------------------------------------------------------------------------- /issue_template.md: -------------------------------------------------------------------------------- 1 | **Description:** 2 | 3 | 4 | **Suggested Labels:** 5 | 6 | 7 | **Suggested Assignees:** 8 | 9 | 10 | **Affected Product Version:** 11 | 12 | **OS, DB, other environment details and versions:** 13 | 14 | **Steps to reproduce:** 15 | 16 | 17 | **Related Issues:** 18 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/DIT_Strcture_1/Users_1: -------------------------------------------------------------------------------- 1 | 2 | dn: uid=tom,ou=finance,dc=example,dc=com 3 | objectClass: inetOrgPerson 4 | objectClass: organizationalPerson 5 | objectClass: person 6 | objectClass: top 7 | cn: tom 8 | sn: Carter 9 | employeeNumber: 113 10 | mail: tom@gmail.com 11 | mobile: 0772222222 12 | street: Colombo 13 | uid: tom 14 | userPassword:: dG9t 15 | 16 | 17 | dn: uid=sam,ou=sales,dc=example,dc=com 18 | objectClass: inetOrgPerson 19 | objectClass: organizationalPerson 20 | objectClass: person 21 | objectClass: top 22 | cn: Sam 23 | sn: Cooper 24 | employeeNumber: 112 25 | mail: sam@gmail.com 26 | mobile: 0771111111 27 | street: Colombo 28 | uid: sam 29 | userPassword:: c2Ft 30 | 31 | 32 | dn: uid=jeff,ou=sales,dc=example,dc=com 33 | objectClass: inetOrgPerson 34 | objectClass: organizationalPerson 35 | objectClass: person 36 | objectClass: top 37 | cn: jeffry 38 | sn: Cooper 39 | employeeNumber: 114 40 | mail: jeff@gmail.com 41 | mobile: 0773333333 42 | street: Colombo 43 | uid: jeff 44 | userPassword:: amVmZg== 45 | 46 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/DIT_Strcture_2/Users: -------------------------------------------------------------------------------- 1 | 2 | dn: uid=tom,ou=contractors,ou=staff,dc=example,dc=com 3 | objectClass: inetOrgPerson 4 | objectClass: organizationalPerson 5 | objectClass: person 6 | objectClass: top 7 | cn: tom 8 | sn: Carter 9 | employeeNumber: 113 10 | givenName: Tom Man 11 | mail: tom@gmail.com 12 | mobile: 0772222222 13 | street: Colombo 14 | uid: tom 15 | userPassword:: dG9t 16 | 17 | 18 | dn: uid=sam,ou=permanent,ou=staff,dc=example,dc=com 19 | objectClass: inetOrgPerson 20 | objectClass: organizationalPerson 21 | objectClass: person 22 | objectClass: top 23 | cn: Sam 24 | sn: Cooper 25 | employeeNumber: 112 26 | mail: sam@gmail.com 27 | mobile: 0771111111 28 | street: Colombo 29 | uid: sam 30 | userPassword:: c2Ft 31 | 32 | 33 | dn: uid=jeff,ou=permanent,ou=staff,dc=example,dc=com 34 | objectClass: inetOrgPerson 35 | objectClass: organizationalPerson 36 | objectClass: person 37 | objectClass: top 38 | cn: jeffry 39 | sn: Cooper 40 | employeeNumber: 114 41 | mail: jeff@gmail.com 42 | mobile: 0773333333 43 | street: Colombo 44 | uid: jeff 45 | userPassword:: amVmZg== 46 | 47 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/slapd.conf: -------------------------------------------------------------------------------- 1 | # This is the main slapd configuration file. See slapd.conf(5) for more 2 | # info on the configuration options. 3 | 4 | ####################################################################### 5 | # Global Directives: 6 | 7 | # Schema and objectClass definitions 8 | include /etc/ldap/schema/core.schema 9 | include /etc/ldap/schema/cosine.schema 10 | include /etc/ldap/schema/nis.schema 11 | include /etc/ldap/schema/inetorgperson.schema 12 | 13 | serverID 001 14 | loglevel 16384 15 | 16 | modulepath /usr/lib/ldap/ 17 | moduleload back_bdb.la 18 | moduleload syncprov.la 19 | 20 | lastmod on 21 | 22 | # Where the pid file is put. The init.d script 23 | # will not stop the server if you change this. 24 | pidfile /var/run/slapd/slapd.pid 25 | 26 | # List of arguments that were passed to the server 27 | argsfile /var/run/slapd/slapd.args 28 | 29 | # The maximum number of entries that is returned for a search operation 30 | 31 | 32 | ####################################################################### 33 | # Specific Directives for database #1, of type bdb: 34 | # Database specific directives apply to this databasse until another 35 | # 'database' directive occurs 36 | database bdb 37 | 38 | 39 | rootdn "cn=admin,dc=example,dc=com" 40 | 41 | suffix "dc=example,dc=com" 42 | 43 | 44 | 45 | 46 | # Where the database file are physically stored for database #1 47 | 48 | directory "/var/lib/ldap" 49 | 50 | 51 | #rootpw {SHA}gBCD6gcABP6GwOJ+vRMHIx8hc4g= 52 | rootpw 123 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /OpenLDAP/Config_Files/LDAP_Commands: -------------------------------------------------------------------------------- 1 | #Ldapadd commands 2 | ldapadd -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'secret' -x -f ROOT_dc 3 | ldapadd -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'secret' -x -f Directory_Strcture 4 | ldapadd -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'secret' -x -f Users 5 | 6 | 7 | 8 | #Ldapsearch commands 9 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'secret' -b dc=example,dc=com 10 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'secret' -b ou=sales,dc=example,dc=com 11 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'secret' -b dc=example,dc=com “objectclass=*” 12 | 13 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'secret' -b dc=example,dc=com uid=sam 14 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'123' -b dc=example,dc=com uid=sam mail mobile 15 | 16 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'secret' -b dc=example,dc=com "objectclass=*" 17 | 18 | 19 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'123' -b dc=example,dc=com sn=Cooper 20 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'123' -b dc=example,dc=com (&(sn=Cooper)(employeeNumber=112)) 21 | 22 | 23 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'Passwd' -b dc=example,dc=com "(&(street=colombo)(uid=jeff))" 24 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'secret' -b dc=example,dc=com "(&(objectclass=*)(uid=sam))" 25 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'secret' -b dc=example,dc=com "(|(street=colombo)(sn=cooper))" 26 | ldapsearch -D "cn=admin,dc=example,dc=com" -h 127.0.0.1 -w'secret' -b dc=example,dc=com "(&(objectclass=*)(uid=sam))" 27 | 28 | ldapsearch -D "uid=jeff,ou=sales,dc=example,dc=com" -h 127.0.0.1 -w'jeff' -b dc=example,dc=com 29 | ldapsearch -D "uid=tom,ou=finance,dc=example,dc=com" -h 127.0.0.1 -w'tom' -b dc=example,dc=com 30 | 31 | #Ldapdelete 32 | ldapdelete -h 127.0.0.1 -v -c -D "cn=admin,dc=example,dc=com" -w'secret' 33 | ldapdelete -h 127.0.0.1 -v -c -D "cn=admin,dc=example,dc=com" -w'secret' -f DeleteFile 34 | 35 | #Ldapmodify 36 | ldapmodify -a -h 127.0.0.1 -D cn=admin,dc=example,dc=com -w'secret' -f add.ldif 37 | ldapmodify -a -h 127.0.0.1 -D cn=admin,dc=example,dc=com -w'secret' -f modify.ldif 38 | ldapmodify -a -h 127.0.0.1 -D cn=admin,dc=example,dc=com -w'secret' -f delete.ldif 39 | -------------------------------------------------------------------------------- /pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Purpose 2 | > Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc. 3 | 4 | ## Goals 5 | > Describe the solutions that this feature/fix will introduce to resolve the problems described above 6 | 7 | ## Approach 8 | > Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here. 9 | 10 | ## User stories 11 | > Summary of user stories addressed by this change> 12 | 13 | ## Release note 14 | > Brief description of the new feature or bug fix as it will appear in the release notes 15 | 16 | ## Documentation 17 | > Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact 18 | 19 | ## Training 20 | > Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable 21 | 22 | ## Certification 23 | > Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why. 24 | 25 | ## Marketing 26 | > Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable 27 | 28 | ## Automation tests 29 | - Unit tests 30 | > Code coverage information 31 | - Integration tests 32 | > Details about the test cases and coverage 33 | 34 | ## Security checks 35 | - Followed secure coding standards in http://wso2.com/technical-reports/wso2-secure-engineering-guidelines? yes/no 36 | - Ran FindSecurityBugs plugin and verified report? yes/no 37 | - Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? yes/no 38 | 39 | ## Samples 40 | > Provide high-level details about the samples related to this feature 41 | 42 | ## Related PRs 43 | > List any other related PRs 44 | 45 | ## Migrations (if applicable) 46 | > Describe migration steps and platforms on which migration has been tested 47 | 48 | ## Test environment 49 | > List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested 50 | 51 | ## Learning 52 | > Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem. -------------------------------------------------------------------------------- /Shell_Script_Guide/Scripting_Guide.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ## Printing 5 | 6 | #### To print we can use the command ``` echo``` 7 | 8 | Eg:1 9 | 10 | ```shell 11 | #!/bin/bash 12 | echo “Printing First Line” 13 | echo “Printing Second Line” 14 | echo “Printing Third Line” 15 | ``` 16 | 17 | 18 | #### To read the input from command line input , user can use the ``` read ``` command 19 | 20 | Eg:2 21 | 22 | ```shell 23 | #!/bin/bash 24 | echo "Enter the keyboard input" 25 | read input 26 | echo “Command line input is : $input” 27 | ``` 28 | 29 | ## String Manipulation 30 | 31 | 32 | #### Print a file in shell script 33 | 34 | Eg:3 35 | 36 | ```shell 37 | #!/bin/bash 38 | cat FileName.txt 39 | ``` 40 | 41 | #### Finding the matching line in text with ```grep ``` , below command will print the all lines in the file that has the word ```Ubuntu``` 42 | 43 | 44 | Eg:4 45 | 46 | ```shell 47 | #!/bin/bash 48 | cat FileName.txt | grep “Ubuntu” 49 | ``` 50 | 51 | #### Can Use the option ```-i``` with ```grep``` command to ignore the case sensitivity. So the below script will print the lines with word Ubuntu ,UBUNTU and any case varinet of word ubuntu 52 | 53 | Eg:5 54 | 55 | ```shell 56 | #!/bin/bash 57 | Cat FileName.txt | grep -i “Ubuntu” 58 | ``` 59 | 60 | 61 | #### ```grep``` command can be used with option ```-v``` to display the non-matching lines. Below command will print the all lines in the file which does not have the word ```GPL``` 62 | 63 | Eg:6 64 | ```shell 65 | #!/bin/bash 66 | Cat FileName.txt | grep -v “GPL” 67 | ``` 68 | 69 | ## Input Output Operations 70 | 71 | #### Redirect output to a file , ```>``` symbol will redirect the output to a file (The ```>``` symbol is used for output (STDOUT) redirection.) 72 | 73 | 74 | Eg:7 75 | ```shell 76 | #!/bin/bash 77 | cat FileName.txt | grep Ubuntu > Output.txt 78 | ``` 79 | 80 | #### Command output of ```ls -ltr``` will redrect to ```Directory_list.txt``` file 81 | 82 | Eg:8 83 | ```shell 84 | #!/bin/bash 85 | ls -ltr > Directory_list.txt 86 | ``` 87 | 88 | #### The '<' symbol is used for input(STDIN) redirection ,So beneath command ```wc -l``` take input as file content of ```FileName.txt``` 89 | ```( wc -l command count the number of lines in a given file)``` 90 | 91 | 92 | 93 | Eg:9 94 | ```shell 95 | #!/bin/bash 96 | wc -l < FileName.txt 97 | ``` 98 | 99 | #### To Append content to a file , we can use the symbol of ```>>``` . For example below commands will append ```print first sentence``` and ```print second sentence``` sentence to end of the Output.txt file 100 | 101 | 102 | 103 | Eg:10 104 | ```shell 105 | #!/bin/bash 106 | Echo “print first sentence” >> Output.txt 107 | Echo “print second sentence” >> Output.txt 108 | ``` 109 | 110 | 111 | 112 | ## PIPE 113 | 114 | 115 | #### Symbol ``` |``` is using to pass output of a command to another command as a input 116 | 117 | Eg: 11 118 | ```shell 119 | #!/bin/bash 120 | cat FileName.txt | grep -v “GPL” 121 | ``` 122 | 123 | #### ```cat FileName.txt``` will print the contents of the file. In the above by using PIPE ```|``` symbol its output is pass to the command ```grep -v “GPL”``` for further processing 124 | 125 | 126 | 127 | ## IF ELSE Statements 128 | 129 | #### If a condition is true, the algorithm performs a certain action; else, it performs something else. 130 | 131 | ```shell 132 | if [ condition ] 133 | then 134 | trueAction.... 135 | else 136 | falseAction 137 | fi 138 | ``` 139 | 140 | #### Below script check whether given Number “A” and “B” are equal to each other 141 | 142 | Eg:12 143 | ```shell 144 | #!/bin/bash 145 | A=5 146 | B=50 147 | 148 | if [ $A == $B ] #Be Mindful about the spaces in between the if , [ , $A , == , $B , ] characters, which is a must. Otherwise script will throw a syntax error 149 | then 150 | echo "A is equal to B" 151 | else 152 | echo "A is not equal to B" 153 | fi 154 | ``` 155 | 156 | #### Script validates whether number “A” is greater than number “B” 157 | 158 | Eg:13 159 | ```shell 160 | #!/bin/bash 161 | A=5 162 | B=50 163 | 164 | if [ $A -gt $B ] 165 | then 166 | echo "A is greater than B" 167 | else 168 | echo "A is less than B" 169 | fi 170 | ``` 171 | 172 | 173 | #### Below are the most commonly used operators in IF statements 174 | ```python 175 | STRING1 = STRING2 True if STRING1 and STRING2 are equal. 176 | STRING1 != STRING2 True if STRING1 and STRING2 are not equal. 177 | NUMBER1 -eq NUMBER2 True if NUMBER1 and NUMBER2 are equal. 178 | NUMBER1 -gt NUMBER2 True if NUMBER1 is greater than NUMBER2. 179 | NUMBER1 -lt NUMBER2 True if NUMBER1 is less than NUMBER2. 180 | NUMBER1 -ge NUMBER2 True if NUMBER1 is equal or greater than NUMBER2. 181 | NUMBER1 -le NUMBER2 True if NUMBER1 is equal or less than NUMBER2 182 | ``` 183 | 184 | ## IF ELIF statements 185 | 186 | #### Format of ```if``` ```elif``` statements ( Nested if else operations ) 187 | 188 | ```shell 189 | If [ conditional expression1 ] 190 | then 191 | statement1 192 | statement2 193 | . 194 | elif [ conditional expression2 ] 195 | then 196 | statement3 197 | statement4 198 | elif [ conditional expression3 ] 199 | then 200 | statement5 201 | else 202 | statement6 203 | fi 204 | ``` 205 | 206 | 207 | Eg:14 208 | 209 | #### Refer to the below example which outline how to use ```if elif``` conditions . 210 | 211 | ```shell 212 | #!/bin/bash 213 | number=50 214 | 215 | if [ $number -eq 100 ] 216 | then 217 | echo "number is equal to 100" 218 | 219 | elif [ $number -lt 100 ] 220 | then 221 | echo "number is less than 100" 222 | 223 | else 224 | echo "number is greater than 100" 225 | fi 226 | ``` 227 | 228 | ## Loops 229 | 230 | In this section of our Bash scripting Tutorial , we'll look at the two different loop formats available to us as well as discuss how to use them in scripting via examples 231 | 232 | ### For Loops 233 | 234 | #### Below script will print the numbers from 1 to 10 235 | 236 | Eg:15 237 | ```shell 238 | #!/bin/sh 239 | for i in 1 2 3 4 5 6 7 8 9 10 240 | do 241 | echo “$i" 242 | done 243 | ``` 244 | 245 | #### Script print the command from 1 to 500 246 | 247 | 248 | Eg:16 249 | ```shell 250 | #!/bin/bash 251 | for i in {1..500} 252 | do 253 | echo " $i " 254 | done 255 | ``` 256 | 257 | #### Print the below sentence line by line , and if word matches “API” print WSO2 instead 258 | 259 | Eg:17 260 | ```shell 261 | #!/bin/bash 262 | 263 | words=”Deliver enhanced digital experiences and grow your business at speed and scale with WSO2’s industry-leading products for API management and integration and customer identity and access management.” 264 | 265 | for value in $words 266 | do 267 | 268 | If [ $value == “API” ] 269 | then 270 | Echo “WSO2” 271 | else 272 | echo $value 273 | fi 274 | done 275 | ``` 276 | 277 | 278 | 279 | ### While Loops 280 | 281 | #### While loop which print values from 1 to 10 282 | 283 | Eg:18 284 | 285 | ```shell 286 | #!/bin/bash 287 | num=1 288 | 289 | while [ $num -le 10 ] 290 | do 291 | echo $num 292 | num=`expr $num + 1` 293 | Done 294 | ``` 295 | 296 | One of major advantages of while loop is that , it can be easily used to read the contents of a FILE by line by line and those lines can be forward for further processing 297 | 298 | 299 | #### Script read the ```continents.txt``` file line by line and print it 300 | 301 | Eg:19 302 | ```shell 303 | #!/bin/bash 304 | while read line 305 | 306 | do 307 | echo $line 308 | 309 | done < continents.txt 310 | ``` 311 | 312 | #### Below example will read the ```continents.txt``` file line by line and print each line , Additionally it will print ```Not a continent``` statement when line matches the word ```Colombo``` 313 | 314 | 315 | Eg:20 316 | ```shell 317 | #!/bin/bash 318 | 319 | while read line 320 | 321 | do 322 | if [ $line = "Colombo" ] 323 | then 324 | echo "Not a continent" 325 | else 326 | echo $line 327 | fi 328 | done < continents.txt 329 | ``` 330 | 331 | 332 | ## Retrieving Columns via ```AWK``` command 333 | 334 | By default, ```awk``` command filter the columns by using space as separator 335 | 336 | #### UserStat.txt File 337 | ```shell 338 | sam 192.168.1.2 https://google.com/mail 339 | 340 | Jeff 192.168.4.4 https://facebook.com/profile 341 | 342 | Tom 10.10.1.1 https://google.com/gsuite 343 | 344 | Simon 172.1.2.1 https://wso2.com/jobs 345 | ``` 346 | 347 | #### Below stript will print the first column of ```UserStat.txt``` file 348 | 349 | Eg:21 350 | 351 | ```shell 352 | #!/bin/bash 353 | cat UserStat.txt | awk '{ print $1 }' 354 | ``` 355 | 356 | #### Script will print the first column and third column with space in the middle 357 | 358 | 359 | Eg:22 360 | 361 | ```shell 362 | #!/bin/bash 363 | cat UserStat.txt | awk '{ print $1 " " $3 }' 364 | ``` 365 | 366 | 367 | Additionally ```awk``` command can be used to filter columns by using custom symbols ,For instace when user need to specify the comma as field separator, he can use option as ``` -F ‘, ‘ ``` 368 | 369 | 370 | #### UserSalary.csv File 371 | 372 | From left to right column are Email, employeeID, FirstName, LastName, Salary 373 | ```shell 374 | rachel@yourcompany.com,9012,Rachel,Booker,7000 375 | 376 | laura@yourcompany.com,2070,Laura,Grey,4500 377 | 378 | craig@yourcompany.com,4081,Craig,Johnson,4000 379 | 380 | mary@yourcompany.com,9346,Mary,Jenkins,2000 381 | 382 | jamie@yourcompany.com,5079,Jamie,Smith,2500 383 | ``` 384 | 385 | #### Below commands will print the second column of the file , Please note that ```COMMA``` is used as field / column separator 386 | 387 | Eg:23 388 | ```shell 389 | #!/bin/bash 390 | cat EmailStat.csv | awk -F ',' '{ print $2 }' 391 | ``` 392 | 393 | #### Script will take the first and third columns and redirect it to the output to file 394 | ```shell 395 | Eg:24 396 | #!/bin/bash 397 | cat EmailStat.csv | awk -F ',' '{ print $1" "$3 }' > output.txt 398 | ``` 399 | 400 | ## Mathematical Operations 401 | 402 | 403 | 404 | #### Below script will run the basic mathematics operations and give the relevant outputs 405 | 406 | Eg:25 407 | ```shell 408 | #!/bin/sh 409 | 410 | A=70 411 | B=90 412 | 413 | val=`expr $A + $B` #Be Mindful about the spaces in between the "expr" , $A , + , $B characters, which is a must. Otherwise script will throw a syntax error 414 | echo "A + B : $val" 415 | 416 | val=`expr $A - $B` 417 | echo "A - B : $val" 418 | 419 | val=`expr $A \* $B` 420 | echo "a * b : $val" 421 | 422 | val=`expr $B / $A` 423 | echo "B / A : $val" 424 | 425 | val=`expr $B % $A` 426 | echo "B % A : $val” 427 | ``` 428 | 429 | 430 | 431 | ## Exercises 432 | 433 | 1. Write a shell script to print values from 1 to 20 by using FOR loop . 434 | 435 | * If the number is less than or equal to 5 then print SMALL 436 | * If the number is larger than or equal to 15 , then print HIGH 437 | * Else print the number as it is (Answer can be found in exercise_no1.sh) 438 | 439 | 440 | 2. Write a shell script to print the Names line by line from UserStat.txt file, and print the word WSO2-USER if the username is equal to Tom. Output should be as below format (Answer can be found in exercise_no2.sh) 441 | 442 | Sam 443 | Jeff 444 | WSO2-USER 445 | Simon 446 | 447 | 448 | 3. Read the given UserSalary.txt file and print Salary values larger than 2500 . Output should be as below (Answer can be found in exercise_no3.sh) 449 | 450 | 7000 451 | 4000 452 | 4000 453 | 454 | 455 | 456 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------