Permalink
Browse files

initial commit.

  • Loading branch information...
linuxsysadmintutorials committed Aug 22, 2017
0 parents commit 6d21e585cb1fe0e5a04e1ce6abcc43198934145e
Showing with 2,863 additions and 0 deletions.
  1. +11 −0 README.rst
  2. +30 −0 content/asterisk/disable-unistim-in-asterisk.md
  3. +77 −0 content/authentication/google-authentication-centos7.md
  4. +28 −0 content/bash/how-to-calculate-dates-in-bash.md
  5. +75 −0 content/bash/list-foreground-processes.md
  6. +75 −0 content/bash/list-foreground-processes.md.bak
  7. +14 −0 content/bash/strip-white-space-dash-and-colons-from-a-date-string.md
  8. +51 −0 content/dns/configure-dnsmasq-to-query-different-nameservers-for-different-domains.md
  9. +35 −0 content/dns/specify-a-different-nameserver-in-etc-resolv-when-using-dhcp-centos.md
  10. +21 −0 content/dnsmasq/delete-lease-from-dnsmasq.md
  11. +34 −0 content/docker/overlayfs-centos-71.md
  12. +54 −0 content/docker/working-with-running-docker-containers.rst
  13. +30 −0 ...documentation/using-the-appropriate-ip-networks-within-documentation-diagrams-and-example-code.md
  14. +45 −0 content/filemagic/file-magic-reporting-python-script-mimetype-as-java.md
  15. +17 −0 content/git/find-out-what-commit-belongs-to-what-branch-git.md
  16. +16 −0 content/google/discover-google-netblocks.md
  17. +20 −0 content/i2p/configure-i2ptunnel-proxy-to-listen-on-all-interfaces.rst
  18. +32 −0 content/i2p/configure-web-console-to-listen-on-all-interfaces.rst
  19. BIN content/images/OpenVPN-road-warrior-bridge-diagram.png
  20. BIN content/images/do/ssd-virtual-servers-200x200.jpg
  21. BIN content/images/do/ssd-virtual-servers-banner-120x600.jpg
  22. BIN content/images/ssh-tunnel-web-server1.png
  23. +26 −0 content/mail/converting-mutt-aliases-to-ldif.md
  24. +17 −0 content/mail/create-a-maildir-directory-and-its-sub-directories.md
  25. +17 −0 content/mysql/analyse-mysql-binary-logs-with-mysqlsla.md
  26. +197 −0 content/mysql/backup-a-mysql-database-onan-ubuntu-server-with-mylvmbackup.md
  27. +39 −0 content/mysql/compressing-mylvmbackups-using-xz.md
  28. +13 −0 content/mysql/convert-innodb-to-innodb-plugin-compressed-tables.md
  29. +16 −0 content/mysql/display-overhead-of-all-tables-in-a-mysql-database.md
  30. +48 −0 content/mysql/fixing-errno-1449-mysql-slave-replication-error.md
  31. +90 −0 content/nagios/install-nagios-and-monitor-a-server.md
  32. +115 −0 content/nagios/setup-nagios-nrpe-to-monitor-system-load.md
  33. +91 −0 content/nagios/use-boxcar-to-send-nagios-alerts.md
  34. +36 −0 ...ent/network/specify-a-different-nameserver-in-etc-resolv-when-using-dhcp-in-centos-rhel-fedora.md
  35. +39 −0 content/openssl/extract-pem-certificates-and-keys-from-shared-nss-db.md
  36. +21 −0 content/openssl/how-to-check-the-expiry-of-a-http-ssl-certificate.md
  37. +32 −0 content/openssl/how-to-retrieve-the-sha1-fingerprint-of-a-remote-server-certificate.rst
  38. +23 −0 content/openvpn/change-the-passphrase-on-an-openvpn-key.md
  39. +234 −0 content/openvpn/setup-openvpn-bridge-support-ubuntu.md
  40. +76 −0 content/openvpn/setup-pam-authentication-with-openvpns-auth-pam-module.md
  41. +13 −0 content/outlook/convert-an-outlook-pst-file-to-mbox.md
  42. +19 −0 content/perl/transfer-a-text-file-over-a-tcp-socket-using-perl.md
  43. +89 −0 content/php/install-php-fpm-ubuntu.md
  44. +21 −0 content/postfix/setup-postfix-to-deliver-using-maildir.md
  45. +89 −0 content/puppet/create-a-simple-puppet-class-to-maintain-ssh.md
  46. +31 −0 content/puppet/handle-apt-configuration-with-puppet.md
  47. +43 −0 content/puppet/handle-apt-keys-with-puppet.md
  48. +29 −0 content/puppet/install-the-puppetlabs-apt-puppet-module.md
  49. +31 −0 content/puppet/manage-apt-sources-list-with-puppet.md
  50. +107 −0 content/puppet/manage-sshd-with-puppet-using-a-template-configuration-file.md
  51. +61 −0 content/ssh/configure-openssh-to-tunnel-through-another-server-using-ssh.md
  52. +15 −0 content/ssh/create-a-socks5-tunnel-on-port-3333-over-ssh.md
  53. +43 −0 content/ssh/ignore-host-keys-when-connecting-to-an-openssh-server.md
  54. +26 −0 content/ssh/install-puppet-syntax-highlighting-for-vim-on-ubuntu.md
  55. +74 −0 content/ssh/multiple-ssh-client-configuration-files.md
  56. +26 −0 content/static/patches/vim.spec-centos6-7.4.160-1.patch
  57. +14 −0 content/tcpdump/how-do-i-sniff-each-packet-on-the-command-line.md
  58. +10 −0 content/time/query-a-remote-ntp-server-using-ntpdate.md
  59. +30 −0 content/time/update-the-timezone-in-centos-6.md
  60. +23 −0 content/tshark/sniff-mysql-traffic-on-a-database-server.md
  61. +31 −0 content/ubuntu/disable-the-motd-displaying-when-logging-into-an-Ubuntu-server-over-ssh.md
  62. +22 −0 content/user-management/edit-the-default-user-id-values-for-new-users.md
  63. +14 −0 content/user-management/generate-hash.md
  64. +52 −0 content/vim/build-and-install-vim-7.4-on-centos6-using-rpm.md
  65. +61 −0 content/virtualization/configure-guest-domain-memory-usage-with-virsh.md
  66. +48 −0 content/voip/sip-over-tcp-with-asterisk.md
  67. +27 −0 content/yum/download-rpms-without-installing-them-using-yum.md
  68. +19 −0 content/yum/enable-epel-on-a-centos-rhel-6-server.md
@@ -0,0 +1,11 @@
linuxsysadmintutorials.com
==========================
linuxsysadmintutorials.com is offline indefinitely.
All the content can be found at `github.com/linuxsysadmintutorials/site/tree/master/content <https://github.com/linuxsysadmintutorials/site/tree/master/content>`_.
contact
-------
Email github at linuxsysadmintutorials dot com.
@@ -0,0 +1,30 @@
Title: Disable UNIStim in asterisk
Date: 2012-06-21
Status: Published
disqus_url: http://www2.linuxsysadmintutorials.com/disable-unistim-in-asterisk/
disqus_identifier: 478 http://www.linuxsysadmintutorials.com/?p=478
disqus_shortname: wwwlinuxsysadmintutorials
disqus_title: Disable UNIStim in asterisk
You may have noticed that asterisk has <a href="http://en.wikipedia.org/wiki/UNIStim">UNIStim</a> enabled by default which listens on port 5000.
```
$ sudo netstat -tapun | grep asterisk
...
udp 0 0 0.0.0.0:5000 0.0.0.0:* 19470/asterisk
udp 0 0 0.0.0.0:5060 0.0.0.0:* 19470/asterisk
udp 0 0 0.0.0.0:4569 0.0.0.0:* 19470/asterisk
```
To disable unistim you will need to blacklist the unistim module by adding it to /etc/asterisk/modules.conf under the modules section.
```
[modules]
noload => chan_unistim.so
```
Once added, reload asterisk and asterisk will no longer be listening on port 5000.
```
$ sudo service asterisk reload
```
@@ -0,0 +1,77 @@
Title: Setup sudo with google-authenticator for 2 Factor authentication on CentOS 7.
Date: 2015-12-21
Status: Published
By configuring the google-authenticator PAM module with sudo, you can
force system users to have to authenticate with one-time passcode and
their system password in order to use sudo.
From [https://github.com/google/google-authenticator](https://github.com/google/google-authenticator):
> The Google Authenticator project includes implementations of one-time
passcode generators for several mobile platforms, as well as a pluggable
authentication module (PAM).
To set this up on CentOS7, we'll install the
google-authenticator PAM module and update your server's PAM
configuration.
First, install the tools required to build the google-authenticator PAM module.
```
# yum install -y git autoconf automake make libtool pam-devel
```
Clone the google-authenticator git repo, build and install the plugin.
```
# git clone https://github.com/google/google-authenticator.git
# cd google-authenticator/libpam
# ./bootstrap.sh
# ./configure
# make
# make install
```
This will install the google-authenticator binary and the
pam_google_authenticator.so PAM module under /usr/local.
Before continuing, login as root and do not exit from this login whilst making
changes to your system. A mistake could lock you out from your root
account.
Add pam_google_authenticator.so to /etc/pam.d/sudo.
```
auth required /usr/local/lib/security/pam_google_authenticator.so forward_pass nullok
auth include system-auth
account include system-auth
password include system-auth
session optional pam_keyinit.so revoke
session required pam_limits.so
```
Its important that the path used to define pam_google_authenticator.so
is correct or else PAM may not be able to find
pam_google_authenticator.so and sudo will log an error.
```
Dec 21 09:25:34 server sudo: PAM unable to dlopen(/usr/lib64/security/pam_google_authenticator.so): /usr/lib64/security/pam_google_authenticator.so: cannot open shared object file: No such file or directory
Dec 21 09:25:34 server sudo: PAM adding faulty module: /usr/lib64/security/pam_google_authenticator.so
```
It is also important that the pam_google_authenticator.so is found
before the 'auth include system-auth' line within /etc/pam.d/sudo.
Any user who will need to use sudo now needs to setup their secret key
and google-authenticator settings which live in ~/.google_authenticator
by simply running the google-authenticator binary on the server. They will
be shown a QRCode that can be scanned into their two-factor authentication
mobile app such as [Authy](https://www.authy.com/) or [Google
Authenticator](https://support.google.com/accounts/answer/1066447).
Next time the user uses sudo, they will be asked for their system
password and one-time passcode.
Once all your users who use sudo have setup their google-authenticator
secret key, you should remove nullok from /etc/pam.d/sudo.
@@ -0,0 +1,28 @@
Title: How to calculate dates in bash
Date: 2011-08-11
disqus_url: http://www.linuxsysadmintutorials.com/how-to-calculate-dates-in-bash/
Add 5 minutes to the current date.
```
$ date --date 'now +5 mins'
```
Add 4 days, 3 hours, 44 minutes and 3 seconds from 2011-01-01 07:00:00.
```
$ date --date "2011-01-01 07:00:00 3 days 3 hours 44 mins 3 secs"
```
Subtract 5 minutes from the current date.
```
$ date --date 'now -5 mins'
```
Subtract 5 days, 8 hours, 31 minutes and 45 seconds from
2011-01-01 08:00:00 and return it in unixseconds.
```
$ date --date '2011-01-01 08:00:00 3 days ago 5 hours ago 31 mins ago 45 secs ago' +%s
```
@@ -0,0 +1,75 @@
Title: A quick intro to background and foreground command control in bash.
Date: 2016-01-04
Appending an & (ampersand) to any command run within bash will
background the process.
For example:
for count in $(seq 1 10); do
sleep 10m &
done
[11] 12775
[12] 12776
[13] 12777
[14] 12778
[15] 12779
[16] 12780
[17] 12781
[18] 12782
[19] 12783
[20] 12784
Will background 10 processes which will simply sleep for 10
minutes. Bash will return a table of job ids and their PIDs.
To list a table which shows all background processes use the built-in
`jobs` command.
$ jobs -l
You can also use ps to list the background processes by requesting the
processes which have the parent pid of your current bash shell.
$ ps -O user --ppid $$
By using ps we can refer to important information on the processes.
To connect to one of the background processes, use fg and the job id
number.
$ fg 11
sleep 10m
To put job 11 back into the background you first have to suspend the
process by using ^Z (Control-Z) and then running bg specifying the job
id.
$ fg 11
sleep 10m
^Z
[11]+ Stopped sleep 10m
$ bg 11
[11]+ sleep 10m &
To put fg, bg and ^Z to practical use, lets say you were copying a large
directory which was going to take a long time though you wanted to
regain control of your current shell.
Suspend the current command using ^Z.
$ cp -a /media/backups/rsnapshot/hourly.0 /opt/restore
^Z
[1]+ Stopped cp -a /media/backups/rsnapshot/hourly.0 /opt/restore
Background the task with bg referring to the job id in the table.
$ bg 1
[1]+ cp -a /media/backups/rsnapshot/hourly.0 /opt/restore &
Confirm the process is running with ps.
$ ps -O user --ppid $$
PID USER S TTY TIME COMMAND
19496 root D pts/11 00:00:06 cp -a /media/backups/rsnapshot/hourly.0 /opt/restore
@@ -0,0 +1,75 @@
Title: List foreground processes in BASH.
Date: 2016-01-04
Appending an & (ampersand) to any command run within bash will
background the process.
For example:
for count in $(seq 1 10); do
sleep 10m &
done
[11] 12775
[12] 12776
[13] 12777
[14] 12778
[15] 12779
[16] 12780
[17] 12781
[18] 12782
[19] 12783
[20] 12784
Will background 10 proccesses which will simply sleep for 10
minutes. Bash will return a table of job ids and their PIDs.
To list a table which shows all background processes use the builtin
`jobs` command.
$ jobs -l
You can also use ps to list the background processes by requesting the
processes which have the parent pid of your current bash shell.
$ ps -O user --ppid $$
By using ps we can refer to important information on the processes.
To connect to one of the background processes, use fg and the job id
number.
$ fg 11
sleep 10m
To put job 11 back into the background you first have to suspend the
process by using ^Z (Control-Z) and then running bg specifying the job
id.
$ fg 11
sleep 10m
^Z
[11]+ Stopped sleep 10m
$ bg 11
[11]+ sleep 10m &
To put fg, bg and ^Z to practical use, lets say you were copying a large
directory which was going to take a long time though you wanted to
regain control of your current shell.
Suspend the current command using ^Z.
$ cp -a /media/backups/rsnapshot/hourly.0 /opt/restore
^Z
[1]+ Stopped cp -a /media/backups/rsnapshot/hourly.0 /opt/restore
Background the task with bg referring to the job id in the table.
$ bg 1
[1]+ cp -a /media/backups/rsnapshot/hourly.0 /opt/restore &
Confirm the process is running with ps.
$ ps -O user --ppid $$
PID USER S TTY TIME COMMAND
19496 root D pts/11 00:00:06 cp -a /media/backups/rsnapshot/hourly.0 /opt/restore
@@ -0,0 +1,14 @@
Title: Strip white space, dash and colons from a date string
Date: 2011-08-18
Status: Published
disqus_url: http://www2.linuxsysadmintutorials.com/strip-white-space-dash-and-colons-from-a-date-string/
disqus_identifier: 121 http://www.linuxsysadmintutorials.com/?p=121
disqus_shortname: wwwlinuxsysadmintutorials
disqus_title: Strip white space, dash and colons from a date string
Pipe a timestamp string into sed combined to remove the -, : and white space to get a string which is suitable for a log file.
```
$ echo -n "2011-08-10 08:50:00" | sed 's/-\|:\|\s//g'
20110810085000
```
@@ -0,0 +1,51 @@
Title: Configure dnsmasq to query different nameservers for different domains
Date: 2015-02-12
disqus_url: http://www.linuxsysadmintutorials.com/configure-dnsmasq-to-query-different-nameservers-for-different-domains/
When connecting to a VPN you may have a DNS server which serves [split horizon](https://en.wikipedia.org/wiki/Split-horizon_DNS) for a particular domain. For
example when connected to your companies VPN, your local DNS config in
/etc/resolv.conf is updated with:
```
:::bash
nameserver 192.168.1.1
```
The DNS server 192.168.1.1 is your companies internal DNS server which resolves admin.example.org to 192.168.1.100. You need to access admin.example.org on 192.168.1.100 but don’t necessarily want to have all DNS queries go to 192.168.1.1. You also don’t want manage /etc/hosts entries which can become stale over time.
[dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) a lightweight DNS and DHCP service can help.
Simply install dnsmasq, starting off with a simple config.
```
:::bash
listen-address=127.0.0.1
bind-interfaces
conf-dir=/etc/dnsmasq.d/
```
Create /etc/dnsmasq.d/example.org.conf.
```
:::bash
address=/vpn.example.org/198.51.100.100
server=/example.org/192.168.1.1
```
- line 1 returns 198.51.100.100 for the host vpn.example.org.
- line 2 specifies 192.168.1.1 as the upstream DNS server for all other example.org queries such as admin.example.org.
Reload the dnsmasq service.
```
service dnsmasq restart
```
And finally update /etc/resolv.conf.
```
:::bash
nameserver 127.0.0.1
```
Now your local resolver clients will use dnsmasq as a DNS server with dnsmasq only forwarding queries for example.org to the upstream DNS server 192.168.1.1.
Oops, something went wrong.

0 comments on commit 6d21e58

Please sign in to comment.