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
Related
I have written a blocking user system in node.js. I'm using nodejs, mongodb as data base and mongoose, expressjs and Reactjs.
I have successfully written the blocking logic and unblocking logic. I used mongoose $currentdate feature which fetches the currentdate but uses the current date of the local machine.
I simply said if expiryDate === currentdate, user should be unblocked.
I also tried to use Javascript to get the current date and it uses the local machine date and time.
Why I feel this isn't right is because the user's date and time maybe wrong. I tried this out by setting a wrong date on my local machine and the Javascript date system was setting a wrong date for me as well. This will surely make a mess of the unblocking logic.
If I write my logic using this, it can be dangerous since I do not have control over the user's local machine date and time settings.
Is there really a better way to get this done? I will be deploying the application to be hosted online in Amazon ec2 or haroku. This is part of my learning process actually. Wanted to know how this really work.
How do applications that use billing methods track my days? For instance, if I start a subscription today and the subscription lasts for 7 days, no matter the current state of my local machine date and time, the subscription will surely expire on the 7th day.
How can I achieve this? I would like the expiry logic to be independent of the user's local machine date and time.
Any npm package that can do this or best way to go about this?
If you don't want to depend on the system date, you have to use NTP (Network Time Protocol)
To use NTP in your node script, you can use an NTP module, one of these for example:
https://www.npmjs.com/package/ntp-time
https://www.npmjs.com/package/ntp-time-sync
https://www.npmjs.com/package/ntp-client
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.
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.
User downloads an App (which assume is a game) from server. I need to enforce time constraint on how long a user can run an Application on a system.
eg. Starting from the time of installation, user can use the Application till only 5 days.
My problem is, if I depend on system time/day etc for implementing this logic, user might change the system time and overcome the logic.
Platform: Linux/C++
P.S.: I have to assume a case in which user decides to not connect to internet at all after he downloaded the Application. Since I don't have network access so can't rely on server based storage about Application's installation date/time etc.
Can someone give a clue how this kind of behavior is implemented in Applications which give a trial period of their usage?
Edit:
I am adding the Algo which I am thinking:
At installation time :
At the time of installation store the current system date.
Store this info in an encrypted form into a file DRM.txt
On App startup :
Open the file and decrypt the installation date.
Get the current date from system.
Match if the application is allowed to be executed according to the number of days that have passed since user installed it.
If allowed, start the App else give error msg and return.
Problem:
Let at the time of installation system date is 19/12/2012 and user is allowed to use the App only for 4 days that is till 22/12//2012. Thus, 19/12/2012 is stored into DRM.txt.
After 4 days user changes the system date back to 20/12/2012, then my logic to check will allow this Application to run.
Hope this clarifies what I am trying to say.
This can be achieved through encryption, for example storing a date into an encrypted file, note that this won't prevent reverse engineering, etc, etc, etc
Save and check the time when start and stop the APP.
If the current time is much shorter than the saved time, then you can think it is cheating.
Sorry about the really ambiguous question, I really have no idea how to word it though hopefully I can give you more detail here.
I am developing a project where a user can log into a website and book a server to run a game for a specific amount of time. When the time is up the server stops running and the players on the server are kicked off. The website part is not a problem, I am doing this in PHP and everything works. It has a calendar system to book a server and can generate config files based on what the user wants.
My question is what should I use to run the specific game server on the linux box with those config files at the correct time? I have got this working with bash scripts and cron, but it seems very un-elegant. It literally uses FTP to connect to the website so it can download all the necessary config files and put them in a folder for that game and time. I was wondering if there was a better way of doing this. Perhaps writing a program in C, but I am not sure how to go about doing this.
(I am not asking for someone to hold my hand and tell me "write this code here", just some ideas of a better way of approaching this problem)
Thanks so much guys!
Edit: The webserver is a totaly different machine. I would theoreticaly like to have more than one game server where each of them "connects" (at the moment FTP) to the webserver, gets a file saying what it has to do at a specific time and downloads any associated files then disconnects.
I think at is better suited for running one time jobs than cron.
For a better approach for the downloading files etc, you should give more details on your setup (like, the website and the game server, are they on the same machine? Or the same network? etc etc.
You need a distributed task scheduler. With that, you can:
Schedule command "X" to be run at a certain time.
Specify the machine (or ask it to pick a machine from a pool of available machines)
Webserver would send request to this scheduler via command line or via web service when user selects a game server and a time.
You can have a look at : http://www.acelet.com/super/SuperWatchdog/index.html
EDIT :
One more option :http://jobscheduler.sourceforge.net/