I have an application in PHP(running on ubuntu) which executes some commands depending on some received traps. I have a windows test client to send traps and it works well for snmp v2. I check everything from the snmptrapd log. Unfortunately the client doesn't support v3 and I must use a real device. When I use a NoBreak which sends only v3 traps snmptrapd does nothing. In fact I can see these traps on my windows client, therefore some setup in linux appears to be missing. I've been reading net-snmp page and tutorials on the internet, but I'm not really sure about what to do, because I didn't configure any aspect of security in windows and it simply works.
If you go to net-snmp docs, it's said that we need to create a user and set a password, however the nobreak seems to send a kind of broadcast. Also I didn't receive instructions for setup(I'm not saying that I don't need to do so).
The first question is:
How can I listen to a port in order to check trap reception? Maybe it's arriving but not being processed.
The second question:
How can I configure snmptrapd to receive all v3 traps? Is that possible?
Net-SNMP's snmptrapd very much does handly SNMPv3 traps. But, it does so only after you've configured it. In fact, the it won't receive any traps over any version of the protocol unless you configure it. This is for security, since it is capable of running applications when a trap is received, etc. Imagine getting a fake trap that told you the machine across town was having an issue? You'd drive all the way over there just to find out someone had sent you a bugs trap because you were accepting and believing any message that came it's way.
To set up SNMPv3 for snmptrapd, you might start with this tutorial in particular: SNMPv3 Traps
Related
I'm trying to send and receive an SNMP trap using an Ubuntu VM. Works well if I send and receive it in the same VM. But is it possible to send it to another Ubuntu VM in a different network or sending it through the internet?
Used a ton of tutorial like this but with no luck.
Any tutorials or guides for this? Been searching for days. Any help would be great. Thanks!
Yes, of course, but you will need to open up your firewalls and/or set up port forwarding so that the packets go where they need to go when they cross any network boundaries. The specific details depend on your network layout and cannot be further explained in the abstract.
I am trying to send a trap message from my agent to net-snmp but in my agent it looks like it's fine, however net-snmp doesn't show the message.
I want to know if net-snmp knows how to handle a trap message?
Normally, you would use net-snmp as an Agent.
Agents generally send traps, and don't receive them. They need to be able to handle get-requests, set-requests and get-next-requests, but not traps.
The system which receives SNMP traps is known as a Manager. Net-snmp is not an SNMP manager, but it contains all the (C) programming libraries needed for you to create your own SNMP manager, should you want to. There is also snmptrapd, which can log incoming traps into a file, or pass them to a perl script for processing.
Perhaps you're indeed asking about snmptrapd?
If traps are not logged on the receiver, normal network troubleshooting procedures apply. Snoop the traffic using Wireshark, first on the receiving system, then if needed, on the sending side. This can verify whether the traffic is dropped by the network (firewalls etc).
If you want to study the basics of the protocol, this RFC is a good starting point: "Protocol Operations for Version 2 of the Simple Network Management Protocol" http://www.ietf.org/rfc/rfc1905.txt
My company is working for a Telco who will allow us to send/receive sms using their gateway eventually but for now I need a sms gateway setup on my Win7 box that I can used to test and build an applicaton that sends and optionally receive sms messages.
I have had a look at Kannel but I cant seem to find a Win7 version or dont know how to compile and setup one on Win7.
If someone has any experience in this then please help me. Thanks
If you will be connecting to the telco it will probably be to their SMSC directly via SMPP or similar protocols, which means you will need to setup something to talk to that. Kannel is an excellent open source implementation of an SMS Gateway, and probably your best bet at this. It will take care of talking with the telco's SMSC, and will provide you with a simple HTTP based interface to submit messages to from your application.
In that case, you are better off trying to set it up sooner rather than later, because quite a bit is involved in Kannel's configuration. It requires linux based systems to run and there is no windows port.
However, in order to get started developing your application, you can look into a fake SMS Gateway that will accept the same HTTP interface as Kannel, and return back made up replies. A quick and dirty way would be to write a simple web page in any language you wish, that will accept a few parameters over a web request and print out "55124" for the new message id, or similar. Then your application can do a simple HTTP call to it to simulate sending an sms:
http://smsgateway.local/simulator.php?to=12345678&from=12345&body=hello+there
If you want something more realistic look at this list of software. There are some libraries for sending sms via mobile phone connected serially, and SMPPSim which looks like it could work for you for this.
I'm using the MS Winsock control in VB6 and I want to understand things like
"when does the Server Close the
connection (triggering the
Winsock_Close() event), and a
related question:
How do you know
when all the data from a a Post has
been returned?
More info:
I should have mentioned: I've already read the MSDN description, etc., but it doesn't actually explain what's happening. E.g., it explains the the Close() event fires when the Server ends the connection but doesn't explain what would cause the connection to end and whether a broken connection would trigger a Close event, etc.
And none of the MSDN descriptions explain know when all the data has arrived. (I suspect it's the Close even firing).
You might want to try out the following walkthrough
tcp.oflameron.com/
You can find the complete code here
If you have any Qs in particular, plz ask here...
GoodLUCK!!
- CVS
Using the Winsock Control at http://msdn.microsoft.com/en-us/library/aa733709(VS.60).aspx
MSDN Search of "Winsock control" at http://social.msdn.microsoft.com/Search/en-US?query=Winsock+control&ac=8
Documentation Lacks
The documentation will not provide the information you are asking for. This is an ActiveX control that allows you to connect computers through TCP/IP protocol stacks.
The information you want applies to how these computer "talk" (the protocol). That totally depends on the server application and client application that are communicating. For instance, if I am connecting to the FTP Service of another computer, the server will not close the connection until I send the appropriate command or until the server detects an idle connection. On the other hand, some services will close the connection on any invalid command, especially SMTP Servers will tighten security.
You need to check out the documentation of the service you are connecting with. The documentation will tell you how to send commands, command format, response codes, how commands are acknowledge, and so on.
SAMPLE: VBFTP.EXE: Implementing FTP Using WinInet API from VB at http://support.microsoft.com/kb/175179
I have a small application, which is free for personal use, but requires a paid license for corporate use.
It is most likely that in a corporate environment my application will run on multiple workstations. If it is the freeware version, I want to show an unobtrusive message. (and continue)
It doesn't have to be bulletproof, if it is not possible (i.e. firewall) then the application should just continue. And I don't want to make the user set up some kind of central service to track the instances. I don't want to annoy my users (especially not the paying ones *g*)
Is there any way to achive this kind of functionality?
I remember an older version of Dreamweaver had this kind of feature. You couldn't run it more than once in the same network.
One way: Listen for UDP broadcast on specific ports. Let each instance send broadcast UDP packet on this port to local network. If application receives such packet, and recognizes its structure, it knows that other instance is running.
You can include license details to avoid messages if two valid licenses are used.
Broadcasts usually aren't routed, so this works on local network only. (And user can disable it completely via firewall too... but if you will use some standard port like 53 (DNS), it won't be blocked).
Other way is to use custom server, which is informed about all running instances around the world ;-)
There are two primary ways to achieve this:
First, you can set up a small server application on each workstation that communicates with other workstations on the network (personally I would use Bonjour for discovery, but there are other options). The drawback here is that you're going to write quite a bit more code to make this work than option #2.
Second (probably simpler) would be to use WMI to enumerate processes on other workstations (again, probably use a Bonjour-like system for discovery), and find your process running on other machines. The drawback to this is that your enumeration code will require privileges on all machines to conduct the search.
When the application starts, it sends out a UDP broadcast on a specific port. This will be restricted to the local subnet, and might not make it through firewalls. This is the "is anyone else running, or can I start?" query.
If there are no responses, the application starts as normal, listening for this UDP broadcast. If it sees one, it responds with an "I'm already running; you can't start" packet.
The application that's just started receives this response packet and then refuses to start or (if you don't want to be that strict) displays a warning to the user.
You'd want to include the product ID and license key (or a hash) in the initial request, so that you can have more than one license on the same network. The response probably wants the machine name in it, so that the second user can go and find the first user and ask if they really need to use the application.
Evil corporation solution:
Have the application call home every time it starts. If more than one application for a license wakes up, tell it not to. If there is no internet connection, don't start at all.