LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-16-2013, 09:55 AM   #1
supasoaker
Member
 
Registered: Nov 2008
Posts: 47

Rep: Reputation: 16
Make Linux send message to server at Login


Hi all,

As a security measure I would like my laptop (which runs Fedora LXDE native) to send a message via the network to some server of my choice at login and other events (when logged in). The message will contain info such as IP and maybe other details. This way if it was stolen I can track it down when they try to switch it on.

How might I be best to go about this?
 
Old 12-16-2013, 10:09 AM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143
Anybody who would steal a laptop and then boot up the installed OS with it connected to the internet is a moron. I think the chances of that happening are slim to none. You'd be better off securing your data and then making sure it doesn't get stolen in the first place.
 
1 members found this post helpful.
Old 12-16-2013, 10:11 AM   #3
supasoaker
Member
 
Registered: Nov 2008
Posts: 47

Original Poster
Rep: Reputation: 16
Sure, but wouldn't it be great if they did do it...?
 
Old 12-16-2013, 11:01 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,326

Rep: Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920
Quote:
Originally Posted by suicidaleggroll View Post
Anybody who would steal a laptop and then boot up the installed OS with it connected to the internet is a moron. I think the chances of that happening are slim to none. You'd be better off securing your data and then making sure it doesn't get stolen in the first place.
i agree, but then again many (not most) crooks are morons. so in that slim chance (10% ?) maybe it is worth putting a 1-liner into the /etc/rc.local file.
Code:
ssh stolen@whatever.floats.your.boat &
this produces a line in /var/log/secure
Code:
Dec 16 11:17:24 hyper sshd[3322]: Invalid user stolen from 192.168.1.34
they would obviousely need internet access. they probably would be on wifi so they would need to know how to log into the machine in order to use network-manager to select an ssid.

Last edited by schneidz; 12-17-2013 at 09:38 AM.
 
Old 12-16-2013, 11:29 AM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143
Quote:
Originally Posted by supasoaker View Post
Sure, but wouldn't it be great if they did do it...?
And wouldn't it be great if they saw a label on the computer with your name and phone number and returned it to you? It's a pipe dream. Yes while thieves are idiots, they're generally not that stupid. If they were that stupid they wouldn't have been able to grab the computer without anybody noticing or saying anything in the first place.

Either way, you could add a cronjob that runs every X minutes that grabs the IP and pushes it to a 3rd party ftp/sftp server. But remember that in order for this to work, the computer needs to be able to log into that server without a password, which means that once the thief does get into the computer, they can then log into your server.

I have a similar script that runs on my home machine, but it's not to protect against theft, its to monitor my current public IP so that if it changes while I'm away from home, I know what the new address is. I'll let you deal with the logistics of securing it so the thief can't work their way backwards through your security and access your main system.

Code:
# on my web hosting machine
$ cat ip.php
<?php echo $_SERVER['REMOTE_ADDR']?>
Code:
# on the machine running this code
$ cat getip
wget -q -O - http://www.mywebhostingmachine.com/ip.php

$ cat autoip
#!/bin/bash

/path/to/getip > currentip.dat

ftp -dvin www.mywebhostingmachine.com <<EOF
   quote USER myuser
   quote PASS mypass
   put currentip.dat
   quit
EOF

rm -f currentip.dat

exit 0

$ crontab -l
0 * * * * /path/to/autoip > /dev/null 2>&1
The file "currentip.dat" exists on the web hosting machine, and it contains the public IP of the machine that is running the above commands, updated once per hour.

Last edited by suicidaleggroll; 12-16-2013 at 11:31 AM.
 
Old 12-16-2013, 11:35 AM   #6
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,326

Rep: Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920Reputation: 920
Quote:
Originally Posted by suicidaleggroll View Post
And wouldn't it be great if they saw a label on the computer with your name and phone number and returned it to you? It's a pipe dream. Yes while thieves are idiots, they're generally not that stupid. If they were that stupid they wouldn't have been able to grab the computer without anybody noticing or saying anything in the first place...
on the lock screen of my fone i have a picture with embedded text (email address). more than likely the fone will be gone forever if lost; but there is a 2% chance some nice person will email inquiring about an award if returned ?
 
Old 12-16-2013, 11:37 AM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143Reputation: 2143
Quote:
Originally Posted by schneidz View Post
on the lock screen of my fone i have a picture with embedded text (email address). more than likely the fone will be gone forever if lost; but there is a 2% chance some nice person will email inquiring about an award if returned ?
Sure, but then it hasn't been "stolen", it's been "found", and the person who found it wasn't a thief.
 
Old 12-16-2013, 10:43 PM   #8
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,285

Rep: Reputation: 466Reputation: 466Reputation: 466Reputation: 466Reputation: 466
Cool

Quote:
Originally Posted by supasoaker View Post
Hi all,

As a security measure I would like my laptop (which runs Fedora LXDE native) to send a message via the network to some server of my choice at login and other events (when logged in). The message will contain info such as IP and maybe other details. This way if it was stolen I can track it down when they try to switch it on.

How might I be best to go about this?
Just curious, let's say if you will have a software that it's working perfectly fine and able to do what you want.

So from that day onward, you have to anticipate that someone will take your box. To prove that your idea is working.

Knock the wood..just kidding..

Prevention is better than a pound of cure..
 
Old 12-17-2013, 04:33 AM   #9
supasoaker
Member
 
Registered: Nov 2008
Posts: 47

Original Poster
Rep: Reputation: 16
Hi all,

Thanks for all the input!

I would say the message needs to be sent when the login screen is accessed, so either the laptop is in a 'suspend' state and then a user wakes it up to login or the laptop is turned on.

This is obviously impractical as the amount of times I put the laptop in suspend mode would max my inbox in a matter of months. It would also annoy me. I will ponder this a bit more maybe...

I got the idea from an article with a guy who actually did it, I will try and find more info and post if anyone is interested, but think this might be a windows system. He caught the guy and even managed to get a video that he posted on YouTube of him dancing to a song using his old laptop! Apparently it went viral...

Thanks for the code examples! Either way these are great for advancing my general knowledge, thanks a bunch!

Last edited by supasoaker; 12-17-2013 at 04:37 AM.
 
Old 12-18-2013, 12:31 AM   #10
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
You could always configure the laptop to send its syslog messages to some server. Any modern syslog implementation can do this. The problem, aside from the ones mentioned above about no crook with brains powering on your laptop with an active network connection, with this is that having a poublicly available syslog server on the Internet is probably not such a great idea. However, it is fairly trivial to do. You could then set up something like logwatch on the remote syslog server to e-mail youi when certain events are logged.

From what I've heard, most stolen laptops are simply wiped and sent to the pawn shop, so this is probably not too likely to help given the trouble involved.
 
Old 12-19-2013, 01:17 PM   #11
LinuxUser42
Member
 
Registered: Nov 2010
Distribution: Lubuntu, Raspbian, Openelec, messing with others.
Posts: 143

Rep: Reputation: 19
Quote:
Originally Posted by suicidaleggroll View Post
Anybody who would steal a laptop and then boot up the installed OS with it connected to the internet is a moron. I think the chances of that happening are slim to none. You'd be better off securing your data and then making sure it doesn't get stolen in the first place.
And I know of multiple instances where Lowjack for Windows has been used sucessfully to recover them (Law enforcement relative).

I looked at that program, some years back, but a Linux version wasn't available at the time (no idea now). I did find some ways people had done something similar with Linux and at the time a couple of people trying to make a Linux version (couldn't find them again, don't think they happened).
In the end it was part of the reason I went a separate way (os on a USB key with data that needs secured on it or in an encrypted partition, the rest of the drive as open storage for non important stuff).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] postfix internet mail server sends does not send message in html davide123 Linux - Software 10 12-06-2010 04:32 PM
[SOLVED] Send message to server on Kernel Panic bameije Linux - Embedded & Single-board computer 4 07-19-2010 05:18 AM
Make a program can collect linux command output regularly and send to a tftp server fragon Programming 2 04-07-2008 05:49 PM
make connection and send message? becky_starr Programming 6 02-23-2004 05:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration