Tuesday, January 25, 2011

Exim4 Smart Host Relay

I am running Exim 4.71. I want to:

  1. Route all email from A.com through mail.A.com
  2. Route all email from [B-E].com through mail.B.com
  3. Send all other email directly.

Here is the configuration I have that doesn't work like I hoped:

domainlist a_domains = a.com
domainlist b_domains = b.com : c.com : d.com : e.com

begin routers

smart_route_a:
  driver = manualroute
  domains = +a_domains
  transport = remote_smtp
  route_list = +a_domains mail.a.com
  no_more

smart_route_b:
  driver = manualroute
  domains = +b_domains
  transport = remote_smtp
  route_list = +b_domains mail.mollenhour.com
  no_more

dnslookup:
  driver = dnslookup
  domains = ! +local_domains
  transport = remote_smtp
  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
  no_more

When I send an email e.g. with PHP's mail() or Zend_Mail_Transport_Smtp setting both From: and Return-Path: as user@a.com, the smart_route_a router is not used, the dnslookup is used instead. Disabling dnslookup results in no mail being sent.

From the logs it appears that email sent to someone@a.com uses smart_route_a, but the same email sent from user@a.com to user@gmail.com is sent using dnslookup.

How do I make email from user@a.com be relayed via mail.a.com?

  • Use a conditional like

    route_list = * "${if match{$header_from:}{\N.*\.a\.com$\N} {mail.a.com}}"
    

    domains = only checks the destination domain not the source domain.

    From topdog

Juniper NetScreen NS-5GT traffic monitoring

I've done casual research into the subject and am truly dismayed at the lack of compatible tools for such a simple task. Maybe someone can provide assistance.

We have a NetScreen NS-5GT in the office. I need to be able to get a glance of current traffic per endpoint -- I think the equivalent of 'get sessions' with byte counts/rates. I don't care about bars, graphs, and reports. Something as simple as a classic software firewall display would be perfect.

I can't shell out money on something real like SolarWinds products, so a free solution is essential. I'm willing to do a little work but refuse to program something from scratch. It's not prudent right now for me to install a hub or otherwise mess around physically. There must be something out there I can use, maybe in combination. I don't believe I'm asking too much.

Specific answers only please, e.g. monitoring software you know will actually work with this antiquated device. I've read about general approaches to the broader problem dozens of times already.

  • Have you tried using a SNMP-based solution? I have a few clients that still use that firewall and have used Paessler's PRTG Network Monitor software (limited free version) without problems. PRTG software does show a lot of graphs but can show "Live Data" including each interface but I'm not sure how real-time you need. It also seems to be designed to be installed on a computer and left on for monitoring, the interface is web based.

    From catfish
  • I agree, use an SNMP based solution.

    If you're wanting to be really selective. I'd just setup a script to do SNMP gets for the OID's you care about and turn them into useful output.

    Otherwise, I'd install Zenoss.

    Are you by chance using Mac OSX? There is a good SNMP based interface monitoring dashboard widget.

    From Tom

How to make the new created filed with group rw permission

I have centos 5.4.

I in joomla website , when i install new php script then it created its own folder like images/scriptname

Now that folder has only read and write permission for that user or apache user i don't know.

I want that all the files created under /home/ directory has group write permission by default.

I don't want specific folder or specific user but for all users folder inside /home directory

Is it ok to do , or there is any other solution for that

EDIT

SUppose in my /home directory i have three user

/home/user1
/home/user2
/home/user3

Now i want that if any file is created under user1 it should have by default group rw permission with group being user1

and for /home/user2 all file which are created later should have default group rw permission with default group being user2

How can i achieve that

  • You would need to set the umask on the directory. This will allow every file/directory that is created to have default permissions beyond the normal rw--r--r-- that most files are given.

    So, if you have a folder called /home/myscripts and you want every file under it to be created by default as rw-rw-rw- you need to set the umask to 011, or:

    # umask 011 /home/myscripts
    

    For more information: http://www.comptechdoc.org/os/linux/usersguide/linux_ugfilesp.html

    Master : I have edited my post for more specific
    From James

*nix shell with IOS style completion?

Is there a Linux shell that will let you type less than full commands as you can with Cisco IOS, at least for the first command (and not its arguments)?

I haven't really thought enough if this is actually a good thing, but might be fun to play with :-)

  • Almost all UNIX shells do tab completion by default. If you want shorter equivalent commands just create an alias for the ones you use commonly.

    The problem with tab completion is that there are so many commands in UNIX that you tend to need to type in many more characters than you would in IOS before the command prefix becomes unambiguous.

    FWIW, on my tcsh setup, typing tel<tab> offers me telinit, telltc and telnet. Only once I type n does it them autocomplete to the latter of those.

    Furthermore, some shells can then offer you command line arguments too, so long as it has been told in advance which arguments are valid for the current program.

    grawity : `bash` can do the same completion too, including command line arguments (for most popular commands). In most Linux distributions, you can get that by installing `bash-completion`.
    From Alnitak
  • No, I do not know of such as shell. However, you can get close to what you probably want with tab-completion (type in part of a command and hit the <Tab> key, and the shell will try to complete the command from what you gave it.

    Also, you can define command aliases using the shell builtin alias, like so:

    alias ll='ls -l'
    

    Which will replace the command ll with ls -l whenever you type it afterwards.

    From Silas
  • bash also allows tab autocompletion for arbitrary data sets (called Programmable Bash Completion), most usefully for SSH hostnames. Grab /etc/bash_completion from http://www.caliban.org/bash/index.shtml#completion and source it at login.

    From Troy Davis

Trac changesets not displaying

I have set up Trac v0.11.6 to integrate with our VisualSVN server. It all seems to work fine, except when I am viewing source changesets, it only shows the files that have changed, not the actual diff of what has changed in the file.

In addition, when I am viewing a particular file in Trac, the 'diff' link is not visible, which I have seen in other installations.

I assume it is probably a configuration issue, or maybe the way the data is being entered in the first place.

Any suggestions?

  • Large changesets don't show the diffs directly, but should have links to the diffs on a per-file basis. Unless those files are binary files that can't be diffed meaningfully. Does that explain what you are seeing?

    From retracile
  • Turns out the issue was related to SVN marking certain file types as binary, so Trac didn't know how to diff them. The solution was just to change the SVN mime-type for the problem file types

Amazon EC2 - Are multiple requests from the same user guaranteed to go to the same instance?

In a scenario where an application is hosted by multiple instances in Amazon EC2 (with load balancing), are multiple requests from the same user guaranteed to go to the same instance?

  • From the Amazon Elastic Load Balancing summary page:

    Elastic Load Balancing supports the ability to stick user sessions to specific EC2 instances.

  • It depends on your configuration. I don't make use of Amazon's Elastic Load Balancing (ELB) service as it doesn't allow me to log the client IP address as all connections appear to come from the LB equipment when seen by the EC2 instance. Instead I do my own load balancing via DNS and multiple Apache front-end servers that are setup to use sticky sessions from the same originating source address.

    hamlin11 : Jeremy, Thanks for the detailed answer.
    Jeremy Bouse : Don't mention it. I've been running several java application servers under EC2 for almost a year now.

Which mysql server package should I install?

I just switched hosts and now have the task of reinstalling everything. I'm on CentOS now and I need to install mysql but have no idea which package to install. I can't seem to find any info on the differences either. Would anyone know? Yum is not an option as it wants to install 1.0.77 and this is too old. The machine is 64 bit.

  • What version of CentOS did you install? On my recently-installed copy of CentOS 5.4, I show this:

    [root@server ~]# yum info mysql-server
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * addons: mirror.fdcservers.net
     * base: centos.mbni.med.umich.edu
     * epel: ftp.osuosl.org
     * extras: centos.omnispring.com
     * updates: mirror.ubiquityservers.com
    Available Packages
    Name       : mysql-server
    Arch       : x86_64
    Version    : 5.0.77
    Release    : 4.el5_4.2
    Size       : 9.8 M
    Repo       : updates
    Summary    : The MySQL server and related files
    URL        : http://www.mysql.com
    License    : GPLv2 with exceptions
    Description: MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
               : client/server implementation consisting of a server daemon (mysqld)
               : and many different client programs and libraries. This package contains
               : the MySQL server and some accompanying files and directories.
    
    ErikA : Or did you just make a typo with "1.0.77"? I'm not sure if a more recent version is available from the official CentOS repositories. You always have the option to install the official binary or source packages to get up to the most recent revs, but that's just asking for headaches when you go to upgrade or do security patches in the future.
    From ErikA
  • If the version you want to install differs from the version supported in your distribution and you have no reason to compile from source, I'd say your best off seeking MySQL's precompiled binaries.

    A very rough procedure is listed below. You might want to remove the mysql and mysql-server packages from your system, which means you would need to use a different init and create a mysql user. You may have system packages dependent on it.

    I tend to make my primary server roles (IE. Web, mail, proxy) built around scripts and source distribution as opposed to distribution packages, while using distribution packages for core system utilities and libraries. This is simply my preference.

    cd /usr/local/src
    wget http://mysql.tar.gz
    tar zxvf mysql.tar.gz -C /usr/local
    ln -s /usr/local/mysql-$VERSION /usr/local/mysql
    cd /usr/local/mysql
    scripts/mysql_install_db --force  
    chown -R root  .
    chown -R mysql data
    chgrp -R mysql .
    /usr/local/mysql/support-files/mysql.server start
    tail -f  /usr/local/mysql/data/`uname -n`.err
    cd /usr/local/mysql/data
    /bin/rm -fr test
    

    Download MySQL

    From Warner
  • Download the MySQL 5.1 RPMs from dev.mysql.com.

    The RPMs are labeled "Red Hat & Oracle Enterprise Linux", but I believe they work fine for CentOS as well. I'm testing them on a CentOS 5.4 host now, and they installed without problems and seem to work fine.