<PAGE>   1
                                                                   EXHIBIT 10.17


                Amended and Restated Hazardous Waste and PMPA
                          Indemnification Agreement



     This Amended and Restated Hazardous Waste and PMPA Indemnification
Agreement is made as of the 31st day of October, 1995, among Getty Petroleum
Corp. ("Getty"), Power Test Realty Company Limited Partnership ("the Borrower")
and Fleet Bank of Massachusetts, N.A. (the "Bank").



                                  WITNESSETH:

     WHEREAS, the Borrower duly authorized, executed and delivered to the Bank
of New England, N.A. ("BNE") a Loan Agreement dated as of December 10, 1986, as
amended by Amendment No. 1 to Loan Agreement dated as of November 30, 1989 (the
"Original Loan Agreement") which provided, upon certain terms and conditions,
for the making of loans (the "Loans") by BNE to the Borrower, which Loans are
secured by mortgages to BNE of certain gasoline service station properties (the
"Stations") owned by the Borrower;

     WHEREAS, the Borrower, Getty and BNE entered into a Hazardous Waste
Indemnification Agreement dated as of December 10, 1986, as amended by Amendment
No. 1 to Hazardous Waste Indemnification Agreement dated as of November 30,
1989, pursuant to the Original Loan Agreement, which the parties hereto desire
to amend and restate;

     WHEREAS, the Borrower has duly authorized, executed and delivered to the
Bank an Amended and Restated Loan Agreement of even date herewith (the "Amended
Loan Agreement") which amends and restates the Original Loan Agreement;

     WHEREAS, the Bank is the successor by name change to Fleet National Bank of
Boston, which was the successor in interest to the Federal Deposit Insurance
Corporation, as Receiver for New Bank of New England, N.A., which was the
successor in interest to the Federal Deposit Insurance Corporation, as Receiver
for BNE;

     WHEREAS, the Borrower is the lessor of certain Stations leased to Getty,
and Getty is obligated to indemnify the Borrower pursuant to the Leases (as
defined in the Amended Loan Agreement);





<PAGE>   2

     WHEREAS, the Bank is not willing to refinance the Loans to the Borrower
pursuant to the Amended Loan Agreement unless, and it is accordingly an express
condition precedent to the refinancing of the Loans that Getty shall agree to
indemnify the Borrower and the Bank for any and all losses, claims or
liabilities arising with regard to any hazardous wastes or environmental damage
or hazards attributable to or occurring at, or on the premises of, any Station
and any loss resulting from any litigation or governmental proceedings of any
kind involving allegations of any violation of the Petroleum Marketing Practices
Act or any other law in connection with the acquisition of the Stations by Getty
or the Borrower or any related entity;

     WHEREAS, in order to induce the Bank to refinance the Loans to the
Borrower, Getty has agreed to enter into this Agreement;

     NOW THEREFORE, in consideration of these premises, and as an inducement to
the Bank to refinance the Loans, Getty agrees with the Borrower and the Bank as
follows:

     1.   All capitalized terms not defined herein shall have the meanings
ascribed to them in the Amended Loan Agreement.

     2.    Getty hereby absolutely and unconditionally covenants and agrees to
indemnify and hold harmless the Borrower and the Bank and their respective
successors, assigns, representatives agents and servants from and against any
and all claims, liabilities, obligations, losses, damages, penalties, taxes,
actions, suits, costs, expenses or disbursements (including reasonable
attorneys' fees and expenses) of any kind and nature whatsoever which may be
imposed on, incurred by or asserted against the Borrower, the Bank or any such
other person, in any way relating to or arising out of any event, occurrence,
condition of, use of or state of repair at any Station with regard to any
environmental damage, real, threatened or potential, and any damage caused by
any hazardous waste substance or gasoline or petroleum product contamination or
damage, whether now existing or hereafter arising or occurring, or the existence
of any hazardous waste substance or gasoline or petroleum contamination in, on,
or around the land of any Station.  Getty covenants and agrees that it will be
fully responsible for the repair or replacement of all equipment at any Station,
including without limitation, underground storage tanks, connecting piping and
associated machinery and equipment, whether above or below ground.  It is
understood and agreed that the foregoing indemnification shall include any
claims or proceedings asserted by the U.S. Environmental Protection Agency or
any other federal, state, local, or municipal regulatory or administrative body.





<PAGE>   3



        3.    Getty hereby absolutely and unconditionally covenants and agrees  
to indemnify and hold harmless the Borrower and the Bank and their respective
successors, assigns, representatives, agents and servants from and against any
and all claims, liabilities, obligations, losses, damages, penalties, taxes,
actions, suits, costs, expenses or disbursements (including reasonable
attorneys fees and expenses) of any kind or nature whatsoever which may be
imposed on, incurred by or asserted against the Borrower, the Bank or any other
person, in any way relating to or arising out of any litigation or governmental
proceeding of any kind involving allegations of any violation of the Petroleum
Marketing Practices Act, 15 U.S.C. Section 2801 et seg., as amended, or any
other law or statute in connection with the acquisition of the Stations by
Getty or the Borrower. Without limiting the foregoing, Getty agrees to pay
directly to the Bank an amount equal to the Initial Appraised Value (as defined
in the Amended Loan Agreement) of any Station which is required to be sold,
transferred or otherwise disposed of by the Borrower, Getty or any other party
to any third party as a result of any litigation or governmental proceeding
referred to in the immediately preceding sentence.  Any such amount shall be
paid to the Bank as a condition to and simultaneously with such sale, transfer
or other disposition and shall be applied by the Bank as if it were a voluntary
prepayment of the Loan.

        4.     So long as the Loan Documents shall remain in force and effect,  
the Bank shall have the right upon the terms and conditions Set forth in
Section 5.20 of the Loan Agreement but not the obligation, through such
representatives or independent contractors as it may designate, to enter upon
the Stations and to expend funds to (i) conduct environmental assessments in
accordance with the terms and provisions of the Amended Loan Agreement; or (ii)
cure any breach of any of the representations, warranties, covenants or
conditions relating to Environmental Laws or Hazardous Substances made by or
imposed on the Borrower or its Subsidiaries under the Amended Loan Agreement, 
including environmental clean-up or remediation.  Getty agrees to pay any
amounts paid or advanced by the Bank and all costs and expenditures incurred in
connection with the exercise of its rights and remedies under this Agreement
including without limitation attorneys' fees, expert's fees and environmental
consultant's fees. The exercise by the Bank of any of its rights or remedies in
this Agreement shall not operate or be deemed to make the Bank an "owner" or
"operator" of any Station or a "responsible party" within the meaning of any
Environmental Law.





<PAGE>   4



                                      -4-

     5.    This Agreement shall be binding upon the successors and assigns of
Getty and shall inure to the benefit of the Borrower and the Bank and their
respective successors and assigns.

     6.    The terms of this Agreement and all rights and obligations of the
parties hereto shall be governed by the laws of the Commonwealth of
Massachusetts.  Such terms, rights and obligations may not be changed, modified
or amended except by an agreement in writing signed by the party against whom
enforcement of such change is sought.  This Agreement may be executed in any
number of counterparts and by the parties hereto on separate counterparts, but
all of such counterparts shall together constitute a single instrument.





<PAGE>   5



                                      -5-

     IN WITNESS WHEREOF, this Amended and Restated Hazardous Waste and PMPA
Indemnity Agreement has been duly executed as an instrument under seal as of
this 31st day of October, 1995.





                                        GETTY PETROLEUM CORP.




                                        By:   John J. Fitteron
                                            ----------------------------
                                        Name: John J. Fitteron
                                        Title Senior Vice President



                                        POWER TEST REALTY COMPANY
                                        LIMITED PARTNERSHIP



                                        BY:   CLS General Partnership
                                              Corp., its general
                                              partner



                                        By:  Leo Liebowitz
                                            ----------------------------
                                        Name: Leo Liebowitz
                                        Title: President



                                        FLEET BANK OF
                                         MASSACHUSETTS, N.A.



                                        By:   Thomas F. McNamara
                                            ----------------------------
                                        Name: Thomas F. McNamara
                                        Title: Vice President