Category: Linux

  • Export settings on a TomatoUSB router

    I copied this from Toastman:

    Flashing a new Toastman firmware version over an older one usually won’t erase your old config. However, try this method:

    1) If you paste “nvram export –set” into the “Tools/System command execution box, it will give you the file onscreen, these lines can then be pasted into another router.

    2) You could also use a small script to send it to a PC cifs share using the Scheduler e.g. “nvram export –set >/cifs1/routerconfig.txt”

  • Converting a SSL certificate from CRT format to PEM

    Some Linux applications (e.g. webmin and dovecot) require pem certificate files, to do this we use OpenSSL to convert them to pem.

    Step 1: openssl x509 -in ssl.crt -out ssl.der -outform DER
    Step 2: openssl x509 -in ssl.der -inform DER -out ssl.pem -outform PEM

  • AirPrint and Ubuntu

    This is what i did for my Canon MX850 to get AirPrint working on my Ubuntu system.

    1. Have a Standard install of Ubuntu Desktop.
    2. Go into the CUPS interface and make sure “Share published printers connected to this system” is enabled on the server settings.

    3. Install avahi-daemon and make sure it is running.

    4. Install avahi-discover and run it from a terminal. Click the printer you wish to duplicate. You should get something like:

    [code]
    Service Type: _ipp._tcp
    Service Name: Canon MX850 @ Saturn
    Domain Name: local
    Interface: eth0 IPv4
    Address: Saturn.local/10.0.0.4:30466
    TXT Binary = T
    TXT adminurl = http://Saturn:631/printers/Canon-MX850
    TXT Duplex = T
    TXT Copies = F
    TXT Collate = F
    TXT Sort = F
    TXT priority = 0
    TXT Fax = F
    TXT rp = printers/Canon-MX850
    TXT ty = Canon PIXMA iP5300 – CUPS+Gutenprint v5.2.6 Simplified
    TXT Punch = F
    TXT note = Saturn
    TXT printer-state = 3
    TXT txtvers = 1
    TXT Transparent = T
    TXT product = (Canon PIXMA iP5300)
    TXT qtotal = 1
    TXT Bind = F
    TXT printer-type = 0xB01E
    TXT Scan = F
    TXT Color = T
    TXT pdl = application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png
    TXT Staple = F
    [/code]

    5. Create file name /etc/avahi/services/mx850.service.

    6. Create an XML file similar to the example below, using the data above as the values.

    [code]

    < ?xml version="1.0" standalone=’no’?>
    < !DOCTYPE service-group SYSTEM "avahi-service.dtd">
    <service -group>
    <name replace-wildcards="yes">AirPrint MX850 @ %h</name>
    </service><service>
    <type>_ipp._tcp</type>
    <subtype>_universal._sub._ipp._tcp</subtype>
    <port>631</port>
    <txt -record>txtvers=1</txt>
    <txt -record>qtotal=1</txt>
    <txt -record>rp=printers/Canon-MX850</txt>
    <txt -record>ty=Canon PIXMA iP5300 – CUPS+Gutenprint v5.2.6 Simplified</txt>
    <txt -record>note=Saturn</txt>
    <txt -record>product=(Canon PIXMA iP5300)</txt>
    <txt -record>printer-state=3</txt>
    <txt -record>printer-type=0xB01E</txt>
    <txt -record>Transparent=T</txt>
    <txt -record>Binary=T</txt>
    <txt -record>Duplex=T</txt>
    <txt -record>Copies=F</txt>
    <txt -record>pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png</txt>
    <txt -record>URF=none</txt>
    </service>

    [/code]

    7. Save the file. avahi-daemon should notice the new file and load it without a needed restart.

    8. Add the following to /etc/cups/cupsd.conf near the top

    [code]
    ServerAlias *
    Port 631
    [/code]

    9. Restart CUPS “/etc/init.d/cups restart”

    10. On your iPhone/iPad, go into Safari, print, and search for printers. Your new printer should be in there.

    —————————-

    Update: as of June 28, AirPrint is built-in on Ubuntu 11.10.
    1. On your computer start system-config-printer via System ->
    Administration -> Printing (GNOME Classic) or via Turn-off-button at the
    upper right -> System Settings -> Hardware -> Printing (Unity Natty) or
    via the command line (all systems including Unity Oneiric).

    2. In system-config-printer choose Server -> Settings and activate
    “Published shared printers connected to this system”. Click OK and then
    right-click on the icon of your print queue and choose Properties in the
    pop-up menu. In the Policies section of the dialog make sure that
    “Shared” is activated.

    3. Make sure your mobile device is accessing your local network using
    WLAN and then open an application with printing functionality on it
    (like for example the browser or the photo viewer). Print something. The
    print dialog should show your print queue and allow some basic settings.
    Note that the Description/Info field and not the name of the queue is shown.

    4. Check whether you get a correct printout.

  • Making ReadyNAS more secure

    By default Readynas uses a weak SSH key and apache configurations.

    Regenerate SSH keys by running the follow:

    [code]
    # ssh-keygen -t rsa1 -f "/etc/ssh/ssh_host_key" -N ”
    # ssh-keygen -t rsa -f "/etc/ssh/ssh_host_rsa_key" -N ”
    # ssh-keygen -t dsa -f "/etc/ssh/ssh_host_dsa_key" -N ”
    [/code]

    Securing apache running the follow:

    [code]
    vi /etc/frontview/apache/httpd.conf
    [/code]

    Add the following

    [code]
    SSLProtocol all -SSLv2
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
    TraceEnable off
    [/code]

    run the follow to restart the apache server

    [code]
    # killall apache-ssl
    # /usr/sbin/apache-ssl -f /etc/frontview/apache/httpd.conf
    [/code]

  • Wireless Router TomatoUSB Firmware

    Tomato firmware is great compared to DD-WRT, it has loopback and is compatible with playing Netflix on the iphone.

    Also it store the Bandwidth stats on RAM and saves it to Samba share or usb flash drive. Where as DD-WRT writes this to the NVRAM which will wear out the NVRAM chip.

    Also setting up IPv6 is also easier and it will update your ip address with Hurricane Electric Free IPv6 Tunnel Broker which is a plus when you have a dynamic ip address with your ISP.

    Here’s another plus for laptop users, you can assign an ip address to two mac addresses for your wireless card and ethernet card so that you will have the same ip address for both interfaces. This allows you to transfer files off of your NAS wireless and then connect your ethernet cable to continue the file transfer at a faster speed and back again without dropping your connections to your network.

    http://www.myopenrouter.com/download/list?cat=50

    Or http://tomatousb.org

    Tomato 1.28 includes the following:

    All the current “Teddy Bear” features are included, notably:
    – USB Support, Samba, FTP, Media Servers
    – Web Monitor
    – Per-connection transfer rates
    – Byte counter added to QOS/Details
    – QOS rule ID added to QOS/Details
    – Additional ipv6 support in GUI, QOS, Conntrack

    “Toastman” Features:
    – 250 entry Static DHCP | 500 entry Access Restrictions
    – QOS class labels | Toastman QOS rules
    – Fast conntrack timeout | Fast auto refresh
    – Tools/System refresh timer
    – Safe CPU frequency selector
    – Loads upnpconfig.custom from JFFS, for VPN UPnP support

  • Restoring DD-WRT NAT Loopback

    Run within Administration > Commands > save as a firewall script

    [code]
    iptables -t nat -I POSTROUTING -o br0 -s 10.0.0.0/24 -d 10.0.0.0/24 -j MASQUERADE
    [/code]

  • Dropbox

    Dropbox is great!
    I have been using it for over a year now and it is fast and reliable for syncing my files across my machines and sharing files with coworkers, friends and family.

    They use SSL encryption so your files are safe. You can also use TrueCrypt on top of Dropbox for your top secret files or very personal files.

    Plus you get 2GB free to start with.
    Try Dropbox for free.

  • Linux System Disk Quota

    Setting up quota on a Linux system for the main partition
    1–touch /aquota.user; chmod 600 /aquota.user
    2– edit the /etc/fstab `/dev/sda1 / ext4 defaults,usrquota 1 1`
    3– Reboot Or `mount -o remount /`
    4– `quotacheck -vuma`
    5– `quotaon -avu`
    6– `edquota `