Monday, April 23, 2012

Im amazed by how many people don’t know about runlevels, let alone, to identify what runlevel you are in.

To see what runlevel you are in.

who -r
or
/sbin/runlevel


HTH
Brent

P.s. To find out about runlevels

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.