CUPS #LOCAL value - local

I got two machines. One with CUPS 1.5.0 and the other with CUPS 1.6.1. The two machines are on the same local network. I want a full discovery of the printers on the network. If i run the following command:
CUPS_DEBUG_LEVEL=2 /usr/lib/cups/backend/snmp 2>&1
on both machines i get different results. The one with CUPS 1.5.0 is the result i want from the other machine with CUPS 1.6.1 too.
I figured out the problem! There is a variable called #LOCAL in CUPS. The upper command equals with:
CUPS_DEBUG_LEVEL=2 /usr/lib/cups/backend/snmp #LOCAL 2>&1
The problem is that in the second case (CUPS 1.6.1) the value of the #LOCAL is the local IP(192.168.3.69) of the machine instead of the broadcast(192.168.3.255).
If i run the following command on machine two all works perfectly:
CUPS_DEBUG_LEVEL=2 /usr/lib/cups/backend/snmp 192.168.3.255 2>&1
Please explain me how can i configure the value of the #LOCAL variable. Or why does CUPS 1.5.0 configure it well on install and 1.6.1 don't? (I did not do anything after installing, and it worked perfectly)

First...
...let's get clear what #LOCAL means:
The #LOCAL string is not exactly a variable -- in the context of CUPS configuration (/etc/cups/cupsd.conf) it's called a macro. There are more macros that could be used: #IF, #GROUP, #ACL, #OWNER and #SYSTEM.
The #LOCAL macro was introduced into CUPS with version 1.1.15. The respective CHANGELOG entry reads:
- The Allow, Deny, BrowseAllow, BrowseDeny, and
BrowseAddress directives now support the network
interface names "#LOCAL" and "#IF(name)" for access
control and browsing based on the current interface
addresses instead of fixed names or IP addresses.
In other words: before its introduction into the CUPS code base, you had to hard-code the current IP addresses of the host into cupsd.conf. Afterwards, you had the option to just instead write #LOCAL or #IF(eth0) or #IF(wlan1) in cupsd.conf and CUPS would use the current IP address (all the local IP addresses, if the box has multiple!) even if it changed. (Addresses for PPP/dialup connections don't count as local IP addresses...)
Second...
...let's see why you may see differences:
Without access to your full CUPS and network device configuration of both of your two machines it is not possible to answer the question.
It may be the case that one server has more network interfaces and/or more different IP addresses than the other (like using the eth0:1 trick to use an additional virtual network interface).
You may also have stumbled over a bug in one of the two CUPS incarnations of you machines.

Related

What is the correct way to do Port Forwarding using VMWare

I have created a VM which has a server running at localhost:8675/ which I had wanted to connect to my host machine at the same port for ease of understanding. I was following these to documents for information:
https://www.virtualbox.org/manual/ch06.html
http://www.howtogeek.com/122641/how-to-forward-ports-to-a-virtual-machine-and-use-it-as-a-server/
When I was in my VMWare Workstation, I clicked on my VM, then did: Edit > Virtual Network Editor. After that, enabled Change Settings which relaunched the window in admin mode. I clicked on the Row with Type NAT and external Connection NAT and in the VMNet Information with the NAT radio button pressed, I clicked the NAT Settings Button.
I said: Add... and then did:
Host: 8675
Type: TCP
VMIP: 127.0.0.1:8675
Description: Port Foward of 8675 from Host to VM.
It looks like everything is good. I say Ok and Apply in succession. It looked like it shut down nat and restarted some services.
I confirmed in the VM, the 127.0.0.1:8675 is correct.
In the HOST, I tried to go to: http://localhost:8675/ and it says: ERR_CONNECTION_REFUSED
I figured this was all I needed to do.
I was looking up some additional information and noticed that some people have had to configure firewalls. I wasnt sure if i needed to though, as I was thinking that the HOST and VM are all in 1 actual machine, it might be entirely self contained.
Is there a critical task I am missing?
I saw this post: https://superuser.com/questions/571196/port-forwarding-to-a-vmware-workstation-virtual-machine
which told me to just adjust it to bridged and use it that way. Does this solve the issue of connecting HOST / VM Issue.
I don't want to say this is the correct answer though as the question itself is particular to NAT, but this is a valid alternative answer that does work.
This is solves the base issue at hand, but not the question.
When you use NAT, the host system and the guest boxes have completely different IP addresses on their virtual subnet, so my guess is that when from the host system you try to connect to localhost:8675 you are actually trying to connect to port 8675 of the host and not of the guest. So don't use the localhost or 127.0.0.1 syntax, but discover the real IP address of the guest and use it.
If your guest is Windows use the ipconfig command, if Linux use ifconfig.
Probably you will also have to configure the firewall on the guest side.
EDIT:
Commenting the sentence "NAT: Used to share the host's IP address.": it probably refers to the IP address of the real ethernet adapter you have on your host and that is shared by host and guests to access the internet. That's not related to the way your host and guests communicate together. For example I use VMware Workstation to run a virtual Linux box in Windows. Selecting NAT, VMware creates a virtual subnet called VMnet8. In this subnet the virtual router has address 192.168.120.0, my Windows host is assigned a virtual ethernet adapter with address 192.168.120.1 and my Linux guest has got address 192.168.120.128. So when I want to access a Samba shared folder from Windows I type "net use * \192.168.120.128" in a Windows command prompt. When I want to access a Windows shared folder from Linux I type "sudo mount.cifs //192.168.120.1/path_to_shared_folder target_folder".
I believe you actually answered your question correctly as I was following it and achieved desired outcome.
IMHO, the error: ERR_CONNECTION_REFUSED indicates that a firewall on your host OS or guest OS (your VM) or on both doesn't allow the communication through the given ports.
The easiest thing would be to try to disable firewalls on boths, your HOST and GUEST OS.
Not sure what are your OSes, but here is just a good guide for setting up firewall rules on Ubuntu

Finding Informix DB Server

I have a server and I know that there is an Informix installed on it, but I don't know who installed it. There is closed source client connecting to this server but I cannot get anything about it apart from username and password. I have no idea how to connect it, I don't know what would be the port number and server name of it. I have downloaded SQuirreL with JDBC Informix drivers.
How can I connect to JDBC Informix server without knowing the port and server name?
In short, you will need the port number, server name (and database name as well) to connect to Informix.
Assuming that you have permissions to hunt around on the box where Informix is installed, there are a few places where the details about your Informix server are likely to be found. Since I don't see any details as to the platform on which IDS (Informix) is installed in your case, I'll try to provide info for both Unix and Windows platforms. But first, a bit of background:
There are not too many parameters needed to set up a connection to Informix. Typically, all you would need are:
username
password
Server IP Address
Port
Server Name (the name of the Informix instance)
Database Name (the name of the db on [Server Name] to which you want to connect)
It sounds like you need to find out the last three.
Linux:
On a Linux platform (as well as Windows, I believe), there are environment variables that point the way to where on your system Informix is installed. The most important of these is %INFORMIXDIR%, which points to the root directory of your Informix installation. A lot of the time however, Informix is installed in /opt, so try there.
In %INFORMIXDIR%/etc on typical installs is a file called sqlhosts (it may have a suffix for your specific server instance, but it'll start with sqlhosts). In this file is the server name, and possibly the port number. %INFORMIXDIR%/etc/sqlhosts contains plaintext data in the following format:
ServerName NetType HostName Port/ServicesName
The first value is the server name you seek. The fourth value (Port/ServicesName) is either the port number, or the name of the entry in /etc/services which references the port number. If you don't see a port number, look in /etc/services.
For example, sqlhosts will probably contain something like this:
myservername onsoctcp informix.mydomain.com 12345
In this case, your server name is "myservername" and the port is 12345
Alternatively, it could look like this:
myservername onsoctcp informix.mydomain.com informixservice
in which case you would have to go look in /etc/services for a line that says
informixservice 12345/tcp
which will tell you the port.
Windows
Caveat: I've never dealt with Informix servers installed on Windows, however based on the IBM documentation, it doesn't seem much different in regards to the task at hand.
Instead of the file %INFORMIXDIR/etc/sqlhosts, the information you seek is contained in the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\INFORMIX\SQLHOSTS
Use regedit.exe to read the values stored in this entry.
If you don't find a port number in that reg key, the Windows equivalent of Unix's /etc/services file is
C:\Windows\System32\drivers\etc\services
Examine this file with a text editor (notepad works fine).
Hopefully this helps. Good luck.
*Short answer: You can not .*
This kind of situation involves security issues , so , the database doesn't "publish" it self at your network for everyone knows it's there.
If you need discovery without contact the administrator of your (your?) environment, will need to use hackers techniques (nmap utility already help here) to discover some informations (IP, Port) and you still missing informations like servername, protocol ,username and password.
Just caution, because attempt of connection at Informix database listener will be logged.
Now, if you have access at the server where the database is you can look for sqlhosts file and get all this.
Another alternative, more reasonable is just ask to your DBA/Admin the configurations justifying why you want the access.
You CAN find servers on a host:
onstat -g dis
will listed servers even if they are offline (or potentially decommissioned).
Server information is in /INFORMIXTMP on UNIX/Linux and I would expect a simlar folder under C:\ in Windows.
You should add more information about working environment: what platform your client is, what platform your server is, do you have access to server machine etc.
If you know that something from your computer connects to other machine then you can use netstat to discover it. If you work on Linux then there is -p option that shows pid and application name to each connection.
At first we have to discover pid of closed source client:
[root#test1 ~]# ps aux | grep my_app
root 12457 0.0 3.2 3342440 333336 ? Sl Mar06 21:01 java -cp /usr/local/bin/my_app...
Now when I know pid I can use netstat:
[root#test1 ~]# netstat -tnp | grep 12457
tcp 0 0 ::ffff:169.0.1.71:55850 ::ffff:169.0.1.74:9088 ESTABLISHED 12457/java
From this output I can see that Infomix probably works on port 9088 of 169.0.1.74 machine.
On Windows you can use TCPView from SysInternals to see similar things.
On Windows you can also check ODBC Data Source Administrator (both 32 and 64 bit) to see if there is Informix driver in use.

How do you host a Ruby on Rails application on a local network, so multiple people can access it?

I'm brand new to RoR and have pretty much 0 experience with it. I have been handed down somebody else's project and I need to find a way to host the application, so people can just access it locally. The application is a spider script/walker script/web scraper whatever you call it. Basically it connects to a website, logs in, retrieves certain data each day and maps it with the previous data. While on the local machine, you use it, go to localhost:3000, and you get the webpage the previous person designed. I was just wondering how I could get that page to be public for the people on our local network, so they could connect to some arbitrary IP and see the same page (it updates daily)?
What I tried doing is making the folder containing the application public to the network, but in order to use it, I would have to make everybody on the network allowed to write to it and each person would have to install RoR to use it. I want to avoid that since it doesn't seem logical, nor is it what I'm trying to do.
Looking at the code, I can reverse engineer and understand what it does, but when it comes to hosting web apps locally or something of that sort, I have never done this before. Please help!
Thanks in advance!
**EDIT
-This is all being done on a Windows 7 machine.
Since you're on Windows, open up a command line and run ipconfig to find out your local IP. It will be listed under 'IP Address'.
Tell people in your LAN to access http://192.168.x.x:3000 replacing 192.168.x.x by your IP address from step 1.
EDIT: One major thing that I missed, you are windows. On windows u could use thin and put it behind a load balancer. Although i would suggest hosting it on a UNIX machine :)
Although Running it in webrick(webrick is the application server for development i.e when u run rails s) will let other users access the website NEVER do the same for a production application. If you want to run this application in production, u need more powerful application servers like passenger. I would suggest you use it with Apache or Nginx instead of stand alone passenger. Once all this is setup others can use your application by entering the IP(xx.xx.xx.xx) also u can ask your system admin to setup a local DNS so your users need not remember the IP address always.
Description:
While starting Rails Server, we can also setup some options to configure the IP address and also the port number of the site under development environment to host the website in local network. So if we want to change the IP from http://127.0.0.1:3000 to http://192.168.x.x:port (x= 0 to 255 any one number), we can set that in Rails server command! But for this, we will need to find out our current IP address at our current network which will help us to serve the website in local network.
So at first step:
We will open our terminal on our PC. For Android user, we need to open Termux app. Then simply type ifconfig to get the IP address of our device in the current network. We will get an output like this one (Here I'm using Android device for development. So output might be something different than this one on your PC terminal but the process is same):
$ ifconfig
Warning: cannot open /proc/net/dev (Permission denied). Limited output.
lo: flags=XX<UP,LOOPBACK,RUNNING> mtu XXXXX
inet 127.0.0.1 netmask 255.XXX.XXX.XXX
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen XXXX (UNSPEC)
wlan0: flags=XXXX<UP,BROADCAST,RUNNING,MULTICAST> mtu XXXX
inet 192.168.1.103 netmask 255.XXX.XXX.XXX broadcast 192.168.1.255
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen XXXX (UNSPEC)
X= some numbers with our device credentials which is dummied with this variable
If you are using a WiFi router then we will need the wlan0 part to get our device IP. Under wlan0 section there is a subsection of inet showing our current IP! YUP, we need that IP address 192.168.1.103! This might be different for your device and network. This is the key of this mission! Now we're going to the second important step.
So the Second Step is:
That required input command to configure the IP address.
rails s -b 192.168.1.103 -p 8080
Here:
rails s for rails server
-b 192.168.1.103 for bidding the IP address for customisation from the default IP http://127.0.0.1 which is our localhost address.
-p 8080 for port setup. This part is optional. Default port is 3000.
This is the process of changing the localhost IP (http://127.0.0.1) to local network IP which will be available for other device of the same network user.
Now our rails app is available in our local network! Other users in the same network will also be able to visit the website while the server command is running. And the link will be http://192.168.1.103:8080 if you also configure the port number. Otherwise if you have used the command rails s -b 192.168.1.103 without port configuration the link will be: http://192.168.1.103:3000
Again: 192.168.1.103 was for my case, your IP address will be different for your device. That will be needed to use for your server and link address.

Virtualbox access webservices on guest via a url

im running windows 7 as host and ubuntu 11.04 as guest.
Which would be the best way to access a webserver on a guest from host via a defined url
(and vise versa)
e.g http://myvirtualbox and http://myhost
For now i have configured a network bridge, but the guest is gets a different ip assigned everytime. A simple solution would be to assign a staic ip and configure a name resolution localy on each machine, but maybe there is an other way (internal netwok perhaps?)
You can modify the hosts file on machines to map the hostname to the IP addresses of the machines (and change their IP addresses to static).
Or another more flexible (more hosts, faster integration for new machines) option: you're going to want to set up a DNS service, configure the machines to work with it, then add the IP of the DNS as a name server in your network adapter for the hosts to use.
That will be a more flexible, maintainable and scalable solution.
From the looks of it though, if you want a 10 minute fix, go for the first option. There are lots of tutorials on it.

Cassandra Cluster Setup getting JMX error

I m trying setup a cassandra cluster as a test bed but gave the JMX remote connection error. I seem to found the answer for my error from cassandra FAQ page
Nodetool says "Connection refused to host: 127.0.1.1" for any remote host. What gives?
Nodetool relies on JMX, which in turn relies on RMI, which in turn sets up it's own listeners and connectors as needed on each end of the exchange. Normally all of this happens behind the scenes transparently, but incorrect name resolution for either the host connecting, or the one being connected to, can result in crossed wires and confusing exceptions.
If you are not using DNS, then make sure that your /etc/hosts files are accurate on both ends. If that fails try passing the -Djava.rmi.server.hostname=$IP option to the JVM at startup (where $IP is the address of the interface you can reach from the remote machine).
But can somebody help me on how to do -Djava.rmi.server.hostname=$IP
Or what to add is hosts file, i know that in hosts normally we add "IP Alias", but whose ip and alias.
I dont know much java or either linux
I m currently working on ubuntu v10.04 and cassandra v0.74
Sudesh
For JMX you need to enable JMX-remoting:
java -Dcom.sun.management.jmxremote
Depending on from where you want to access the jmx-server, you also need to specify a port:
-Dcom.sun.management.jmxremote.port=12345
and set or disable passwords.
Have a look at http://download.oracle.com/javase/1.5.0/docs/guide/management/agent.html for more details.

Resources