Category Archives: bind

Subdomain with BIND9

I wanna check on how to get my subdomain working

I have about few hundreds subdomain, I want to use wildcard instead e.g

*.example.com

Here is my bind data for my ns1.example.com

;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.example.com. support.example.com. (
                              17        ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      ns1.example.com.
@       IN      A       128.199.70.11
*       IN      A       128.199.70.11
@       IN      AAAA    ::1

I restart bind9 , but it still doesn't work. My example.com and www.example.com works because I create a bind data file for each of them, I also updated named.conf.local

 zone "ns1.example.com" {
             type master;
             file "/etc/bind/ns1.example.com";
        };

 zone "ns2.example.com" {
             type master;
             file "/etc/bind/ns1.example.com";
        };


zone "70.199.128.in-addr.arpa" {
        type master;
        notify no;
        file "/etc/bind/db.192";
};

How could I get *.example.com to works, so all my subdomain will works once I point my nameserver over.

Additional question:

how do I get my dns zone file to work for any domain, so anyone who point over their site will able to load into my dns.

Thanks

ActiveMQ Java bind topic to queue

I'm working on an Apache ActiveMQ broker and i would like to forward a topic to a queue as a compositeDestination should do (see : Composite Destination)

In order to do this, I use Java and the ActiveMQ library. I would like to bind a topic, for example "event/sensor", to a queue named "destination".

The objective is to do in Java what we does on the XML file like this

<destinationInterceptors>
  <virtualDestinationInterceptor>
    <virtualDestinations>
      <compositeQueue name="event/sensor">
        <forwardTo>
          <queue physicalName="destination" />
        </forwardTo>
      </compositeQueue>
    </virtualDestinations>
  </virtualDestinationInterceptor>
</destinationInterceptors>

Here is my code

Broker.java

public class Broker {

    private BrokerService broker;

    public Broker(String connector) {
        this.broker = new BrokerService();

        this.broker.setUseJmx(true);

        try {
            this.broker.addConnector(connector);
            this.broker.start();

        } catch (URISyntaxException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void start() {
        try {
            this.broker.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void bindToQueue(String destination, String toBind) {

        ActiveMQQueue queue = new ActiveMQQueue(destination);
        ActiveMQDestination[] binding = {queue};
        try{
            ActiveMQDestination[] tab = this.broker.getRegionBroker().getDestinations();
            for (int i = 0; i < tab.length; i++) {
                if (tab[i].getPhysicalName().equals(toBind)) {
                    System.out.println("Binding "+tab[i].getPhysicalName()+" to"+binding[0]);

                    tab[i].setCompositeDestinations(binding);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}

Main.java

public class Main {

    public static void main(String[] args) {

        String host = "192.168.100.25";
        String port = "1883";
        String brokerURI = "tcp://" + host + ":" + port;
        String destination = "destination";
        String topic = "event/sensor";

        MqttConnectOptions options = new MqttConnectOptions();

        Broker broker = new Broker("mqtt://" + host + ":" + port);

        broker.bindToQueue(destination, topic);

        JavaPub publisher = new JavaPub(brokerURI, "pub", new MemoryPersistence(),topic);
        publisher.connection(options);
        Thread t1 = new Thread(publisher);
        t1.start();

        SubscriberMQTT sub = new SubscriberMQTT(brokerURI, "testSub", "", "", 2);
        sub.subscribe("queue://"+destination);
        Thread t2 = new Thread(sub);
        t2.start();

    }
}

In this code I have a publisher and a subscriber which works (when I don't bind I have all the results as exepected).

I have tried to print the compositeDestinations of the topic which should be bound using

System.out.println(tab[i] +" bound to "+tab[i].getCompositeDestinations()[0]);

and this returns me queue://destination boundd to queue://destination

So I guess I am doing something wrong but I can't figure out what.

Could you help me ?

Thanks Alexi

Apache Camel Data mapping to store data

I am new to the Apache camel.

Can some please help me with some example for data mapping for below scenario.

I have a camel route which reads a large text file delimited with '|' (pipe) and each new record delimited with '\n' (new line). Now I want store this data to the corresponding TABLES. I know the order which data goes to which column in which table (tables have relationships). But I am not sure how to map this data.

What is the approach how to achieve this?.

Input file format
 id|name|semester|java
 1|ABC|1st|80|

 1   - column1 TableA
 ABC - coulmn2 TableA
 1st - coulmn1 TableB
 80  - coulmn1 TableC

apache httpd ldap directive issue

I have issue validating httpd login with LDAP. The fustrating thing is httpd crashes and do not even get proper log.

Note I use apache 2 on centos with SSL(https: created by me)

I have done successful search using LDAPSEARCH which worked fine. But I try to configure it in HTTPD I have issue.

LDAPSEARCH:

ldapsearch -H ldap://12.34.56.78 -x -b cn=users,dc=mycompany,dc=com -D [email protected] -w 'mypassword'

The above works good. IF you notice -D is my email which is the binddn.

So from above, I want apache httpd to take in email and password to hit the above ip and get a good OK. Thats about it. But No luck.

AuthType Basic AuthName "Login with email address"
AuthLDAPEnabled on AuthzLDAPAuthoritative off AuthLDAPURL ldap://ldap.your-domain.com:389/cn=users,dc=mycompany,dc=com?mail
Require valid-user

Observation, I do feel that LDAP is getting it alright. But httpd crashes.

Note: I donot want to use this AuthLDAPBindDN , AuthLDAPBindPassword since I want to bind with user inputs.

Thank You!

org.jibx: maven-jibx-plugin:1.2.1 – Error reading path

I am trying to execute a goal using maven-jibx-plugin version 1.2.1, but I am getting the following error:

[ERROR] Failed to execute goal org.jibx:maven-jibx-plugin:1.2.1:bind (default) on project XoXcertExIm: Error loading class java.lang.CharSequence: Error reading path java/lang/CharSequence.class for class java.lang.CharSequence -> [Help 1]

I am using Maven 3.2.5, Java versions 1.8.0_11, and windows 7 as the OS.

org.jibx: maven-jibx-plugin:1.2.1 – Error reading path

I am trying to execute a goal using maven-jibx-plugin version 1.2.1, but I am getting the following error:

[ERROR] Failed to execute goal org.jibx:maven-jibx-plugin:1.2.1:bind (default) on project XoXcertExIm: Error loading class java.lang.CharSequence: Error reading

path java/lang/CharSequence.class for class java.lang.CharSequence -> [Help 1]

I am using Maven 3.2.5, Java versions 1.8.0_11, and windows 7 as the OS.

Apache different sites on different ports, still links to same site. Bind9 for domain names

I've been trying to create 3 different domains linking to 3 different sites on the same machine, 2 which works but the third on the different port links to the first page.

My apache config looks like this:

Listen 81
NameVirtualHost *:81
<VirtualHost *:80>
    ServerName www.example.com
    DocumentRoot /var/www/www
</VirtualHost>

<VirtualHost *:80>
    ServerName www2.example.com
    DocumentRoot /var/www/www2
</VirtualHost>

<VirtualHost *:81>
    ServerName controlpanel.example.com
    DocumentRoot /var/www/controlpanel
</VirtualHost>

I've used Bind9 to set up the domains.

www     IN      A       123.123.123.123
www2    IN      A       123.123.123.123
controlpanel   IN      A       123.123.123.123

www and www2 works fine and shows the correct site, however controlpanel.example.com also links to the first www site. When I enter the port manualy on the ip, xxx.xxx.xxx.xxx:81, i get linked correctly. The thing is that I don't really know where I'm doing it wrong, this is the first time I'm trying anything like this. You got any ideas?

Im also running this on an old ubuntu 12.04 server.

Point a domain name to my VPS

I would like to point my domain (domain.com) name to my VPS (OS = Debian).

I installed : Bind9 and DNSUtils.

in /etc/bind/zones/master/ I created db.domain.org :

;
; BIND data file for domain.org
;
$TTL    3h
@       IN      SOA     ns1.domain.org. admin.domain.org. (
                          1        ; Serial
                          3h       ; Refresh after 3 hours
                          1h       ; Retry after 1 hour
                          1w       ; Expire after 1 week
                          1h )     ; Negative caching TTL of 1 day
;
@       IN      NS      ns1.domain.org.
@       IN      NS      ns2.domain.org.


linuxconfig.org.    IN      MX      10      mail.domain.org.
linuxconfig.org.    IN      A       192.168.0.10
ns1                     IN      A       192.168.0.10
ns2                     IN      A       192.168.0.11
www                     IN      CNAME   domain.org.
mail                    IN      A       192.168.0.10
ftp                     IN      CNAME   domain.org.

and I created also the file /etc/bind/zones/master/db.192.168.0

;
; BIND reverse data file for 0.168.192.in-addr.arpa
;
$TTL    604800
0.168.192.in-addr.arpa.      IN      SOA     ns1.domain.org. admin.org.org. (
                          1         ; Serial
                          3h       ; Refresh after 3 hours
                          1h       ; Retry after 1 hour
                          1w       ; Expire after 1 week
                          1h )     ; Negative caching TTL of 1 day
;
0.168.192.in-addr.arpa.       IN      NS      ns1.domain.org.
0.168.192.in-addr.arpa.       IN      NS      ns2.domain.org.

10.0.168.192.in-addr.arpa.   IN      PTR     domain.org.

And then configured named.conf.local :

zone "domain.org" {
       type master;
       file "/etc/bind/zones/master/db.domain.org";
};

zone "0.168.192.in-addr.arpa" {
       type master;
       file "/etc/bind/zones/master/db.192.168.0";
};

Finally I updated named.conf.options :

 forwarders {
          8.8.4.4;
     };

I went to my domain seller's admin interface and I changed domain name servers to ns1.domain.prg and ns2.domain.org

I waited for 2 days nothing hapenned, domain.org doesn't point to my website hosted on my VPS.

Update:

This is what chromuim browser says when I visit domain.org:

The server at domain.org can't be found, because the DNS lookup failed. Error code: ERR_NAME_NOT_RESOLVED