Thursday 28 February 2013

Exim: rewrite "From" field


Amazon's AWS SES service requires email be addressed from a particular user.
  1. Add to begin rewrite section
    1. *  root@abc.com  Ffrs
  2. Reload exim

Wednesday 27 February 2013

Right-click with Mac trackpad

Try selecting something and clicking anywhere on the trackpad with TWO fingers.

AWS SES with exim4 on debian-based Linux



  1. apt-get install exim4
  2. dpkg-reconfigure exim4-config
    1. Select: internet site; mail is sent and received directly using SMTP
    2. IP-addresses to listen on for incoming SMTP connections:
      1. 127.0.0.1 ; ::1 (it's the default anyways)
    3. Take most defaults
    4. Split configuration into small files?
      1. NO!
  3. lsof -nP -i :25
    1. Make sure you aren't allowing the world to connect!
      1. 127.0.0.1:25 is good
  4. AWS -> SES
    1. Verified Senders
      1. Verify one of your existing email addresses
    2. SMTP Settings
      1. Create My SMTP Credentials
      2. Use downloaded credentials.csv file contents for below steps
  5. Edit /etc/exim4/exim4.conf.template
    1. Find ALREADY existing line "public_name = LOGIN"
      1. change to "public_name = OLD_LOGIN"
    2. Add below sections to existing sections in the file
    3. Use info from credentials.csv in place of pointy brackets, e.g. <aws_id> 
  6. service exim4 stop
  7. service exim4 start
  8. tail -F /var/log/exim4/mainlog
    1. Keep this running in another terminal while you do the below
  9. echo test001 | mail -r <email_you_verified_with_aws> -s "Test subject" <a_test_email_address>
    1. e.g. echo test001 | mail -r bob@myawsverified.com -s test bob@testaccount.com
  10. See this to set the "From:" field to your verified user for every email sent from your system
    1. http://sysadminandnetworking.blogspot.com/2013/02/exim-rewrite-from-field.html


begin routers

send_via_ses:
  driver = manualroute
  domains = ! +local_domains
  transport = ses_smtp
  route_list = * email-smtp.us-east-1.amazonaws.com


begin transports

ses_smtp:
  driver = smtp
  port = 25
  hosts_require_auth = $host_address
  hosts_require_tls = $host_address


begin authenticators

ses_login:
  driver = plaintext
  public_name = LOGIN
  client_send = : <aws_id> : <aws_secret>

Saturday 23 February 2013

JMX ports to open in firewall for jconsole to Cassandra


  1. Port 7199
    1. Used for about a dozen packets when JMX connection first made
      1. A handshake of sorts
      2. Probably sets up the agreement on which high port to connect to, used below
        1. Similar to SIP
        2. Similar to old FTP
    2. Not used again after initial handshake
  2. Port range 55000 to 55999
    1. To see these packets, on JVM server
      1. tcpdump -nn ! port 22 and host <jconsole client IP> (not literal, replace this)
  3. If jconsole starts showing graphs, you are connected
To run jconsole directly on the server via VNC, see this article: http://sysadminandnetworking.blogspot.com/

Tricks and Tips
  1. If you don't want to expose 1000 ports to the world for some reason
    1. Open all ports on firewall in front of JVM server
    2. On JVM server: tcpdump -nn ! port 22 and host <jconsole client IP>
    3. Start jconsole connection on client machine
    4. Watch to see which port JVM server is trying to reach jconsole client via
    5. Close all but that port in the firewall, will be between 55000-55999
  2. Do a local experiment to a local JVM JMX-able application if unsure of good jconsole connection result
  3. Get your external IP from where you are running jconsole client
    1. CLI: curl http://ipaddr.me
    2. Or web browser: http://ipaddr.me

What's an MBean or JavaBean?

A fancy name for a Java class that:
  1. is serializable
    1. means you can write/read the contents directly to disk as is
  2. has a 0-argument constructor
  3. has getter and setter methods
    1. Have you ever tweaked a mbean value via jconsole before, btw?
Understand, there was major hype for Java back in circa 2000 that didn't quite pan out as expected.

Friday 22 February 2013

Increase bash history size on Mac


  1. Add below lines to end of ~/.bash_profile
  2. Source result or log out and back in
    1. source ~/.bash_profile
  3. Test
    1. echo $HISTFILESIZE
    2. echo $HISTSIZE
export HISTFILESIZE=2500

export HISTSIZE=""

Thursday 14 February 2013

rsync: include only these


  1. rsync -avP --include=*/ [set of includes] --exclude=* 
    1. for example
      1. rsync -n -avP --include=*/ --include=*.dat  --include=*.idx --exclude=* /informatica/ /backup/informatica/


Wednesday 6 February 2013

Linux equivalent of updatedb on Mac

sudo /usr/libexec/locate.updatedb

Disable CAPS LOCK key on MacBook Pro


  1. System Preferences -> Keyboard -> Modifier Keys
  2. MAKE SURE YOU PICK THE RIGHT KEYBOARD
    1. "Select Keyboard"
  3. Caps Lock Key -> No Action
Might as well do all the other keyboards while you're at it, eh?

Sunday 3 February 2013

Fix jEdit fonts for MacBook Pro with Retina display


From: https://bugs.eclipse.org/bugs/show_bug.cgi?id=382972#c4
Assumptions: jEdit was installed into /Applications directory.


  1. Close any running jEdit
  2. Edit /Applications/jEdit.app/Contents/Info.plist
    1. At end of file, add the top two lines below above the bottom two lines, and save
  3. Drag jEdit to desktop
  4. Start jEdit and see if fonts fixed
  5. If fixed, drag jEdit back to /Applications, and retest.

<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>

Friday 1 February 2013

Open snmp requests to world


  1. Open snmp requests to world
    1. snmpd.conf
      1. rocommunity public 0.0.0.0/0
      2. #agentAddress  udp:127.0.0.1:161
        1. comment this line out if it exists so snmpd listens to the world
  2. Make sure snmpd is listening on all interfaces
    1. lsof -nP -i
      1. snmpd  ......stuff in here........  UDP *:161
  3. Test from another server
    1. snmpwalk -cpublic -v1 <IP address serving snmp request>

Interview questions: 2020-12

Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...