Logging client time drift on an ntpd server - linux

I need to verify that a whole bunch of computers are within 50ms of ntp or nist time. Currently some are windows some are linux, and the windows machines are syncing with a domain controller that is pointed to ntp time, and each linux server is synced to a ntp pool server. Time does not seem to be a problem, but I need to prove it.
Any suggestions on methods to do this? I was hoping ntpd had some sort of logging capability, and that I could direct clients to query it and it then record the drift. I'd prefer it didn't act as authoritative time server, but just as a record keeper.

You could use a script to capture the values from ntpq and graph them in MRTG with RRD Tool.
The image below is taken from one of my Linux boxes - is that the sort of thing you are after? If you can provide some more info, and what OS the boxes you want to monitor are using I'll see if I can point you in the direction of the script I used, and provide some MRTG & RRD specific configs. My setup works on linux boxes only at the moment - and I've not had time to do any testing with Windows etc. If you where to adapt my solution to windows it would almost certainly require ntpd & ntpq rather than the standard Windows time client (as I don't believe you can get the sort of data you need from it).
Within ntpd.conf you can also enable statistics loopstats which will log data. You should check the ntpd documentation here for more info.

Related

LDAP Change/Synchronize Time in Linux

Beginner system admin here. We have a Linux server and multiple users running in LDAP (2.4.31)
Is there a way to synchronize the local date/time with all of the users? Because some CMOS batteries are already discharged. Ideally, when the LDAP user logs in, it will automatically change the local date and time.
It's hard to use the date command every time I check manually all the users. The date/time is critical to the users since there are log files that were being updated by the local time.
PS:
Setup is on-premise only
No internet connection
Goal is to one client, then all the clients/users will use that date
Ok, I am trying to make sense of your question here. I think it have nothing to do with LDAP and everything to do with time synchronisation but I could be wrong.
The part of your question I struggle to understand is "When the LDAP user logs in, it will automatically change the local date and time". Can you specify where this change occurs? Are the users that connects are on windows or linux?
I think what you need here is to use some network time protocol(NTP) servers to synchronize time across all your machines. there are plenty of public ones available for free (see : https://www.ntppool.org/en/)
on recent linux with systemd, the daemon responsible for syncing the time is systemd-timesyncd with its configuration file located at /etc/systemd/timesyncd.conf if your clients are using windows, there is a similar process to keep the clock ajusted with NTP.
If I misunderstood your question, please clarify

Syncing between a windows based server (host) and linux server(client) using SFTP

My task is to sync folders between two computers. One which acts as a windows server which is the host and the other one is a linux based server. The file transfer has to be secure and encrypted. Are there are any free softwares which will help me do this task.
Additionally the syncing should automatically happen after every pre decided interval.
I have a recollection that WinSCP can be invoked through command line. There, you have the option to synchronize folders (and the whole hierarchy there in). It may be worth trying.
Total Commander also has FTP/SFTP capabilities, but I'm not sure you can invoke it through command line.
One point to consider: If the process is to run automatically, you need to hard-code the username and password for the connection. There your security becomes compromised.

How to create custom timezone with custom DST settings using an NTP server?

I have few NTP servers that I use with multiple platforms (Ubuntu, RHEL etc). I have many machines pointing to these servers and time is synced up as expected. I need to create a custom time-zone on the NTP server such that I am able to manipulate the DST settings for this timezone? I.e. need to have the ability to perform Spring/Fall DST on any specific date on as needed basis.
Is this even possible?
Interesting question - NTP has no concept of time zones [1] nor DST [2], that is down to the underlying OS/Subsystem.
NTP simply serves up the time & date in UTC.
Not sure what your usage case is - but you would need to either look at doing what you want at OS level, or simply running everything in sync to your own version of UTC. (As in you could have a closed time domain, serve the time from 1 server and manipulate it as you wish slow it down or speed it up etc.)
Agreed with every answer here. NTP server itself has no concept of time-zones. As pointed above, I was able to get the latest tzdata from their FTP repo. Manually edited the 'northamerica' file in VI to change the DST rules. Saved and compiled using zic. This link is also very useful.

System time and file system time are not the same

I met a strange problem on one cluster with 10 nodes.
On any node, any file operation makes the access/modification/change time of that file in the future that is 1min52s after the current system time obtained from date. That makes all make command cannot work correctly.
Following command are tested: touch X, echo 123456 > X, using utimes(X,NULL) and utime(X,NULL) with a C program. All of them can reproduce this problem.
Is there anyway to solve the problem? Thanks.
The usual way to address this is to synchronize the clocks on all of the machines to a common time reference using ntp (usually to a reliable time server). The NTP FAQ and HOWTO is a good place to start.
For most Linux servers, just installing the ntp package takes you halfway. You may need to customize the configuration file (usually /etc/ntp.conf), as well as enable the service for ntpd (the NTP daemon).

Moving files from multiple Linux servers to a central windows storage server

I have multiple Linux servers with limited storage space that create very big daily logs. I need to keep these logs but can't afford to keep them on my server for very long before it fills up. The plan is to move them to a central windows server that is mirrored.
I'm looking for suggestions on the best way to this. What I've considered so far are rsync and writing a script in python or something similar.
The ideal method of backup that I want is for the files to be copied from the Linux servers to the Windows server, then verified for size/integrity, and subsequently deleted from the Linux servers. Can rsync do that? If not, can anyone suggest a superior method?
You may want to look into using rsyslog on the linux servers to send logs elsewhere. I don't believe you can configure it to delete logged lines with a verification step - I'm not sure you'd want to either. Instead, you might be best off with an aggressive logrotate schedule + rsyslog.

Resources