Kirjoittaja Aihe: Aikarajoitukset koneen käyttöön? (etc/security/time.conf)[Ratkaistu]  (Luettu 4351 kertaa)

Senior

  • Vieras
Vs: Aikarajoitukset koneen käyttöön? (etc/security/time.conf)
« Vastaus #20 : 16.03.10 - klo:21.10 »
Eli on kokeiltu kahdella eri tavalla:

 login & ssh;tty* & !ttyp*;kayttaja;!Al1800-0600
 login & ssh;tty* & !ttyp*;kayttaja;!Al0600-1800

...buutattu kone....eikä mitään vaikeuksia päästä työasemaan klo 21

Taro Turtiainen

  • Käyttäjä
  • Viestejä: 579
    • Profiili
    • Taro Turtiainen
Vs: Aikarajoitukset koneen käyttöön? (etc/security/time.conf)
« Vastaus #21 : 16.03.10 - klo:21.18 »
Eli on kokeiltu kahdella eri tavalla:

 login & ssh;tty* & !ttyp*;kayttaja;!Al1800-0600
 login & ssh;tty* & !ttyp*;kayttaja;!Al0600-1800

...buutattu kone....eikä mitään vaikeuksia päästä työasemaan klo 21

Muokkasitko myös tuossa ohjeessa mainittuja tiedostoja?
/etc/pam.d/gdm
/etc/pam.d/login
VASEMMISTOLIITTO - RIKKAUTTA JOLLA ON ARVOA

”Ei ole olemassa todellista vapautta ilman toisinajattelun vapautta.” Rosa Luxemburg 1918

Senior

  • Vieras
Vs: Aikarajoitukset koneen käyttöön? (etc/security/time.conf)
« Vastaus #22 : 17.03.10 - klo:08.55 »
Kyllä laitoin ja nyt meni vähän liiankin hyvin. En enää päässyt ollenkaan järjestelmään.  ::)

täytyy miettiä vielä noissa gdm- ja login-tiedostoissa että mihin kohtaan tarkalleen nuo rivit olisi laitettava.

"...just below the auth entries."

eli mihin "auth entries" päättyvät niin niiden alapuolelle siis rivit.

Senior

  • Vieras
Vs: Aikarajoitukset koneen käyttöön? (etc/security/time.conf)
« Vastaus #23 : 17.03.10 - klo:09.14 »
Tällaisilta näytti gdm-tiedosto:

#%PAM-1.0
auth    requisite       pam_nologin.so
auth    required        pam_env.so readenv=1
auth    required        pam_env.so readenv=1 envfile=/etc/default/locale
@include common-auth
auth    optional        pam_gnome_keyring.so
 login & ssh;tty* & !ttyp*;kayttaja;!Al0830-2300
@include common-account
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close
session required        pam_limits.so
@include common-session
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open
session optional        pam_gnome_keyring.so auto_start
@include common-password



login-tiedosto:

#
# The PAM configuration file for the Shadow `login' service
#

# Enforce a minimal delay in case of failure (in microseconds).
# (Replaces the `FAIL_DELAY' setting from login.defs)
# Note that other modules may require another minimal delay. (for example,
# to disable any delay, you should add the nodelay option to pam_unix)
auth       optional   pam_faildelay.so  delay=3000000

# Outputs an issue file prior to each login prompt (Replaces the
# ISSUE_FILE option from login.defs). Uncomment for use
# auth       required   pam_issue.so issue=/etc/issue

# Disallows root logins except on tty's listed in /etc/securetty
# (Replaces the `CONSOLE' setting from login.defs)
# Note that it is included as a "requisite" module. No password prompts will
# be displayed if this module fails to avoid having the root password
# transmitted on unsecure ttys.
# You can change it to a "required" module if you think it permits to
# guess valid user names of your system (invalid user names are considered
# as possibly being root).
auth       requisite  pam_securetty.so

# Disallows other than root logins when /etc/nologin exists
# (Replaces the `NOLOGINS_FILE' option from login.defs)
auth       requisite  pam_nologin.so

# SELinux needs to be the first session rule. This ensures that any
# lingering context has been cleared. Without out this it is possible
# that a module could execute code in the wrong domain.
# When the module is present, "required" would be sufficient (When SELinux
# is disabled, this returns success.)
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close

# This module parses environment configuration file(s)
# and also allows you to use an extended config
# file /etc/security/pam_env.conf.
#
# parsing /etc/environment needs "readenv=1"
session       required   pam_env.so readenv=1
# locale variables are also kept into /etc/default/locale in etch
# reading this file *in addition to /etc/environment* does not hurt
session       required   pam_env.so readenv=1 envfile=/etc/default/locale

# Standard Un*x authentication.
@include common-auth

# This allows certain extra groups to be granted to a user
# based on things like time of day, tty, service, and user.
# Please edit /etc/security/group.conf to fit your needs
# (Replaces the `CONSOLE_GROUPS' option in login.defs)
auth       optional   pam_group.so

# Uncomment and edit /etc/security/time.conf if you need to set
# time restrainst on logins.
# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs
# as well as /etc/porttime)
# account    requisite  pam_time.so
login & ssh;tty* & !ttyp*;kayttaja;!Al0830-2300

# Uncomment and edit /etc/security/access.conf if you need to
# set access limits.
# (Replaces /etc/login.access file)
# account  required       pam_access.so

# Sets up user limits according to /etc/security/limits.conf
# (Replaces the use of /etc/limits in old login)
session    required   pam_limits.so

# Prints the last login info upon succesful login
# (Replaces the `LASTLOG_ENAB' option from login.defs)
session    optional   pam_lastlog.so

# Prints the motd upon succesful login
# (Replaces the `MOTD_FILE' option in login.defs)
session    optional   pam_motd.so

# Prints the status of the user's mailbox upon succesful login
# (Replaces the `MAIL_CHECK_ENAB' option from login.defs).
#
# This also defines the MAIL environment variable
# However, userdel also needs MAIL_DIR and MAIL_FILE variables
# in /etc/login.defs to make sure that removing a user
# also removes the user's mail spool file.
# See comments in /etc/login.defs
session    optional   pam_mail.so standard

# Standard Un*x account and session
@include common-account
@include common-session
@include common-password



# SELinux needs to intervene at login time to ensure that the process
# starts in the proper default security context. Only sessions which are
# intended to run in the user's context should be run after this.
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open
# When the module is present, "required" would be sufficient (When SELinux
# is disabled, this returns success.)


..ja etc/security/time.conf-tiedosto

login & ssh;tty* & !ttyp*;kayttaja;!Al0830-2300

...jotain mäihää noissa

Jakke77

  • Käyttäjä
  • Viestejä: 3933
  • Oulu (Oinaansuo)
    • Profiili
Vs: Aikarajoitukset koneen käyttöön? (etc/security/time.conf)
« Vastaus #24 : 17.03.10 - klo:09.31 »
en ole conf asiantuntija mutta pitäiskö tämä muuttaa hieman

# This module parses environment configuration file(s)
# and also allows you to use an extended config
# file /etc/security/pam_env.conf.
#

muotoon:

# This module parses environment configuration file(s)
# and also allows you to use an extended config
 file /etc/security/pam_env.conf.
#

ja ehkä:

# Uncomment and edit /etc/security/access.conf if you need to
# set access limits.
# (Replaces /etc/login.access file)
 account  required       pam_access.so
U_G_H

Aspire E5-575G V1.27 CPU: Intel i3-6100U (4) @ 2.300GHz GPU: Intel® HD Graphics 520 GPU: NVIDIA GeForce 940MX Samsung SSD 970 EVO Plus 500GB

Taro Turtiainen

  • Käyttäjä
  • Viestejä: 579
    • Profiili
    • Taro Turtiainen
Vs: Aikarajoitukset koneen käyttöön? (etc/security/time.conf)
« Vastaus #25 : 17.03.10 - klo:09.40 »
en ole conf asiantuntija mutta pitäiskö tämä muuttaa hieman

# This module parses environment configuration file(s)
# and also allows you to use an extended config
# file /etc/security/pam_env.conf.
#

muotoon:

# This module parses environment configuration file(s)
# and also allows you to use an extended config
 file /etc/security/pam_env.conf.
#

ja ehkä:

# Uncomment and edit /etc/security/access.conf if you need to
# set access limits.
# (Replaces /etc/login.access file)
 account  required       pam_access.so

Tuossa ohjeessa on näin:

Lainaus
Next edit the /etc/pam.d/gdm file and add

account required pam_time.so

just below the auth entries.

Now edit /etc/pam.d/login file and add

account required pam_time.so

just below the auth entries there as well.
VASEMMISTOLIITTO - RIKKAUTTA JOLLA ON ARVOA

”Ei ole olemassa todellista vapautta ilman toisinajattelun vapautta.” Rosa Luxemburg 1918

Senior

  • Vieras
Vs: Aikarajoitukset koneen käyttöön? (etc/security/time.conf)
« Vastaus #26 : 17.03.10 - klo:09.55 »
Nyt toimii. Eli laiton rivin

login|gdm;*;kayttaja;Al0800-1800

etc/security/time.conf-tiedostoon

ja sitten vain tiedostojen gdm ja login loppuosaan:

account required pam_time.so

No nyt jos haluaa esim. tehdä http:n käyttöön liittyviä aikarajoituksia, niin riittäneekö että koodia kirjoitetaan enää vain tuohon time.conf-tiedostoon vai täytyyköhän käydä jotain tiedostoa editoimassa myös etc/pam.d-hakemistossa? Tähänastinenhan on liittynyt järjestelmän tietyn käyttäjän loggautumisoikeuden aikarajoitukseen.

Pakollinen "ulosheitto" 15 minuutin armonajalla:

Esimerkki (Fedora)

Forced Logoff

If user jordan is logged in when 6PM comes around nothing will happen until she logs out. After she logs out she will not be permitted to log back in as per our PAM entries.

To setup a simple automatic logout procedure I will use a basic cron entry to force the logoff at a predetermined time. I will give a 15 minute “grace” period past the 6PM restriction.

As root I’ll enter crontab -e and edit the file to contain this line:

15 18 * * * /usr/bin/skill -KILL -u jordan

Now every day at 6:15PM the user “jordan” will be logged off forcefully without warning.

Make sure to restart the cron dameon with service crond restart after each cron change.
« Viimeksi muokattu: 17.03.10 - klo:12.28 kirjoittanut Senior »