Hello Bear Giles,<br>Thanks for your reply<br>Sorry for my late reply.<br><br><br><div class="gmail_quote">On Fri, Oct 7, 2011 at 9:30 PM, Bear Giles <span dir="ltr"><<a href="mailto:bgiles@coyotesong.com">bgiles@coyotesong.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><font color="#000000"><font face="tahoma,sans-serif">Heh, for some reason I thought this was on the local linux users group instead of ubuntu-devel. Hence the more generic language.<br>
</font></font><div><font face="tahoma, sans-serif"><br>
</font></div><div><font face="tahoma, sans-serif">Anyway feel free to take the other two points as possible products.</font> <br></div></blockquote><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><font face="tahoma, sans-serif">My prototypes have been shell commands followed by simple java apps that did the same work. In both cases they directly read the files in /var/lib/dpkg/info or, in a few cases, the naked .deb files. They were always intended as </font><span style="font-family:tahoma, sans-serif">proof-of-concept demos, not something suitable for distribution.</span></div>
</blockquote><div><br>Ok. We can gather information about the packages installed files using these files.<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><font face="tahoma, sans-serif"><br>The two specific tasks that came up a lot are:</font></div><div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif">1. List all files under { /bin, /sbin, /usr, /lib, /etc and parts of /var } that:</font></div>
<div><font face="tahoma, sans-serif"> a) are present but not in a package as either a regular file or a conffile,</font></div><div><font face="tahoma, sans-serif"> b) are present but have a different md5sum than the package, or</font></div>
<div><font face="tahoma, sans-serif"> c) are in an installed package but not present.</font></div><div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif">This can return a simple list of files that can be used as input to other applications.</font></div>
</blockquote><div> </div><div>So these files are the files which need to be backed up? Actually could you please somewhat point out what needs to done when a restore point is created or when a restore is required. I understand from your idea that we are creating a restore point whenever user installs a new package and restore would be done when the user needs that. The above things need to be done when a restore is required by the user, I guess? So the system restore will remove (a) , overwrite/ replace (b) and copy (c) from the package .deb files , which will be either downloaded from the Internet.<br>
Now these files will be copied to the directories by the restore program. There is an issue involved in this if the files in <font face="tahoma, sans-serif"> /var/lib/dpkg/info are themselves modified/damaged/corrupted which would leave the system in an inconsistent state.<br>
</font></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif">An extension is to check the permissions, e.g., by looking into the .deb file itself and examining the data.tar.gz file. There's also always the standby</font></div>
<div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif"> $ find / -perm +1000 -ls</font></div><div><font face="tahoma, sans-serif"> $ find / -perm +2000 -ls</font></div>
<div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif">to find suid/sgid files in the system. Simply knowing what files should have these permissions would be helpful.</font></div>
<div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif">You can do a quick MD5 sanity check with</font></div><div><font face="tahoma, sans-serif"><br>
</font></div><div><font face="tahoma, sans-serif"> $ cat /var/lib/dpkg/info/*.md5sums | sort | uniq >/tmp/md5sums</font></div><div><font face="tahoma, sans-serif"> $ md5sum -c /tmp/md5sums</font></div></blockquote>
<div> </div><div>Ok. Thanks for help I will try these things, would checking the file permissions help? in case user deliberately modified the permissions of certain files so as to solve certain issues.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif">2. Create a local package containing modified conffiles.</font></div><div><font face="tahoma, sans-serif"><br>
</font></div><div><font face="tahoma, sans-serif">You can get a list of conffiles from</font></div><div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif"> $ cat /var/lib/dpkg/info/*.conffiles | sort | uniq >/tmp/conffiles</font></div>
<div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif">and convert that to a list of md5 files with a join with a bit of work. (conffiles have a leading slash on the path, md5sums do not). Then it would be a simple matter of creating a tarball of the modified files and wrapping it up so that you can perform all of your customization by installing a single package.</font></div>
</blockquote><div><br>So we will create a package which when installed will revert the system to the state at the restore point/earlier state ? But this might cause problems when the dpkg files are themselves corrupt and system is in an inconsistent state and dpkg cannot be used for installing or removing packages, in that case this method won't work. But still will work for a lot many situations. We have to perform this step whenever user needs to create a restore point ? So that the files and state of the system is saved.<br>
<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif">3. Not related to the original question but I've also wondered about a hardening package that installs a cron task that's package-aware. That is, I (should) be regularly performing tasks like:</font></div>
<div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif"> $ find { everything but /dev } -type b -ls</font></div>
<div><font face="tahoma, sans-serif"> $ find { everything but /dev } -type c -ls</font></div><div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif">That is, looking for character or block devices that are anywhere but under /dev. That's never a good thing.</font></div>
<div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif"> $ find /home -uid -1000</font></div><div><font face="tahoma, sans-serif"><br>
</font></div><div><font face="tahoma, sans-serif">That is, looking for any system files under /home. Again this is never a good thing.</font></div><div><font face="tahoma, sans-serif"><br>
</font></div><div><font face="tahoma, sans-serif">There's a dozen or so checks that can be done but in some cases there will be expected hits, depending upon the actual packages installed. It should be possible to customize this task so it knows what to ignore and what to flag as a problem.</font></div>
</blockquote><div> </div><div>Ok. We can also add a feature to exclude/include certain directories as to be restored , as user might be aware of these things like system files under home.<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><font face="tahoma, sans-serif"><br></font></div><font color="#888888"><div><font face="tahoma, sans-serif">Bear</font></div></font><div><div></div><div class="h5"><div><font face="tahoma, sans-serif"><br>
</font></div><div><font face="tahoma, sans-serif"><br></font></div><div><div class="gmail_quote">On Fri, Oct 7, 2011 at 2:35 AM, Michael Vogt <span dir="ltr"><<a href="mailto:mvo@ubuntu.com" target="_blank">mvo@ubuntu.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Thu, Oct 06, 2011 at 05:15:14PM -0600, Bear Giles wrote:<br>
> I've written a few prototypes and this comes down to four issues. Some of<br>
> the details below are debian/ubuntu-specific but the same concepts will<br>
> apply to redhat.<br>
</div>[..]<br>
<div>> 2. Packages should NOT be backed up. All you need is the package name and<br>
> version. Reinstall from .deb and .rpm if necessary since this way you're<br>
> sure that you never restore compromised files.<br>
<br>
</div>You may want to look at the apt-clone package for this part of the<br>
work, it supports creating/restoring this meta-data.<br>
<br>
Cheers,<br>
<font color="#888888"> Michael<br>
</font><div><div></div><div><br>
<br>
> On Fri, Sep 30, 2011 at 12:01 AM, Gaurav Saxena <<a href="mailto:grvsaxena419@gmail.com" target="_blank">grvsaxena419@gmail.com</a>>wrote:<br>
><br>
> > Hello Aaron<br>
> > Thanks a lot for your quick reply.<br>
> ><br>
> > On Fri, Sep 30, 2011 at 10:03 AM, Aaron C. de Bruyn <<a href="mailto:aaron@heyaaron.com" target="_blank">aaron@heyaaron.com</a>>wrote:<br>
> ><br>
> >> In Windows, the ability to snapshot is built into the filesystem.<br>
> >> In Linux, you must be running a filesystem that supports snapshots. I<br>
> >> know LVM supports snapshotting and I believe BRTFS has support, but<br>
> >> other than that I'm not sure.<br>
> >><br>
> >> Yes I read the logic behind windows system restore. But I think we can<br>
> > take some other approach for this, that will be better as all users won't be<br>
> > able to spare an extra partition formatted brtfs.<br>
> ><br>
> ><br>
> >> Basically, your program would have to check the file system that is<br>
> >> used on the computer (remember Linux can have many types of file<br>
> >> systems mounted at the same time), then (in the case of LVM) make sure<br>
> >> there's enough free space to snapshot, and finally take the snapshot.<br>
> >><br>
> >> Ok. Do I have to snapshot the whole system partition / important system<br>
> > files to the brtfs partition ?<br>
> ><br>
> ><br>
> >> When the snapshots start filling up, you would either need to delete<br>
> >> them or detect the low space and resize them.<br>
> >><br>
> >> In my personal opinion, snapshotting in Linux is currently a pain in<br>
> >> the rear. It sounds like BTRFS could change that, but it's still a<br>
> >> ways off.<br>
> >><br>
> >> Ok. I will try another approach that will be better as suggested by<br>
> > people here.<br>
> ><br>
> ><br>
> >> -A<br>
> >><br>
> >><br>
> >> On Thu, Sep 29, 2011 at 21:00, Gaurav Saxena <<a href="mailto:grvsaxena419@gmail.com" target="_blank">grvsaxena419@gmail.com</a>><br>
> >> wrote:<br>
> >> > Hello all,<br>
> >> > I want to write a windows system restore like program for ubuntu , which<br>
> >> > will have options for creating restore points for the system and then<br>
> >> > restoring it back to that point. Also I will as an extension provide<br>
> >> support<br>
> >> > for older version of a file as is in windows currently. I need your help<br>
> >> to<br>
> >> > find how to start with this in ubuntu. I know that I have to snapshot<br>
> >> the<br>
> >> > system when creating a restore point and then restore it. I need some<br>
> >> > starting pointers so that I can start doing this work. Also if this has<br>
> >> > already been done please inform me. I got this idea from<br>
> >> > <a href="https://wiki.ubuntu.com/SystemRestore" target="_blank">https://wiki.ubuntu.com/SystemRestore</a>.<br>
> >> > --<br>
> >> > Thanks and Regards ,<br>
> >> > Gaurav<br>
> >> ><br>
> >> > --<br>
> >> > Ubuntu-devel-discuss mailing list<br>
> >> > <a href="mailto:Ubuntu-devel-discuss@lists.ubuntu.com" target="_blank">Ubuntu-devel-discuss@lists.ubuntu.com</a><br>
> >> > Modify settings or unsubscribe at:<br>
> >> > <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss</a><br>
> >> ><br>
> >> ><br>
> >><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Thanks and Regards ,<br>
> > Gaurav<br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Thanks and Regards ,<br>
> > Gaurav<br>
> ><br>
> > --<br>
> > Ubuntu-devel-discuss mailing list<br>
> > <a href="mailto:Ubuntu-devel-discuss@lists.ubuntu.com" target="_blank">Ubuntu-devel-discuss@lists.ubuntu.com</a><br>
> > Modify settings or unsubscribe at:<br>
> > <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss</a><br>
> ><br>
> ><br>
<br>
> --<br>
> Ubuntu-devel-discuss mailing list<br>
> <a href="mailto:Ubuntu-devel-discuss@lists.ubuntu.com" target="_blank">Ubuntu-devel-discuss@lists.ubuntu.com</a><br>
> Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss</a><br>
<br>
</div></div></blockquote></div><br></div>
</div></div><br>--<br>
Ubuntu-devel-discuss mailing list<br>
<a href="mailto:Ubuntu-devel-discuss@lists.ubuntu.com">Ubuntu-devel-discuss@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Thanks and Regards ,<br>Gaurav<br>