Tagged: linux

How to upload sql files from shell/bash 0

How to upload sql files from shell/bash

Importing the SQL file another way

If you have a Unix/Linux server and have SSH access to it then you can use the `mysql’ command line program to import the file like so:

mysql -u myuser -p mydatabase < myfile.sql

This will prompt you for the password for `myuser’ and then import the SQL from myfile.sql. Obviously you will need to have uploaded myfile.sql through FTP or similar. Ideally you would compress myfile.sql, upload it, uncompress it and then import using the command above.

via Overcoming file size limits when uploading SQL files to phpMyAdmin – Interspire Knowledge Base.

How to set static ip on ubuntu 0

How to set static ip on ubuntu

vim /etc/network/interfaces

dynamic:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

Static:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.1.2
        netmask 255.255.255.0
        gateway 192.168.1.1
        dns-nameservers 8.8.8.8 8.8.4.4
Zimbra 8 restrict sending to external domains 0

Zimbra 8 restrict sending to external domains

vim /opt/zimbra/conf/zmconfigd/smtpd_recipient_restrictions.cf
check_sender_access hash:/opt/zimbra/postfix/conf/restricted_senders

NExt

vim /opt/zimbra/conf/zmconfigd.cf

Search for “SECTION mta” and append directly under

    POSTCONF    smtpd_restriction_classes      local_only
    POSTCONF    local_only      FILE  postfix_check_recipient_access.cf

so it should now look like:

SECTION mta DEPENDS amavis
    POSTCONF    smtpd_restriction_classes      local_only
    POSTCONF    local_only      FILE  postfix_check_recipient_access.cf

Next

vim /opt/zimbra/conf/postfix_check_recipient_access.cf
check_recipient_access hash:/opt/zimbra/postfix/conf/local_domains, reject
vim /opt/zimbra/postfix/conf/restricted_senders
user@mydomain.com            local_only
entiredomaintoblock.com      local_only

Create file for allowed domains

vim  /opt/zimbra/postfix/conf/local_domains
alloweddomain1.com      OK 
alloweddomain2.com      OK

Run the following commands to Restart Postfix mail system and stuff

postmap /opt/zimbra/postfix/conf/restricted_senders
postmap /opt/zimbra/postfix/conf/local_domains
zmmtactl stop 
zmmtactl start
DMZ/HotLAN Traffic to LAN 0

DMZ/HotLAN Traffic to LAN

What we are essentially going to do here is to punch a hole through our proxy using iptables

The basic syntax for letting an entire DMZ network use a particular port on LAN is as follows..

iptables -I FORWARD -s DMZNetwork/24 -d LANNetwork/24 -p tcp --dport 80 -j ACCEPT

This will let the DMZ network communicate to the LAN network but only via port 80 (in the case where you have an internal server or multiple internal servers you wish everyone to access).

To let only one ip through (for instance if you want your mail server to authenticate with an active directory or ldap/ldaps server

iptables -I FORWARD -s 192.168.1.1 -d 10.0.10.1 -p tcp --dport 636 -j ACCEPT

Where 192.168.1.1 is the machine on the hotlan/dmz and 10.0.10.1 is our Active Directory/Ldaps server..

Note: the above example is set for ldaps, if you prefer use ldap (unencrypted, not recommended) change to port 389