Bend Source is the Best place in Oregon for weekly updates. : serverSetup

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Most recent edit on 2012-01-20 08:10:13 by JimLucas

Additions:
When modifying /etc/crontab this is the correct format



Edited on 2011-12-15 08:14:20 by JimLucas

Additions:
~-How to install PostgreSQL



Edited on 2011-09-17 15:54:59 by JimLucas

Additions:
~-OpenVPN

Deletions:
~-OpenVAS



Edited on 2011-09-17 15:54:30 by JimLucas

Additions:
~-OpenVAS
ssh -2 -N -f -L 192.168.0.10:8888:172.16.0.10:80 root@localhost

-2 forces ssh version 2
-N Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only).
-f forces ssh to run in the background
-L [bind_address:]port:remote_host:hostport
root@localhost is the user that you create the connection with
Here is my example tunnel script:
#! /bin/sh
#    Starts a listening daemon that captures SMDR information
# Author:  Jim Lucas <jlucas@cmsws.com>
# Version:  0.0.1
set -e
DESC="PBX Tunnel"
PIDFILE=/var/run/tunnel.pid
L_IP=192.168.1.10
L_PORT=8888
R_IP=192.168.0.10
R_PORT=80
#
#  Function that starts the daemon/service.
#
d_start() {
  if [ -f $PIDFILE ]; then
	echo "$DESC already running: PID# `cat $PIDFILE`"
	exit 1
  else
	echo "Starting $DESC"
	nohup /usr/bin/ssh -2 -N -f -L $L_IP:$L_PORT:$R_IP:$R_PORT root@localhost 1>/dev/null
	sleep 0.5
	ps auxww | grep "$L_IP:$L_PORT:$R_IP:$R_PORT" | grep -v grep | awk -F' ' '{print $2}' > $PIDFILE
	echo "$DESC Started #`cat $PIDFILE`"
  fi
}
#
#  Function that stops the daemon/service.
#
d_stop() {
  if [ -f $PIDFILE ]; then
	echo -n "Stopping $DESC"
	kill `cat $PIDFILE`
	rm $PIDFILE
	echo "."
  else
	echo "$DESC is not running"
	exit 1
  fi
}
case "$1" in
  start)
	d_start
  ;;
  stop)
	d_stop
  ;;
  status)
	if [ -f $PIDFILE ]; then
	  echo "$DESC is running: PID# `cat $PIDFILE`"
	else
	  echo "$DESC is not running"
	fi
  ;;
  cleanup)
	PID="`ps auxww | grep "$L_IP:$L_PORT:$R_IP:$R_PORT" | grep -v grep | awk -F' ' '{print $2}'`"
	kill $PID
	rm $PIDFILE
  ;;
  restart|force-reload)
	d_stop
	sleep 0.5
	d_start
  ;;
  *)
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
	exit 1
  ;;
esac
exit 0




Edited on 2011-08-11 22:39:59 by JimLucas

Additions:
~-OpenBSD + Asterisk & FreePBX installation & setup

Deletions:
~-OpenBSD / Asterisk / FreePBX installation & setup



Edited on 2011-08-11 22:39:34 by JimLucas

Additions:
~-OpenBSD + OpenVAS



Edited on 2011-08-04 10:35:02 by JimLucas

Additions:
~-OpenBSD + NNTP



Edited on 2010-10-05 09:02:33 by JimLucas

Additions:

How to check your email using telnet

# telnet mail.cmsws.com 110
Trying 66.39.167.51...
Connected to mail.cmsws.com.
Escape character is '^]'.
+OK Dovecot ready.
USER jlucas@cmsws.com
+OK
PASS something
+OK Logged in.
list
... <snipped>
retr 1
... <returns message #1>
retr 2
... <returns message #2>
dele 2
... <deletes message #2>
quit <exits session>


Deletions:
How to check your email using telnet



Edited on 2010-10-05 08:43:34 by JimLucas

Additions:
~1) Select Start in the bottom left corner of the screen, then select Run.
  1. Once the Run window starts, type in cmd.
  2. At the command prompt, type in telnet emailprovider.com 110 (where "emailprovider" is the name of the service you use for email).
  3. Type USER yourusername (you may see what you type or not, and "yourusername" should be changed to whatever comes before the @ in your email address).
  4. Then type in PASS yourpassword (if you can see what you type, you will see your password).
  5. Type list.
  6. You will see a list of items with labels like "1 607" and "2 1323403."
  7. If you want to look at the message labeled 2 1323403, type retr 2. You can replace the 2 with any other number to view other messages.
  8. If you want to delete message 1 607, type dele 1.
  9. When you are done checking your email, type quit.

    Deletions:
    1) Select Start in the bottom left corner of the screen, then select Run.
2) Once the Run window starts, type in cmd.
3) At the command prompt, type in telnet emailprovider.com 110 (where "emailprovider" is the name of the service you use for email).
4) Type USER yourusername (you may see what you type or not, and "yourusername" should be changed to whatever comes before the @ in your email address).
5) Then type in PASS yourpassword (if you can see what you type, you will see your password).
6) Type list.
7) You will see a list of items with labels like "1 607" and "2 1323403."
8) If you want to look at the message labeled 2 1323403, type retr 2. You can replace the 2 with any other number to view other messages.
9) If you want to delete message 1 607, type dele 1.
10) When you are done checking your email, type quit.




Edited on 2010-10-05 08:42:56 by JimLucas

Additions:

Crontab layout



Deletions:

Crontab layout





Edited on 2010-10-05 08:42:12 by JimLucas

Additions:

Howto's for OpenBSD



Deletions:
s for OpenBSD





Edited on 2010-10-05 08:36:46 by JimLucas

Additions:
1) Select Start in the bottom left corner of the screen, then select Run. 2) Once the Run window starts, type in cmd.
3) At the command prompt, type in telnet emailprovider.com 110 (where "emailprovider" is the name of the service you use for email).
4) Type USER yourusername (you may see what you type or not, and "yourusername" should be changed to whatever comes before the @ in your email address).
5) Then type in PASS yourpassword (if you can see what you type, you will see your password).
6) Type list.
7) You will see a list of items with labels like "1 607" and "2 1323403."
8) If you want to look at the message labeled 2 1323403, type retr 2. You can replace the 2 with any other number to view other messages.
9) If you want to delete message 1 607, type dele 1.
10) When you are done checking your email, type quit.


Deletions:
1 Select Start in the bottom left corner of the screen, then select Run.
2 Once the Run window starts, type in cmd.
3 At the command prompt, type in telnet emailprovider.com 110 (where "emailprovider" is the name of the service you use for email).
4 Type USER yourusername (you may see what you type or not, and "yourusername" should be changed to whatever comes before the @ in your email address).
5 Then type in PASS yourpassword (if you can see what you type, you will see your password).
6 Type list.
7 You will see a list of items with labels like "1 607" and "2 1323403."
8 If you want to look at the message labeled 2 1323403, type retr 2. You can replace the 2 with any other number to view other messages.
9 If you want to delete message 1 607, type dele 1.
10 When you are done checking your email, type quit.



Edited on 2010-10-05 08:35:42 by JimLucas

Additions:
~1) Open the cmd prompt. (Start -> Run or press win key + R, then type cmd and presss OK )
  • Type telnet server.com 25 (where "server.com" is the remote mail server)
  • Type HELO server.com. (Or "EHLO server.com")
  • Type MAIL FROM:you@server.com.
  • You may get a message saying "250 ok"
  • Type RCPT TO:Friend1@anotherserver.com, friend_two@someotherserver.org, friend.3three@Someserver.com, etc.
  • again, You may get a message saying "250 ok"
  • To write the message, type DATA and press Enter.
    1. On the first line type SUBJECT:yoursubject and press Enter twice.
    2. Continue typing your message.
    3. Put a single period (.) on a line by itself and press Enter to send your message.
      The server should say 'Message accepted for delivery'. (Or it says 250 OK id=`a long id`)
  • Type QUIT to exit Telnet.

    Deletions:
    ~1) Open the cmd prompt. (Start -> Run or press win key + R, then type cmd and presss OK )
  • Type telnet server.com 25 (where "server.com" is the remote mail server)
  • Type HELO server.com. (Or "EHLO server.com")
  • Type MAIL FROM:you@server.com.
  • You may get a message saying "250 ok"
  • Type RCPT TO:Friend1@anotherserver.com, friend_two@someotherserver.org, friend.3three@Someserver.com, etc.
  • again, You may get a message saying "250 ok"
  • To write the message, type DATA and press Enter.
    1. On the first line type SUBJECT:yoursubject and press Enter twice.
    2. Continue typing your message.
    3. Put a single period (.) on a line by itself and press Enter to send your message.
    The server should say 'Message accepted for delivery'. (Or it says 250 OK id=`a long id`)
  • Type QUIT to exit Telnet.



    Edited on 2010-10-05 08:34:25 by JimLucas

    Additions:
    s for OpenBSD

  • How to send email with telnet

    1. Open the cmd prompt. (Start -> Run or press win key + R, then type cmd and presss OK )
    2. Type telnet server.com 25 (where "server.com" is the remote mail server)
    3. Type HELO server.com. (Or "EHLO server.com")
    4. Type MAIL FROM:you@server.com.
    5. You may get a message saying "250 ok"
    6. Type RCPT TO:Friend1@anotherserver.com, friend_two@someotherserver.org, friend.3three@Someserver.com, etc.
    7. again, You may get a message saying "250 ok"
    8. To write the message, type DATA and press Enter.
      1. On the first line type SUBJECT:yoursubject and press Enter twice.
      2. Continue typing your message.
      3. Put a single period (.) on a line by itself and press Enter to send your message.
      The server should say 'Message accepted for delivery'. (Or it says 250 OK id=`a long id`)
    9. Type QUIT to exit Telnet.
    %%#
    # Don't actually type the ...'s #
    #
    # telnet mail.server.com 25
    ...
    EHLO mail.cmsws.com
    ...
    MAIL FROM:me@mydomain.com
    ...
    RCPT TO:you@yourdomain.com[, you2@yourdomain.com]
    ...
    DATA
    SUBJECT:My subject...
    Here is my message.
    It looks so good to me.
    This is the last line.
    . <- actually put a single period here, then press enter
    ...
    How to check your email using telnet
    1 Select Start in the bottom left corner of the screen, then select Run.
    2 Once the Run window starts, type in cmd.
    3 At the command prompt, type in telnet emailprovider.com 110 (where "emailprovider" is the name of the service you use for email).
    4 Type USER yourusername (you may see what you type or not, and "yourusername" should be changed to whatever comes before the @ in your email address).
    5 Then type in PASS yourpassword (if you can see what you type, you will see your password).
    6 Type list.
    7 You will see a list of items with labels like "1 607" and "2 1323403."
    8 If you want to look at the message labeled 2 1323403, type retr 2. You can replace the 2 with any other number to view other messages.
    9 If you want to delete message 1 607, type dele 1.
    10 When you are done checking your email, type quit.



    Deletions:

    Howto's for OpenBSD





    Edited on 2010-08-31 22:59:45 by JimLucas

    Additions:
    0 0 * * 0 /bin/sh somecommandhere
    0   0   *   *   0   root /bin/sh somecommandhere


    Deletions:
    0 * * * * /bin/sh somecommandhere
    0   *   *   *   *   root /bin/sh somecommandhere




    Edited on 2010-08-31 22:56:47 by JimLucas

    Additions:
    # mkdir /mnt/cdrom
    # mkdir /mnt/hd2
    3. unmount iso
    5. unmount usb

    Deletions:
    # mkdir /mnt/cdrom
    # mkdir /mnt/hd2
    3. un-mount iso
    4. un-mount usb




    Edited on 2010-08-31 22:56:04 by JimLucas

    Additions:
    First off make your mount points
    # mkdir /mnt/hd2
    1. mount CDROM at start up with /etc/fstab
    # mount /mnt/cdrom
    3. un-mount iso
    # umount /mnt/cdrom
    # vnconfig -u svnd0
    4. mount usb
    4. un-mount usb
    # umount /mnt/usb


    Deletions:
    1. mount CDROM
    #mount /mnt/cdrom
    3. mount usb




    Edited on 2010-04-13 16:54:18 by JimLucas

    Additions:
    Here is my example tunnel script:
    #! /bin/sh
    #    Starts a listening daemon that captures SMDR information
    # Author:  Jim Lucas <jlucas@cmsws.com>
    # Version:  0.0.1
    set -e
    DESC="PBX Tunnel"
    PIDFILE=/var/run/tunnel.pid
    L_IP=192.168.1.10
    L_PORT=8888
    R_IP=192.168.0.10
    R_PORT=80
    #
    #  Function that starts the daemon/service.
    #
    d_start() {
      if [ -f $PIDFILE ]; then
    	echo "$DESC already running: PID# `cat $PIDFILE`"
    	exit 1
      else
    	echo "Starting $DESC"
    	nohup /usr/bin/ssh -2 -N -f -L $L_IP:$L_PORT:$R_IP:$R_PORT root@localhost 1>/dev/null
    	sleep 0.5
    	ps auxww | grep "$L_IP:$L_PORT:$R_IP:$R_PORT" | grep -v grep | awk -F' ' '{print $2}' > $PIDFILE
    	echo "$DESC Started #`cat $PIDFILE`"
      fi
    }
    #
    #  Function that stops the daemon/service.
    #
    d_stop() {
      if [ -f $PIDFILE ]; then
    	echo -n "Stopping $DESC"
    	kill `cat $PIDFILE`
    	rm $PIDFILE
    	echo "."
      else
    	echo "$DESC is not running"
    	exit 1
      fi
    }
    case "$1" in
      start)
    	d_start
      ;;
      stop)
    	d_stop
      ;;
      status)
    	if [ -f $PIDFILE ]; then
    	  echo "$DESC is running: PID# `cat $PIDFILE`"
    	else
    	  echo "$DESC is not running"
    	fi
      ;;
      cleanup)
    	PID="`ps auxww | grep "$L_IP:$L_PORT:$R_IP:$R_PORT" | grep -v grep | awk -F' ' '{print $2}'`"
    	kill $PID
    	rm $PIDFILE
      ;;
      restart|force-reload)
    	d_stop
    	sleep 0.5
    	d_start
      ;;
      *)
    	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
    	exit 1
      ;;
    esac
    exit 0




    Edited on 2010-01-11 16:12:54 by JimLucas

    Additions:
    ~-OpenBSD / Asterisk / FreePBX installation & setup



    Oldest known version of this page was edited on 2009-08-26 12:46:23 by JimLucas []
    Page view:

    Howto's for OpenBSD


    Setting up an SSH tunnel

    ssh -2 -N -f -L 192.168.0.10:8888:172.16.0.10:80 root@localhost

    -2 forces ssh version 2
    -N Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only).
    -f forces ssh to run in the background
    -L [bind_address:]port:remote_host:hostport
    root@localhost is the user that you create the connection with

    Setting up package management

    # uname -a
    OpenBSD serv0.cmsws.com 4.3 GENERIC#698 i386
    # PKG_PATH=ftp://ftp.usa.openbsd.org/pub/OpenBSD/4.3/packages/i386/
    # export PKG_PATH
    # pkg_add rsync


    Different CLI options

    find ./ -type f -name "*.jpg" | sed -e "s/\(.*\)/\"\\1\"/" | xargs rm


    Crontab layout
    When issued as "crontab -e" this is the correct format

    minute (0-59)
    |   hour (0-23)
    |   |   day of the month (1-31)
    |   |   |   month of the year (1-12 or Jan-Dec)
    |   |   |   |   day of the week (0-6 with 0=Sun or Sun-Sat)
    |   |   |   |   |   commands
    |   |   |   |   |   |
    #### Sunday at midnight
    0   *   *   *   *   /bin/sh somecommandhere


    When issued as "crontab -e" this is the correct format

    minute (0-59)
    |   hour (0-23)
    |   |   day of the month (1-31)
    |   |   |   month of the year (1-12 or Jan-Dec)
    |   |   |   |   day of the week (0-6 with 0=Sun or Sun-Sat)
    |   |   |   |   |   user account to run command as
    |   |   |   |   |   |    commands
    |   |   |   |   |   |    |
    #### Sunday at midnight
    0   *   *   *   *   root /bin/sh somecommandhere


    How to mount different things

    1. mount CDROM
    # mkdir /mnt/cdrom
    # echo "/dev/cd0a /mnt/cdrom cd9660 ro,nodev,nosuid,noauto 0 0" >> /etc/fstab
    #mount /mnt/cdrom
    
    2. mount iso
    # vnconfig svnd0 /usr/local/share/4.1.iso
    # mount -t cd9660 /dev/svnd0c /mnt/cdrom
    
    3. mount usb
    # mkdir /mnt/usb
    # mount_msdos /dev/sd0i /mnt/usb
    Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
    Page was generated in 0.7190 seconds