Friday, April 13, 2012

This is more for me, than for anyone. I always seem to forget this command.

If you need to discover from which package a particular program came from, you can use this command.


dpkg -S /usr/bin/ssh
openssh-client: /usr/bin/ssh



HTH
Brent

Wednesday, April 11, 2012

Where I work, we had an interesting request from a client.  This client is a mass mailer. And they wanted a means to self configure exim, for which ip a domain must be listening on.

Heres how I did it.

First we create the router:
vi /etc/exim4/conf.d/router/350_exim4-config_vdom_aliases
vdom_aliases:
      driver = redirect
      allow_defer
      allow_fail
      domains = dsearch;
/path/for/client/mail/virtual
      data = ${expand:${lookup{$local_part}lsearch*@{/path/for/client/mail/virtual/$domain}}}
      retry_use_local_part
      pipe_transport   = address_pipe
      file_transport   = address_file
      no_more


Next we copy the orignal remote_smtp transport
cp /etc/exim4/conf.d/transport/30_exim4-config_remote_smtp  /etc/exim4/conf.d/transport/30_exim4-config_remote_smtp_new

vi  /etc/exim4/conf.d/transport/30_exim4-config_remote_smtp_new

 remote_smtp_new:
  debug_print = "T: remote_smtp for $local_part@$domain"
  driver = smtp
.ifdef REMOTE_SMTP_HOSTS_AVOID_TLS
  hosts_avoid_tls = REMOTE_SMTP_HOSTS_AVOID_TLS
.endif
.ifdef REMOTE_SMTP_HEADERS_REWRITE
  headers_rewrite = REMOTE_SMTP_HEADERS_REWRITE
.endif
.ifdef REMOTE_SMTP_RETURN_PATH
  return_path = REMOTE_SMTP_RETURN_PATH
.endif
.ifdef REMOTE_SMTP_HELO_DATA
  helo_data=REMOTE_SMTP_HELO_DATA
.endif
.ifdef DKIM_DOMAIN
dkim_domain = DKIM_DOMAIN
.endif
.ifdef DKIM_SELECTOR
dkim_selector = DKIM_SELECTOR
.endif
.ifdef DKIM_PRIVATE_KEY
dkim_private_key = DKIM_PRIVATE_KEY
.endif
.ifdef DKIM_CANON
dkim_canon = DKIM_CANON
.endif
.ifdef DKIM_STRICT
dkim_strict = DKIM_STRICT
.endif
.ifdef DKIM_SIGN_HEADERS
dkim_sign_headers = DKIM_SIGN_HEADERS
.endif
interface = ${if exists {
/path/for/client/mail/domainiplist}{${lookup{$sender_address_domain}lsearch*{/path/for/client/mail/domainiplist}{$value}{}}}{}}
helo_data = ${if exists {
/path/for/client/mail/domainhelolist}{${lookup{$sender_address_domain}lsearch*{/path/for/client/mail/domainhelolist}{$value}{$primary_hostname}}}{$primary_hostname}}

Then 

vi  /etc/exim4/conf.d/main/000_localmacros
MAIN_LOCAL_DOMAINS = @:localhost:dsearch;/path/for/client/mail/virtual

Wednesday, April 4, 2012

Create passwords

As an admin, im amazed by the passwords I come across.

Heres a little tool and command to help.

pwgen -Bnyc

-B Don't include ambiguous characters in the password
-n Include at least one number in the password
-y Include at least one special symbol in the password
-c Include at least one capital letter in the password

Add a number to set password length, add another to set how many password to output. Example:

pwgen -Bnyc 12 20
this will output 20 password of 12 chars length.

Wednesday, March 28, 2012

MySQL Memory Allocation

Here is a great link that could be help for MySQL users.

http://mysql.rjweb.org/doc.php/memory

HTH
Brent

Monday, March 26, 2012

Stale NFS file handle .... WHAT !!!! (And im not even using NFS)

Today I experienced a very weird situation.

Nagios was telling me, that my hourly mysql backup process failed.

So looking at the LVM, of where we store our backups.

What do I see ...

root@sql02:/data_backup# ls -la
ls: cannot access hourly_Tue_06_mysql.tar.gz: Stale NFS file handle
ls: cannot access hourly_Mon_14_mysql.tar.gz: Stale NFS file handle
ls: cannot access hourly_Mon_20_mysql.tar.gz: Stale NFS file handle
ls: cannot access hourly_Mon_18_mysql.tar.gz: Stale NFS file handle
ls: cannot access hourly_Mon_16_mysql.tar.gz: Stale NFS file handle
total 81737756
drwxr-xr-x  3 root root       4096 2012-03-26 12:54 .
drwxr-xr-x 24 root root       4096 2010-02-04 12:39 ..
-rw-r--r--  1 root root 4645355531 2012-03-26 06:45 hourly_Mon_06_mysql.tar.gz
-rw-r--r--  1 root root 4646191698 2012-03-26 08:44 hourly_Mon_08_mysql.tar.gz
-rw-r--r--  1 root root 4647695788 2012-03-26 10:49 hourly_Mon_10_mysql.tar.gz
-rw-r--r--  1 root root 4649504933 2012-03-26 12:44 hourly_Mon_12_mysql.tar.gz
-?????????  ? ?    ?             ?                ? hourly_Mon_14_mysql.tar.gz
-?????????  ? ?    ?             ?                ? hourly_Mon_16_mysql.tar.gz
-?????????  ? ?    ?             ?                ? hourly_Mon_18_mysql.tar.gz
-?????????  ? ?    ?             ?                ? hourly_Mon_20_mysql.tar.gz
-rw-r--r--  1 root root 4644413050 2012-03-24 14:43 hourly_Sat_14_mysql.tar.gz
-rw-r--r--  1 root root 4644347702 2012-03-24 16:43 hourly_Sat_16_mysql.tar.gz
-rw-r--r--  1 root root 4644389185 2012-03-24 18:43 hourly_Sat_18_mysql.tar.gz
-rw-r--r--  1 root root 4644334737 2012-03-24 20:43 hourly_Sat_20_mysql.tar.gz
-rw-r--r--  1 root root 4644340846 2012-03-24 22:43 hourly_Sat_22_mysql.tar.gz
-rw-r--r--  1 root root 4644322947 2012-03-25 06:45 hourly_Sun_06_mysql.tar.gz
-rw-r--r--  1 root root 4644647579 2012-03-25 08:43 hourly_Sun_08_mysql.tar.gz
-rw-r--r--  1 root root 4645116133 2012-03-25 10:44 hourly_Sun_10_mysql.tar.gz
-rw-r--r--  1 root root 4645206124 2012-03-25 12:43 hourly_Sun_12_mysql.tar.gz
-rw-r--r--  1 root root 4645299884 2012-03-25 14:44 hourly_Sun_14_mysql.tar.gz
-rw-r--r--  1 root root 4645487729 2012-03-25 16:43 hourly_Sun_16_mysql.tar.gz
-rw-r--r--  1 root root 4645544082 2012-03-25 18:43 hourly_Sun_18_mysql.tar.gz
-rw-r--r--  1 root root 4645580059 2012-03-25 20:43 hourly_Sun_20_mysql.tar.gz
-rw-r--r--  1 root root 4645698797 2012-03-25 22:43 hourly_Sun_22_mysql.tar.gz
-?????????  ? ?    ?             ?                ? hourly_Tue_06_mysql.tar.gz
drwx------  2 root root      16384 2010-02-12 15:18 lost+found

Flip knows how that happened. I umount the LVM and run
 root@sql02:/# e2fsck -f -v -p /dev/mapper/vg0-data_backup
/dev/mapper/vg0-data_backup: Entry 'hourly_Mon_14_mysql.tar.gz' in / (2) has deleted/unused inode 17.  CLEARED.
/dev/mapper/vg0-data_backup: Entry 'hourly_Mon_20_mysql.tar.gz' in / (2) has deleted/unused inode 18.  CLEARED.
/dev/mapper/vg0-data_backup: Entry 'hourly_Mon_18_mysql.tar.gz' in / (2) has deleted/unused inode 270338.  CLEARED.
/dev/mapper/vg0-data_backup: Entry 'hourly_Tue_06_mysql.tar.gz' in / (2) has deleted/unused inode 21.  CLEARED.
/dev/mapper/vg0-data_backup: Entry 'hourly_Mon_16_mysql.tar.gz' in / (2) has deleted/unused inode 270337.  CLEARED.

      29 inodes used (0.00%)
       0 non-contiguous inodes (0.0%)
         # of inodes with ind/dind/tind blocks: 18/18/18
20893815 blocks used (79.70%)
       0 bad blocks
      19 large files

      18 regular files
       2 directories
       0 character device files
       0 block device files
       0 fifos
       0 links
       0 symbolic links (0 fast symbolic links)
       0 sockets
--------
      20 file


 e2fsck to the rescue  !!!!

Wednesday, December 7, 2011

Hiya

If you human or just plain silly like me. I find I forget what packages and library’s I need to install for Ruby Enterprise.

Here is my brief howto.
apt-get install libssl-dev libreadline-dev

Monday, October 31, 2011

Today I received an interesting request for one of the dev KVM vm's.
I was requested to raise the memory.

By default I always use 512Mb. Id never raised the memory before.
A quick google search introduced me too.

virsh edit devvm.

HTH
Brent